Skip to content

Commit

Permalink
Merge pull request ufs-community#7 from mlee03/fms/2020.04.03
Browse files Browse the repository at this point in the history
FMS 2020.04.03
  • Loading branch information
pjpegion authored Feb 26, 2021
2 parents 7f6d446 + 8853c28 commit 778860b
Show file tree
Hide file tree
Showing 5 changed files with 232 additions and 364 deletions.
64 changes: 12 additions & 52 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,50 +139,22 @@ endif()
###############################################################################
### FMS
###############################################################################
include(fms_files.cmake)
add_library(fms ${fms_src_files} ${fms_headers})

list(APPEND _fms_defs_public use_libMPI
use_netCDF
GFS_PHYS
UFS
INTERNAL_FILE_NML)
if(QUAD_PRECISION)
list(APPEND _fms_defs_public ENABLE_QUAD_PRECISION)
endif()
set(GFS_PHYS ON CACHE BOOL "Enable GFS Physics")
if(NOT 32BIT)
set(64BIT ON CACHE BOOL "Enable 64-bit")

# check gettid
include(CheckFunctionExists)
check_function_exists(gettid HAVE_GETTID)
if(HAVE_GETTID)
list(APPEND _fms_defs_public HAVE_GETTID)
endif()

target_compile_definitions(fms PUBLIC "${_fms_defs_public}")

if(32BIT)
list(APPEND _fms_defs_private OVERLOAD_R4
OVERLOAD_R8)
if(NOT QUAD_PRECISION)
set(ENABLE_QUAD_PRECISION OFF CACHE BOOL "Enable Quad-precision")
endif()

target_compile_definitions(fms PRIVATE "${_fms_defs_private}")

target_include_directories(fms PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/FMS/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/FMS/fms>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/FMS/fms2_io/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/FMS/mod>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/FMS/mpp/include>)
target_include_directories(fms INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/mod>)
target_link_libraries(fms PUBLIC MPI::MPI_Fortran
NetCDF::NetCDF_Fortran)
if(OpenMP_Fortran_FOUND)
target_link_libraries(fms PRIVATE OpenMP::OpenMP_Fortran)
add_subdirectory(FMS)

if(32BIT)
add_library(fms ALIAS fms_r4)
else()
add_library(fms ALIAS fms_r8)
endif()
set_target_properties(fms PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/FMS)
set_target_properties(fms PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/FMS/mod)
set_target_properties(fms PROPERTIES PUBLIC_HEADER "${fms_headers}" )

###############################################################################
### stochastic_physics
Expand Down Expand Up @@ -349,20 +321,8 @@ target_link_libraries(ufs_model PRIVATE ufs
### Install
###############################################################################
install(
TARGETS fms
EXPORT fms-config
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PUBLIC_HEADER DESTINATION include )

install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/FMS/mod DESTINATION ${CMAKE_INSTALL_PREFIX})
TARGETS ufs

install(EXPORT fms-config
DESTINATION lib/cmake
)
install(
#TARGETS ufs
TARGETS ufs stochastic_physics
EXPORT ufs-config
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
Expand Down
2 changes: 1 addition & 1 deletion FMS
Submodule FMS updated 2 files
+3 −1 CHANGELOG.md
+5 −5 CMakeLists.txt
92 changes: 0 additions & 92 deletions fms_files.cmake

This file was deleted.

Loading

0 comments on commit 778860b

Please sign in to comment.