Skip to content

Commit

Permalink
build: add -DPORTABLE_KINDS option to autotools and cmake (#1572)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlee03 committed Aug 27, 2024
1 parent 5267c5c commit 53c55b4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMAKE_INSTRUCTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ The following build options are available:
-DCONSTANTS "Build with <X> constants parameter definitions" DEFAULT:GFDL OPTIONS:GFS|GEOS|GFDL
-DINTERNAL_FILE_NML "Enable compiler definition -DINTERNAL_FILE_NML" DEFAULT: ON
-DENABLE_QUAD_PRECISION "Enable compiler definition -DENABLE_QUAD_PRECISION" DEFAULT: ON
-DPORTABLE_KINDS "Enable compiler definition -DPORTABLE_KINDS" DEFAULT:OFF
-DGFS_PHYS "Enable compiler definition -DGFS_PHYS" DEFAULT:OFF
-DLARGEFILE "Enable compiler definition -Duse_LARGEFILE" DEFAULT:OFF
-DWITH_YAML "Enable compiler definition -Duse_yaml" DEFAULT:OFF
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ option(SHARED_LIBS "Build shared/dynamic libraries" OFF)
# Options for compiler definitions
option(INTERNAL_FILE_NML "Enable compiler definition -DINTERNAL_FILE_NML" ON)
option(ENABLE_QUAD_PRECISION "Enable compiler definition -DENABLE_QUAD_PRECISION" ON)
option(PORTABLE_KINDS "Enable compiler definition -DPORTABLE_KINDS" OFF)
option(GFS_PHYS "Enable compiler definition -DGFS_PHYS" OFF)
option(LARGEFILE "Enable compiler definition -Duse_LARGEFILE" OFF)
option(WITH_YAML "Enable compiler definition -Duse_yaml" OFF)
Expand Down Expand Up @@ -267,6 +268,10 @@ if(ENABLE_QUAD_PRECISION)
list(APPEND fms_defs ENABLE_QUAD_PRECISION)
endif()

if(PORTABLE_KINDS)
list(APPEND fms_defs PORTABLE_KINDS)
endif()

if(LARGEFILE)
list(APPEND fms_defs use_LARGEFILE)
endif()
Expand Down
12 changes: 12 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ AS_IF([test ${enable_r8_default:-yes} = yes],
[enable_r8_default=yes],
[enable_r8_default=no])

AC_ARG_ENABLE([portable-kinds],
[AS_HELP_STRING([--enable-portable-kinds],
[Enables compilation with -DPORTABLE_KINDS with iso_c_binding KIND type parameters])])
AS_IF([test ${enable_portable_kinds:-no} = yes],
[enable_portable_kinds=yes],
[enable_portable_kinds=no])

# user enabled testing with input files
AC_MSG_CHECKING([whether to enable tests with input files])
AC_ARG_ENABLE([test-input],
Expand Down Expand Up @@ -342,6 +349,11 @@ if test $enable_setting_flags = yes; then
AC_DEFINE([no_8byte_integers], [1], [Set to disable 8 byte integer Fortran routines])
fi

# Builds with C data types
if test $enable_portable_kinds = yes; then
AC_DEFINE([PORTABLE_KINDS], [1], [Set to define KIND parameters to iso_c_binding KIND parameters])
fi

# Add Cray Pointer support flag
if test ! -z "$FC_CRAY_POINTER_FLAG"; then
FCFLAGS="$FCFLAGS $FC_CRAY_POINTER_FLAG"
Expand Down

0 comments on commit 53c55b4

Please sign in to comment.