From 5cc941810a37f4159d2a6087f75233db8711341e Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Fri, 15 Nov 2024 15:20:08 +1100 Subject: [PATCH 01/31] something which builds --- CMakeLists.txt | 171 ++++++++++++++++++++++++------------------------- 1 file changed, 85 insertions(+), 86 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a1cf87..8025aab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,7 +137,6 @@ endif() find_package(FoX 4.1.2 REQUIRED) find_package(NetCDF 4.7.3 REQUIRED Fortran) find_package(ESMF 8.3.0 MODULE REQUIRED) -find_package(fms COMPONENTS R8 REQUIRED) find_package(PIO 2.5.3 REQUIRED COMPONENTS C Fortran) #[==============================================================================[ @@ -152,74 +151,74 @@ add_subdirectory(share) # Data component (CDEPS) add_subdirectory(CDEPS) -# Ocean component (MOM6) -if(OM3_BUILD_MOM6) - add_subdirectory(MOM6) -endif() +# # Ocean component (MOM6) +# if(OM3_BUILD_MOM6) +# add_subdirectory(MOM6) +# endif() -# Sea-ice component (CICE6) -if(OM3_BUILD_CICE6) - add_subdirectory(CICE) -endif() +# # Sea-ice component (CICE6) +# if(OM3_BUILD_CICE6) +# add_subdirectory(CICE) +# endif() -# Wave component (WW3) -if(OM3_BUILD_WW3) - add_subdirectory(WW3) -endif() +# # Wave component (WW3) +# if(OM3_BUILD_WW3) +# add_subdirectory(WW3) +# endif() # Mediator component (CMEPS) add_subdirectory(CMEPS) # Add executable for each enabled configuration -foreach(CONF IN LISTS KnownConfigurations) - if(NOT OM3_ENABLE_${CONF}) - continue() - endif() - - set(ComponentsTargets "") - if(OM3_${CONF} MATCHES MOM6) - list(APPEND ComponentsTargets AccessOM3::mom6) - else() - list(APPEND ComponentsTargets AccessOM3::cdeps_docn) - endif() - if(OM3_${CONF} MATCHES CICE6) - list(APPEND ComponentsTargets AccessOM3::cice) - else() - list(APPEND ComponentsTargets AccessOM3::cdeps_dice) - endif() - if(OM3_${CONF} MATCHES WW3) - list(APPEND ComponentsTargets AccessOM3::ww3) - else() - list(APPEND ComponentsTargets AccessOM3::cdeps_dwav) - endif() - - # We use the CESM driver from CMEPS - add_fortran_library(OM3_cesm_driver_${CONF} mod/OM3_cesm_driver_${CONF} STATIC - CMEPS/CMEPS/cesm/driver/esm.F90 - CMEPS/CMEPS/cesm/driver/ensemble_driver.F90 - CMEPS/CMEPS/cesm/driver/esm_time_mod.F90 - ) - target_link_libraries(OM3_cesm_driver_${CONF} - PUBLIC esmf - PRIVATE ${ComponentsTargets} AccessOM3::cdeps_drof AccessOM3::cdeps_datm AccessOM3::cmeps AccessOM3::nuopc_cap_share AccessOM3::share AccessOM3::timing - ) - target_compile_definitions(OM3_cesm_driver_${CONF} PRIVATE MED_PRESENT - ATM_PRESENT - ICE_PRESENT - OCN_PRESENT - WAV_PRESENT - ROF_PRESENT - $<$:DEBUG> - ) - - add_executable(OM3_${CONF} CMEPS/CMEPS/cesm/driver/esmApp.F90) - target_link_libraries(OM3_${CONF} PRIVATE OM3_cesm_driver_${CONF} AccessOM3::share esmf) - - set_target_properties(OM3_${CONF} PROPERTIES - LINKER_LANGUAGE Fortran - OUTPUT_NAME access-om3-${CONF} - ) -endforeach() +# foreach(CONF IN LISTS KnownConfigurations) +# if(NOT OM3_ENABLE_${CONF}) +# continue() +# endif() + +# set(ComponentsTargets "") +# if(OM3_${CONF} MATCHES MOM6) +# list(APPEND ComponentsTargets AccessOM3::mom6) +# else() +# list(APPEND ComponentsTargets AccessOM3::cdeps_docn) +# endif() +# if(OM3_${CONF} MATCHES CICE6) +# list(APPEND ComponentsTargets AccessOM3::cice) +# else() +# list(APPEND ComponentsTargets AccessOM3::cdeps_dice) +# endif() +# if(OM3_${CONF} MATCHES WW3) +# list(APPEND ComponentsTargets AccessOM3::ww3) +# else() +# list(APPEND ComponentsTargets AccessOM3::cdeps_dwav) +# endif() + +# # We use the CESM driver from CMEPS +# add_fortran_library(OM3_cesm_driver_${CONF} mod/OM3_cesm_driver_${CONF} STATIC +# CMEPS/CMEPS/cesm/driver/esm.F90 +# CMEPS/CMEPS/cesm/driver/ensemble_driver.F90 +# CMEPS/CMEPS/cesm/driver/esm_time_mod.F90 +# ) +# target_link_libraries(OM3_cesm_driver_${CONF} +# PUBLIC esmf +# PRIVATE ${ComponentsTargets} AccessOM3::cdeps_drof AccessOM3::cdeps_datm AccessOM3::cmeps AccessOM3::nuopc_cap_share AccessOM3::share AccessOM3::timing +# ) +# target_compile_definitions(OM3_cesm_driver_${CONF} PRIVATE MED_PRESENT +# ATM_PRESENT +# ICE_PRESENT +# OCN_PRESENT +# WAV_PRESENT +# ROF_PRESENT +# $<$:DEBUG> +# ) + +# add_executable(OM3_${CONF} CMEPS/CMEPS/cesm/driver/esmApp.F90) +# target_link_libraries(OM3_${CONF} PRIVATE OM3_cesm_driver_${CONF} AccessOM3::share esmf) + +# set_target_properties(OM3_${CONF} PROPERTIES +# LINKER_LANGUAGE Fortran +# OUTPUT_NAME access-om3-${CONF} +# ) +# endforeach() #[==============================================================================[ # Install or Export # @@ -230,27 +229,27 @@ endforeach() # Note that the installation of some components is done in the corresponding subdirectory # OM3 executables -if(OM3_BIN_INSTALL) - foreach(CONF IN LISTS KnownConfigurations) - if(NOT OM3_ENABLE_${CONF}) - continue() - endif() - - install(TARGETS OM3_${CONF} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ) - endforeach() -endif() - -# Libraries -if(OM3_LIB_INSTALL) - configure_package_config_file( - cmake/AccessOM3Config.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/AccessOM3Config.cmake - INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/AccessOM3 - ) - install(FILES ${CMAKE_SOURCE_DIR}/cmake/FindFoX.cmake ${CMAKE_CURRENT_BINARY_DIR}/AccessOM3Config.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/AccessOM3 - COMPONENT AccessOM3_Development - ) -endif() +# if(OM3_BIN_INSTALL) +# foreach(CONF IN LISTS KnownConfigurations) +# if(NOT OM3_ENABLE_${CONF}) +# continue() +# endif() + +# install(TARGETS OM3_${CONF} +# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +# ) +# endforeach() +# endif() + +# # Libraries +# if(OM3_LIB_INSTALL) +# configure_package_config_file( +# cmake/Access3ShareConfig.cmake.in +# ${CMAKE_CURRENT_BINARY_DIR}/Access3ShareConfig.cmake +# INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/AccessOM3Share +# ) +install(FILES ${CMAKE_SOURCE_DIR}/cmake/FindFoX.cmake #${CMAKE_CURRENT_BINARY_DIR}/Access3ShareConfig.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share + COMPONENT Access3Share +) +# endif() From eb09d7a6bde61d79bdc9b325b3ec5f9e05aba74b Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Mon, 18 Nov 2024 16:44:27 +1100 Subject: [PATCH 02/31] some messing around with building libraries --- CDEPS/CMakeLists.txt | 18 ++++- CMEPS/CMakeLists.txt | 4 +- CMakeLists.txt | 76 +++++++++---------- ...g.cmake.in => Access3ShareConfig.cmake.in} | 43 ++++++----- share/CMakeLists.txt | 4 +- 5 files changed, 81 insertions(+), 64 deletions(-) rename cmake/{AccessOM3Config.cmake.in => Access3ShareConfig.cmake.in} (68%) diff --git a/CDEPS/CMakeLists.txt b/CDEPS/CMakeLists.txt index 68a90f7..c1d9fa5 100644 --- a/CDEPS/CMakeLists.txt +++ b/CDEPS/CMakeLists.txt @@ -110,6 +110,22 @@ if(OM3_LIB_INSTALL) LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT AccessOM3_RunTime NAMELINK_COMPONENT AccessOM3_Development ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT AccessOM3_Development ) + # Fortran module files are a special case, as currently there is no standard + # way of handling them in CMake + target_include_directories(OM3_cdeps_common PUBLIC "$") + get_target_property(common_moddir OM3_cdeps_common Fortran_MODULE_DIRECTORY) + install(FILES + ${common_moddir}/dshr_methods_mod.mod + ${common_moddir}/dshr_strdata_mod.mod + ${common_moddir}/dshr_stream_mod.mod + ${common_moddir}/dshr_tinterp_mod.mod + + ${common_moddir}/dshr_dfield_mod.mod + ${common_moddir}/dshr_fldlist_mod.mod + ${common_moddir}/dshr_mod.mod + DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-cdeps-common + COMPONENT AccessOM3_Development + ) # components foreach(LIB atm ocn ice wav rof) set_target_properties(OM3_cdeps_d${LIB} PROPERTIES @@ -133,6 +149,6 @@ if(OM3_LIB_INSTALL) install(EXPORT AccessOM3cdeps_Targets FILE AccessOM3cdepsTargets.cmake NAMESPACE AccessOM3:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/AccessOM3 + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share ) endif() diff --git a/CMEPS/CMakeLists.txt b/CMEPS/CMakeLists.txt index e91036b..a17d625 100644 --- a/CMEPS/CMakeLists.txt +++ b/CMEPS/CMakeLists.txt @@ -89,7 +89,7 @@ if(OM3_LIB_INSTALL) install(EXPORT AccessOM3cmeps_Targets FILE AccessOM3cmepsTargets.cmake NAMESPACE AccessOM3:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/AccessOM3 + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share ) ## NUOPC cap share @@ -113,6 +113,6 @@ if(OM3_LIB_INSTALL) install(EXPORT AccessOM3nuopc_cap_share_Targets FILE AccessOM3nuopc_cap_shareTargets.cmake NAMESPACE AccessOM3:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/AccessOM3 + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share ) endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 8025aab..93eac99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.18) # Basic project definition # #]==============================================================================] -project(ACCESS-OM3 VERSION "0.2.0" - HOMEPAGE_URL https://github.com/COSIMA/access-om3 +project(Access3Share VERSION "0.3.1" + HOMEPAGE_URL https://github.com/access-nri/access-om3 DESCRIPTION "Global coupled ocean - sea ice - wave model" LANGUAGES C Fortran) @@ -35,20 +35,20 @@ message(STATUS " - CICE6-WW3 ${OM3_ENABLE_CICE6-WW3}") message(STATUS " - MOM6-CICE6-WW3 ${OM3_ENABLE_MOM6-CICE6-WW3}") # Build options -option(OM3_BIN_INSTALL "Instal ACCESS-OM3 executables" ${PROJECT_IS_TOP_LEVEL}) +option(OM3_BIN_INSTALL "Instal ACCESS-OM3 executables" ON) option(OM3_LIB_INSTALL "Instal ACCESS-OM3 libraries" OFF) option(OM3_OPENMP "Enable OpenMP threading" OFF) option(OM3_MOM_SYMMETRIC "Use symmetric memory" OFF) -set(OM3_CICE_IO "PIO" CACHE STRING "CICE OPTIONS: Choose IO options.") -set_property(CACHE OM3_CICE_IO PROPERTY STRINGS "NetCDF" "PIO" "Binary") + +if(OM3_LIB_INSTALL) + set(OM3_BIN_INSTALL OFF) +endif() message(STATUS "Build options") message(STATUS " - OM3_BIN_INSTALL ${OM3_BIN_INSTALL}") message(STATUS " - OM3_LIB_INSTALL ${OM3_LIB_INSTALL}") message(STATUS " - OM3_OPENMP ${OM3_OPENMP}") message(STATUS " - OM3_MOM_SYMMETRIC ${OM3_MOM_SYMMETRIC}") -message(STATUS " - OM3_CICE_IO ${OM3_CICE_IO}") - #[==============================================================================[ # Project configuration # @@ -193,26 +193,26 @@ add_subdirectory(CMEPS) # endif() # # We use the CESM driver from CMEPS -# add_fortran_library(OM3_cesm_driver_${CONF} mod/OM3_cesm_driver_${CONF} STATIC -# CMEPS/CMEPS/cesm/driver/esm.F90 -# CMEPS/CMEPS/cesm/driver/ensemble_driver.F90 -# CMEPS/CMEPS/cesm/driver/esm_time_mod.F90 -# ) -# target_link_libraries(OM3_cesm_driver_${CONF} -# PUBLIC esmf -# PRIVATE ${ComponentsTargets} AccessOM3::cdeps_drof AccessOM3::cdeps_datm AccessOM3::cmeps AccessOM3::nuopc_cap_share AccessOM3::share AccessOM3::timing -# ) -# target_compile_definitions(OM3_cesm_driver_${CONF} PRIVATE MED_PRESENT -# ATM_PRESENT -# ICE_PRESENT -# OCN_PRESENT -# WAV_PRESENT -# ROF_PRESENT -# $<$:DEBUG> -# ) - -# add_executable(OM3_${CONF} CMEPS/CMEPS/cesm/driver/esmApp.F90) -# target_link_libraries(OM3_${CONF} PRIVATE OM3_cesm_driver_${CONF} AccessOM3::share esmf) +# # add_fortran_library(OM3_cesm_driver_${CONF} mod/OM3_cesm_driver_${CONF} STATIC +# # CMEPS/CMEPS/cesm/driver/esm.F90 +# # CMEPS/CMEPS/cesm/driver/ensemble_driver.F90 +# # CMEPS/CMEPS/cesm/driver/esm_time_mod.F90 +# # ) +# # target_link_libraries(OM3_cesm_driver_${CONF} +# # PUBLIC esmf +# # PRIVATE ${ComponentsTargets} AccessOM3::cdeps_drof AccessOM3::cdeps_datm AccessOM3::cmeps AccessOM3::nuopc_cap_share AccessOM3::share AccessOM3::timing +# # ) +# # target_compile_definitions(OM3_cesm_driver_${CONF} PRIVATE MED_PRESENT +# # ATM_PRESENT +# # ICE_PRESENT +# # OCN_PRESENT +# # WAV_PRESENT +# # ROF_PRESENT +# # $<$:DEBUG> +# # ) + +# # add_executable(OM3_${CONF} CMEPS/CMEPS/cesm/driver/esmApp.F90) +# # target_link_libraries(OM3_${CONF} PRIVATE OM3_cesm_driver_${CONF} AccessOM3::share esmf) # set_target_properties(OM3_${CONF} PROPERTIES # LINKER_LANGUAGE Fortran @@ -242,14 +242,14 @@ add_subdirectory(CMEPS) # endif() # # Libraries -# if(OM3_LIB_INSTALL) -# configure_package_config_file( -# cmake/Access3ShareConfig.cmake.in -# ${CMAKE_CURRENT_BINARY_DIR}/Access3ShareConfig.cmake -# INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/AccessOM3Share -# ) -install(FILES ${CMAKE_SOURCE_DIR}/cmake/FindFoX.cmake #${CMAKE_CURRENT_BINARY_DIR}/Access3ShareConfig.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share - COMPONENT Access3Share -) -# endif() +if(OM3_LIB_INSTALL) + configure_package_config_file( + cmake/Access3ShareConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/Access3ShareConfig.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share + ) + install(FILES ${CMAKE_SOURCE_DIR}/cmake/FindFoX.cmake ${CMAKE_CURRENT_BINARY_DIR}/Access3ShareConfig.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share + COMPONENT Access3Share + ) +endif() diff --git a/cmake/AccessOM3Config.cmake.in b/cmake/Access3ShareConfig.cmake.in similarity index 68% rename from cmake/AccessOM3Config.cmake.in rename to cmake/Access3ShareConfig.cmake.in index 2a4703f..37aaab1 100644 --- a/cmake/AccessOM3Config.cmake.in +++ b/cmake/Access3ShareConfig.cmake.in @@ -1,56 +1,56 @@ @PACKAGE_INIT@ if(NOT AccessOM3_FIND_QUIETLY) - message(STATUS "Found AccessOM3: ${PACKAGE_PREFIX_DIR}") + message(STATUS "Found Access3Share: ${PACKAGE_PREFIX_DIR}") endif() # Available components # The following components are always available (order is important!) -set(_supported_components timing share nuopc_cap_share cmeps cdeps mom6 cice ww3) +set(_supported_components timing share nuopc_cap_share cmeps cdeps) #mom6 cice ww3) # Check validity of requested components foreach(_comp ${AccessOM3_FIND_COMPONENTS}) if (NOT _comp IN_LIST _supported_components) - set(AccessOM3_FOUND False) - set(AccessOM3_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}") + set(Access3Share_FOUND False) + set(Access3Share_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}") endif() endforeach() # Some components are only available if they were built if ((mom6 IN_LIST ${AccessOM3_FIND_COMPONENTS}) AND (NOT @OM3_BUILD_MOM6@)) - set(AccessOM3_FOUND False) - set(AccessOM3_NOT_FOUND_MESSAGE "The following component is not available: mom6") + set(Access3Share_FOUND False) + set(Access3Share_NOT_FOUND_MESSAGE "The following component is not available: mom6") endif() if ((cice IN_LIST ${AccessOM3_FIND_COMPONENTS}) AND (NOT @OM3_BUILD_CICE6@)) - set(AccessOM3_FOUND False) - set(AccessOM3_NOT_FOUND_MESSAGE "The following component is not available: cice") + set(Access3Share_FOUND False) + set(Access3Share_NOT_FOUND_MESSAGE "The following component is not available: cice") endif() if ((ww3 IN_LIST ${AccessOM3_FIND_COMPONENTS}) AND (NOT @OM3_BUILD_WW3@)) - set(AccessOM3_FOUND False) - set(AccessOM3_NOT_FOUND_MESSAGE "The following component is not available: ww3") + set(Access3Share_FOUND False) + set(Access3Share_NOT_FOUND_MESSAGE "The following component is not available: ww3") endif() # Build a list of all the required components, taking into account their dependencies -set(_required_components ${AccessOM3_FIND_COMPONENTS}) +set(_required_components ${Access3Share_FIND_COMPONENTS}) if(cice IN_LIST _required_components) list(APPEND _required_components cdeps nuopc_cap_share share timing) endif() if(mom6 IN_LIST _required_components) list(APPEND _required_components nuopc_cap_share share) endif() -if(cdeps IN_LIST _required_components) +#if(cdeps IN_LIST _required_components) list(APPEND _required_components cmeps share nuopc_cap_share) -endif() -if(cmeps IN_LIST _required_components) +#endif() +#if(cmeps IN_LIST _required_components) list(APPEND _required_components nuopc_cap_share share timing) -endif() -if(nuopc_cap_share IN_LIST _required_components) +#endif() +#if(nuopc_cap_share IN_LIST _required_components) list(APPEND _required_components share timing) -endif() -if(share IN_LIST _required_components) +#endif() +#if(share IN_LIST _required_components) list(APPEND _required_components timing) -endif() +#endif() list(REMOVE_DUPLICATES _required_components) if(NOT AccessOM3_FIND_QUIETLY) @@ -60,9 +60,10 @@ endif() # Include required targets. We do this by looping over the _supported_components # list because the order in which targets are loaded matters. foreach(_comp ${_supported_components}) - if (_comp IN_LIST _required_components) + #if (_comp IN_LIST _required_components) + message(STATUS " - Including AccessOM3 Components: ${_comp}") include("${CMAKE_CURRENT_LIST_DIR}/AccessOM3${_comp}Targets.cmake") - endif() + #endif() endforeach() # Find dependencies of required components diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index 57aa67b..a58a21c 100644 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -99,7 +99,7 @@ if(OM3_LIB_INSTALL) install(EXPORT AccessOM3share_Targets FILE AccessOM3shareTargets.cmake NAMESPACE AccessOM3:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/AccessOM3 + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share ) ## timing library @@ -123,6 +123,6 @@ if(OM3_LIB_INSTALL) install(EXPORT AccessOM3timing_Targets FILE AccessOM3timingTargets.cmake NAMESPACE AccessOM3:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/AccessOM3 + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share ) endif() From 0cfd3ca7530b4959c1bdc7ec85c60a34adec93aa Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Mon, 13 Jan 2025 14:51:51 +1100 Subject: [PATCH 03/31] mods to Access3 share to build executable files --- CDEPS/CMakeLists.txt | 119 ++++---- CMEPS/CMakeLists.txt | 70 ++--- .../patches/med_phases_history_mod.F90.patch | 0 CMakeLists.txt | 274 +++++++++--------- cmake/Access3ShareConfig.cmake.in | 64 ++-- share/CMakeLists.txt | 78 ++--- 6 files changed, 297 insertions(+), 308 deletions(-) mode change 100644 => 100755 CDEPS/CMakeLists.txt mode change 100644 => 100755 CMEPS/CMakeLists.txt mode change 100644 => 100755 CMEPS/patches/med_phases_history_mod.F90.patch mode change 100644 => 100755 CMakeLists.txt mode change 100644 => 100755 cmake/Access3ShareConfig.cmake.in mode change 100644 => 100755 share/CMakeLists.txt diff --git a/CDEPS/CMakeLists.txt b/CDEPS/CMakeLists.txt old mode 100644 new mode 100755 index c1d9fa5..988750c --- a/CDEPS/CMakeLists.txt +++ b/CDEPS/CMakeLists.txt @@ -1,14 +1,14 @@ ### Targets ## Common library -add_fortran_library(OM3_cdeps_common mod/common STATIC) -add_library(AccessOM3::cdeps_common ALIAS OM3_cdeps_common) -target_include_directories(OM3_cdeps_common PRIVATE $) -target_link_libraries(OM3_cdeps_common +add_fortran_library(ACCESS3_cdeps_common mod/common STATIC) +add_library(Access3Share::cdeps_common ALIAS ACCESS3_cdeps_common) +target_include_directories(ACCESS3_cdeps_common PRIVATE $) +target_link_libraries(ACCESS3_cdeps_common PUBLIC esmf - PRIVATE AccessOM3::share AccessOM3::cmeps AccessOM3::nuopc_cap_share FoX::FoX PIO::PIO_Fortran + PRIVATE Access3Share::share Access3Share::cmeps Access3Share::nuopc_cap_share FoX::FoX PIO::PIO_Fortran ) -target_sources(OM3_cdeps_common PRIVATE +target_sources(ACCESS3_cdeps_common PRIVATE CDEPS/streams/dshr_methods_mod.F90 CDEPS/streams/dshr_strdata_mod.F90 CDEPS/streams/dshr_stream_mod.F90 @@ -20,14 +20,14 @@ target_sources(OM3_cdeps_common PRIVATE ) ## DATM -add_fortran_library(OM3_cdeps_datm mod/datm STATIC) -add_library(AccessOM3::cdeps_datm ALIAS OM3_cdeps_datm) -target_include_directories(OM3_cdeps_datm PRIVATE $) -target_link_libraries(OM3_cdeps_datm +add_fortran_library(ACCESS3_cdeps_datm mod/datm STATIC) +add_library(Access3Share::cdeps_datm ALIAS ACCESS3_cdeps_datm) +target_include_directories(ACCESS3_cdeps_datm PRIVATE $) +target_link_libraries(ACCESS3_cdeps_datm PUBLIC esmf - PRIVATE AccessOM3::cdeps_common AccessOM3::share + PRIVATE Access3Share::cdeps_common Access3Share::share ) -target_sources(OM3_cdeps_datm PRIVATE +target_sources(ACCESS3_cdeps_datm PRIVATE CDEPS/datm/datm_datamode_cfsr_mod.F90 CDEPS/datm/datm_datamode_clmncep_mod.F90 CDEPS/datm/datm_datamode_core2_mod.F90 @@ -38,17 +38,17 @@ target_sources(OM3_cdeps_datm PRIVATE CDEPS/datm/datm_datamode_simple_mod.F90 extra_sources/datm_datamode_jra55do_mod.F90 ) -add_patched_source(OM3_cdeps_datm CDEPS/datm/atm_comp_nuopc.F90) +add_patched_source(ACCESS3_cdeps_datm CDEPS/datm/atm_comp_nuopc.F90) ## DOCN -add_fortran_library(OM3_cdeps_docn mod/docn STATIC) -add_library(AccessOM3::cdeps_docn ALIAS OM3_cdeps_docn) -target_include_directories(OM3_cdeps_docn PRIVATE $) -target_link_libraries(OM3_cdeps_docn +add_fortran_library(ACCESS3_cdeps_docn mod/docn STATIC) +add_library(Access3Share::cdeps_docn ALIAS ACCESS3_cdeps_docn) +target_include_directories(ACCESS3_cdeps_docn PRIVATE $) +target_link_libraries(ACCESS3_cdeps_docn PUBLIC esmf - PRIVATE AccessOM3::cdeps_common AccessOM3::share + PRIVATE Access3Share::cdeps_common Access3Share::share ) -target_sources(OM3_cdeps_docn PRIVATE +target_sources(ACCESS3_cdeps_docn PRIVATE CDEPS/docn/docn_datamode_aquaplanet_mod.F90 CDEPS/docn/docn_datamode_copyall_mod.F90 CDEPS/docn/docn_datamode_cplhist_mod.F90 @@ -59,61 +59,61 @@ target_sources(OM3_cdeps_docn PRIVATE ) ## DICE -add_fortran_library(OM3_cdeps_dice mod/dice STATIC) -add_library(AccessOM3::cdeps_dice ALIAS OM3_cdeps_dice) -target_include_directories(OM3_cdeps_dice PRIVATE $) -target_link_libraries(OM3_cdeps_dice +add_fortran_library(ACCESS3_cdeps_dice mod/dice STATIC) +add_library(Access3Share::cdeps_dice ALIAS ACCESS3_cdeps_dice) +target_include_directories(ACCESS3_cdeps_dice PRIVATE $) +target_link_libraries(ACCESS3_cdeps_dice PUBLIC esmf - PRIVATE AccessOM3::cdeps_common AccessOM3::share + PRIVATE Access3Share::cdeps_common Access3Share::share ) -target_sources(OM3_cdeps_dice PRIVATE +target_sources(ACCESS3_cdeps_dice PRIVATE CDEPS/dice/dice_datamode_ssmi_mod.F90 CDEPS/dice/dice_flux_atmice_mod.F90 CDEPS/dice/ice_comp_nuopc.F90 ) ## DWAV -add_fortran_library(OM3_cdeps_dwav mod/dwav STATIC) -add_library(AccessOM3::cdeps_dwav ALIAS OM3_cdeps_dwav) -target_include_directories(OM3_cdeps_dwav PRIVATE $) -target_link_libraries(OM3_cdeps_dwav +add_fortran_library(ACCESS3_cdeps_dwav mod/dwav STATIC) +add_library(Access3Share::cdeps_dwav ALIAS ACCESS3_cdeps_dwav) +target_include_directories(ACCESS3_cdeps_dwav PRIVATE $) +target_link_libraries(ACCESS3_cdeps_dwav PUBLIC esmf - PRIVATE AccessOM3::cdeps_common AccessOM3::share + PRIVATE Access3Share::cdeps_common Access3Share::share ) -target_sources(OM3_cdeps_dwav PRIVATE +target_sources(ACCESS3_cdeps_dwav PRIVATE CDEPS/dwav/wav_comp_nuopc.F90 ) ## DROF -add_fortran_library(OM3_cdeps_drof mod/drof STATIC) -add_library(AccessOM3::cdeps_drof ALIAS OM3_cdeps_drof) -target_include_directories(OM3_cdeps_drof PRIVATE $) -target_link_libraries(OM3_cdeps_drof +add_fortran_library(ACCESS3_cdeps_drof mod/drof STATIC) +add_library(Access3Share::cdeps_drof ALIAS ACCESS3_cdeps_drof) +target_include_directories(ACCESS3_cdeps_drof PRIVATE $) +target_link_libraries(ACCESS3_cdeps_drof PUBLIC esmf - PRIVATE AccessOM3::cdeps_common AccessOM3::share + PRIVATE Access3Share::cdeps_common Access3Share::share ) -target_sources(OM3_cdeps_drof PRIVATE +target_sources(ACCESS3_cdeps_drof PRIVATE CDEPS/drof/rof_comp_nuopc.F90 ) ### Install and Export ## Library -if(OM3_LIB_INSTALL) +if(ACCESS3_LIB_INSTALL) # cdeps_common - set_target_properties(OM3_cdeps_common PROPERTIES + set_target_properties(ACCESS3_cdeps_common PROPERTIES OUTPUT_NAME access-cdeps-common EXPORT_NAME cdeps-common ) - install(TARGETS OM3_cdeps_common - EXPORT AccessOM3cdeps_Targets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT AccessOM3_RunTime NAMELINK_COMPONENT AccessOM3_Development - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT AccessOM3_Development + install(TARGETS ACCESS3_cdeps_common + EXPORT Access3Sharecdeps_Targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_RunTime NAMELINK_COMPONENT Access3Share_Development + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_Development ) # Fortran module files are a special case, as currently there is no standard # way of handling them in CMake - target_include_directories(OM3_cdeps_common PUBLIC "$") - get_target_property(common_moddir OM3_cdeps_common Fortran_MODULE_DIRECTORY) + target_include_directories(ACCESS3_cdeps_common PUBLIC "$") + get_target_property(common_moddir ACCESS3_cdeps_common Fortran_MODULE_DIRECTORY) install(FILES ${common_moddir}/dshr_methods_mod.mod ${common_moddir}/dshr_strdata_mod.mod @@ -124,31 +124,36 @@ if(OM3_LIB_INSTALL) ${common_moddir}/dshr_fldlist_mod.mod ${common_moddir}/dshr_mod.mod DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-cdeps-common - COMPONENT AccessOM3_Development + COMPONENT Access3Share_Development ) # components foreach(LIB atm ocn ice wav rof) - set_target_properties(OM3_cdeps_d${LIB} PROPERTIES + set_target_properties(ACCESS3_cdeps_d${LIB} PROPERTIES OUTPUT_NAME access-cdeps-d${LIB} EXPORT_NAME cdeps-d${LIB} ) - install(TARGETS OM3_cdeps_d${LIB} - EXPORT AccessOM3cdeps_Targets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT AccessOM3_RunTime NAMELINK_COMPONENT AccessOM3_Development - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT AccessOM3_Development + install(TARGETS ACCESS3_cdeps_d${LIB} + EXPORT Access3Sharecdeps_Targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_RunTime NAMELINK_COMPONENT Access3Share_Development + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_Development ) # Fortran module files are a special case, as currently there is no standard # way of handling them in CMake - target_include_directories(OM3_cdeps_d${LIB} PUBLIC "$") - get_target_property(d${LIB}_moddir OM3_cdeps_d${LIB} Fortran_MODULE_DIRECTORY) + target_include_directories(ACCESS3_cdeps_d${LIB} PUBLIC "$") + get_target_property(d${LIB}_moddir ACCESS3_cdeps_d${LIB} Fortran_MODULE_DIRECTORY) install(FILES ${d${LIB}_moddir}/${LIB}_comp_nuopc.mod DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-cdeps-d${LIB} - COMPONENT AccessOM3_Development + COMPONENT Access3Share_Development ) + # install(EXPORT ACCESS3_cdeps_d${LIB} + # FILE ACCESS3Sharecdeps_d${LIB}.cmake + # NAMESPACE Access3Share:: + # DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share + # ) endforeach() - install(EXPORT AccessOM3cdeps_Targets - FILE AccessOM3cdepsTargets.cmake - NAMESPACE AccessOM3:: + install(EXPORT Access3Sharecdeps_Targets + FILE Access3SharecdepsTargets.cmake + NAMESPACE Access3Share:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share ) endif() diff --git a/CMEPS/CMakeLists.txt b/CMEPS/CMakeLists.txt old mode 100644 new mode 100755 index a17d625..fcc0212 --- a/CMEPS/CMakeLists.txt +++ b/CMEPS/CMakeLists.txt @@ -1,16 +1,16 @@ ### Targets ## CMEPS library -add_fortran_library(OM3_cmeps mod/cmeps STATIC) -add_library(AccessOM3::cmeps ALIAS OM3_cmeps) -target_link_libraries(OM3_cmeps +add_fortran_library(ACCESS3_cmeps mod/cmeps STATIC) +add_library(Access3Share::cmeps ALIAS ACCESS3_cmeps) +target_link_libraries(ACCESS3_cmeps PUBLIC esmf - PRIVATE AccessOM3::nuopc_cap_share AccessOM3::share AccessOM3::timing + PRIVATE Access3Share::nuopc_cap_share Access3Share::share Access3Share::timing ) if(OpenMP_Fortran_FOUND) - target_link_libraries(OM3_cmeps PRIVATE OpenMP::OpenMP_Fortran) + target_link_libraries(ACCESS3_cmeps PRIVATE OpenMP::OpenMP_Fortran) endif() -target_sources(OM3_cmeps PRIVATE +target_sources(ACCESS3_cmeps PRIVATE CMEPS/cesm/flux_atmocn/shr_flux_mod.F90 CMEPS/mediator/med_phases_restart_mod.F90 CMEPS/mediator/med_map_mod.F90 @@ -48,16 +48,16 @@ target_sources(OM3_cmeps PRIVATE CMEPS/mediator/med_phases_post_wav_mod.F90 ) -add_patched_source(OM3_cmeps CMEPS/mediator/med_phases_history_mod.F90) +add_patched_source(ACCESS3_cmeps CMEPS/mediator/med_phases_history_mod.F90) ## NUOPC cap share -add_fortran_library(OM3_nuopc_cap_share mod/nuopc_cap_share STATIC) -add_library(AccessOM3::nuopc_cap_share ALIAS OM3_nuopc_cap_share) -target_link_libraries(OM3_nuopc_cap_share +add_fortran_library(ACCESS3_nuopc_cap_share mod/nuopc_cap_share STATIC) +add_library(Access3Share::nuopc_cap_share ALIAS ACCESS3_nuopc_cap_share) +target_link_libraries(ACCESS3_nuopc_cap_share PUBLIC esmf - PRIVATE AccessOM3::share + PRIVATE Access3Share::share ) -target_sources(OM3_nuopc_cap_share PRIVATE +target_sources(ACCESS3_nuopc_cap_share PRIVATE CMEPS/cesm/nuopc_cap_share/driver_pio_mod.F90 CMEPS/cesm/nuopc_cap_share/esm_utils_mod.F90 CMEPS/cesm/nuopc_cap_share/glc_elevclass_mod.F90 @@ -67,52 +67,52 @@ target_sources(OM3_nuopc_cap_share PRIVATE ### Install and Export -if(OM3_LIB_INSTALL) +if(ACCESS3_LIB_INSTALL) ## CMEPS library - set_target_properties(OM3_cmeps PROPERTIES + set_target_properties(ACCESS3_cmeps PROPERTIES OUTPUT_NAME access-cmeps EXPORT_NAME cmeps ) - install(TARGETS OM3_cmeps - EXPORT AccessOM3cmeps_Targets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT AccessOM3_RunTime NAMELINK_COMPONENT AccessOM3_Development - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT AccessOM3_Development + install(TARGETS ACCESS3_cmeps + EXPORT Access3Sharecmeps_Targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_RunTime NAMELINK_COMPONENT Access3Share_Development + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_Development ) # Fortran module files are a special case, as currently there is no standard # way of handling them in CMake - target_include_directories(OM3_cmeps PUBLIC "$") - get_target_property(cmeps_moddir OM3_cmeps Fortran_MODULE_DIRECTORY) + target_include_directories(ACCESS3_cmeps PUBLIC "$") + get_target_property(cmeps_moddir ACCESS3_cmeps Fortran_MODULE_DIRECTORY) install(FILES ${cmeps_moddir}/med.mod ${cmeps_moddir}/med_time_mod.mod ${cmeps_moddir}/med_internalstate_mod.mod DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-cmeps - COMPONENT AccessOM3_Development + COMPONENT Access3Share_Development ) - install(EXPORT AccessOM3cmeps_Targets - FILE AccessOM3cmepsTargets.cmake - NAMESPACE AccessOM3:: + install(EXPORT Access3Sharecmeps_Targets + FILE Access3SharecmepsTargets.cmake + NAMESPACE Access3Share:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share ) ## NUOPC cap share - set_target_properties(OM3_nuopc_cap_share PROPERTIES + set_target_properties(ACCESS3_nuopc_cap_share PROPERTIES OUTPUT_NAME access-nuopc_cap_share EXPORT_NAME nuopc_cap_share ) - install(TARGETS OM3_nuopc_cap_share - EXPORT AccessOM3nuopc_cap_share_Targets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT AccessOM3_RunTime NAMELINK_COMPONENT AccessOM3_Development - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT AccessOM3_Development + install(TARGETS ACCESS3_nuopc_cap_share + EXPORT Access3Sharenuopc_cap_share_Targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_RunTime NAMELINK_COMPONENT Access3Share_Development + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_Development ) # Fortran module files are a special case, as currently there is no standard # way of handling them in CMake - target_include_directories(OM3_nuopc_cap_share PUBLIC "$") - get_target_property(nuopc_cap_share_moddir OM3_nuopc_cap_share Fortran_MODULE_DIRECTORY) + target_include_directories(ACCESS3_nuopc_cap_share PUBLIC "$") + get_target_property(nuopc_cap_share_moddir ACCESS3_nuopc_cap_share Fortran_MODULE_DIRECTORY) install(DIRECTORY ${nuopc_cap_share_moddir}/ DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-nuopc_cap_share - COMPONENT AccessOM3_Development + COMPONENT Access3Share_Development ) - install(EXPORT AccessOM3nuopc_cap_share_Targets - FILE AccessOM3nuopc_cap_shareTargets.cmake - NAMESPACE AccessOM3:: + install(EXPORT Access3Sharenuopc_cap_share_Targets + FILE Access3Sharenuopc_cap_shareTargets.cmake + NAMESPACE Access3Share:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share ) endif() diff --git a/CMEPS/patches/med_phases_history_mod.F90.patch b/CMEPS/patches/med_phases_history_mod.F90.patch old mode 100644 new mode 100755 diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100644 new mode 100755 index 93eac99..baa553c --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,38 +17,43 @@ project(Access3Share VERSION "0.3.1" # Configurations to build list(APPEND KnownConfigurations MOM6 CICE6 WW3 MOM6-CICE6 CICE6-WW3 MOM6-WW3 MOM6-CICE6-WW3) -option(OM3_ENABLE_MOM6 "Build MOM6 configuration" OFF) -option(OM3_ENABLE_CICE6 "Build CICE6 configuration" OFF) -option(OM3_ENABLE_WW3 "Build WW3 configuration" OFF) -option(OM3_ENABLE_MOM6-WW3 "Build MOM6-WW3 configuration" OFF) -option(OM3_ENABLE_MOM6-CICE6 "Build MOM6-CICE6 configuration" ON) -option(OM3_ENABLE_CICE6-WW3 "Build CICE6-WW3 configuration" ON) -option(OM3_ENABLE_MOM6-CICE6-WW3 "Build MOM6-CICE6-WW3 configuration" ON) - -message(STATUS "Configurations") -message(STATUS " - MOM6 ${OM3_ENABLE_MOM6}") -message(STATUS " - CICE6 ${OM3_ENABLE_CICE6}") -message(STATUS " - WW3 ${OM3_ENABLE_WW3}") -message(STATUS " - MOM6-WW3 ${OM3_ENABLE_MOM6-WW3}") -message(STATUS " - MOM6-CICE6 ${OM3_ENABLE_MOM6-CICE6}") -message(STATUS " - CICE6-WW3 ${OM3_ENABLE_CICE6-WW3}") -message(STATUS " - MOM6-CICE6-WW3 ${OM3_ENABLE_MOM6-CICE6-WW3}") # Build options -option(OM3_BIN_INSTALL "Instal ACCESS-OM3 executables" ON) -option(OM3_LIB_INSTALL "Instal ACCESS-OM3 libraries" OFF) -option(OM3_OPENMP "Enable OpenMP threading" OFF) -option(OM3_MOM_SYMMETRIC "Use symmetric memory" OFF) +option(OM3_BIN_INSTALL "Install ACCESS-OM3 executables" ON) +option(ACCESS3_LIB_INSTALL "Install ACCESS-OM3 libraries" OFF) +option(ACCESS3_OPENMP "Enable OpenMP threading" OFF) +# option(ACCESS3_MOM_SYMMETRIC "Use symmetric memory" OFF) #move to MOM6 -if(OM3_LIB_INSTALL) +if(ACCESS3_LIB_INSTALL) set(OM3_BIN_INSTALL OFF) endif() message(STATUS "Build options") message(STATUS " - OM3_BIN_INSTALL ${OM3_BIN_INSTALL}") -message(STATUS " - OM3_LIB_INSTALL ${OM3_LIB_INSTALL}") -message(STATUS " - OM3_OPENMP ${OM3_OPENMP}") -message(STATUS " - OM3_MOM_SYMMETRIC ${OM3_MOM_SYMMETRIC}") +message(STATUS " - ACCESS3_LIB_INSTALL ${ACCESS3_LIB_INSTALL}") +message(STATUS " - ACCESS3_OPENMP ${ACCESS3_OPENMP}") +# message(STATUS " - ACCESS3_MOM_SYMMETRIC ${ACCESS3_MOM_SYMMETRIC}") + +if (OM3_BIN_INSTALL) + + option(OM3_ENABLE_MOM6 "Build MOM6 configuration" OFF) + option(OM3_ENABLE_CICE6 "Build CICE6 configuration" OFF) + option(OM3_ENABLE_WW3 "Build WW3 configuration" OFF) + option(OM3_ENABLE_MOM6-WW3 "Build MOM6-WW3 configuration" OFF) + option(OM3_ENABLE_MOM6-CICE6 "Build MOM6-CICE6 configuration" ON) + option(OM3_ENABLE_CICE6-WW3 "Build CICE6-WW3 configuration" ON) + option(OM3_ENABLE_MOM6-CICE6-WW3 "Build MOM6-CICE6-WW3 configuration" ON) + + message(STATUS "Configurations") + message(STATUS " - MOM6 ${OM3_ENABLE_MOM6}") + message(STATUS " - CICE6 ${OM3_ENABLE_CICE6}") + message(STATUS " - WW3 ${OM3_ENABLE_WW3}") + message(STATUS " - MOM6-WW3 ${OM3_ENABLE_MOM6-WW3}") + message(STATUS " - MOM6-CICE6 ${OM3_ENABLE_MOM6-CICE6}") + message(STATUS " - CICE6-WW3 ${OM3_ENABLE_CICE6-WW3}") + message(STATUS " - MOM6-CICE6-WW3 ${OM3_ENABLE_MOM6-CICE6-WW3}") + +endif() #[==============================================================================[ # Project configuration # @@ -56,7 +61,7 @@ message(STATUS " - OM3_MOM_SYMMETRIC ${OM3_MOM_SYMMETRIC}") list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) include(GNUInstallDirs) -if(OM3_LIB_INSTALL) +if(ACCESS3_LIB_INSTALL) include(CMakePackageConfigHelpers) endif() @@ -65,27 +70,25 @@ include(FortranLib) include(AddPatchedSource) ## Configure project variables +if (OM3_BIN_INSTALL) + # Do not build components that are not going to be used + if(OM3_ENABLE_MOM6 OR OM3_ENABLE_MOM6-CICE6 OR OM3_ENABLE_MOM6-WW3 OR OM3_ENABLE_MOM6-CICE6-WW3) + set(OM3_ENABLE_MOM6 ON) + else() + set(OM3_ENABLE_MOM6 OFF) + endif() + if(OM3_ENABLE_CICE6 OR OM3_ENABLE_MOM6-CICE6 OR OM3_ENABLE_CICE6-WW3 OR OM3_ENABLE_MOM6-CICE6-WW3) + set(OM3_ENABLE_CICE6 ON) + else() + set(OM3_ENABLE_CICE6 OFF) + endif() + if(OM3_ENABLE_WW3 OR OM3_ENABLE_MOM6-WW3 OR OM3_ENABLE_CICE6-WW3 OR OM3_ENABLE_MOM6-CICE6-WW3) + set(OM3_ENABLE_WW3 ON) + else() + set(OM3_ENABLE_WW3 OFF) + endif() -# Do not build components that are not going to be used -if(OM3_ENABLE_MOM6 OR OM3_ENABLE_MOM6-CICE6 OR OM3_ENABLE_MOM6-WW3 OR OM3_ENABLE_MOM6-CICE6-WW3) - set(OM3_BUILD_MOM6 ON) -else() - set(OM3_BUILD_MOM6 OFF) endif() -if(OM3_ENABLE_CICE6 OR OM3_ENABLE_MOM6-CICE6 OR OM3_ENABLE_CICE6-WW3 OR OM3_ENABLE_MOM6-CICE6-WW3) - set(OM3_BUILD_CICE6 ON) -else() - set(OM3_BUILD_CICE6 OFF) -endif() -if(OM3_ENABLE_WW3 OR OM3_ENABLE_MOM6-WW3 OR OM3_ENABLE_CICE6-WW3 OR OM3_ENABLE_MOM6-CICE6-WW3) - set(OM3_BUILD_WW3 ON) -else() - set(OM3_BUILD_WW3 OFF) -endif() -message(STATUS "Components to build") -message(STATUS " - OM3_BUILD_MOM6 ${OM3_BUILD_MOM6}") -message(STATUS " - OM3_BUILD_CICE6 ${OM3_BUILD_CICE6}") -message(STATUS " - OM3_BUILD_WW3 ${OM3_BUILD_WW3}") # Common compiler flags and definitions if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") @@ -131,94 +134,91 @@ set(CMAKE_INSTALL_MODULEDIR ${CMAKE_INSTALL_INCLUDEDIR} # Find dependencies find_package(MPI REQUIRED) -if(OM3_OPENMP) +find_package(ESMF 8.3.0 MODULE REQUIRED) +if(ACCESS3_OPENMP) find_package(OpenMP REQUIRED) endif() -find_package(FoX 4.1.2 REQUIRED) -find_package(NetCDF 4.7.3 REQUIRED Fortran) -find_package(ESMF 8.3.0 MODULE REQUIRED) -find_package(PIO 2.5.3 REQUIRED COMPONENTS C Fortran) +if (ACCESS3_LIB_INSTALL) + find_package(FoX 4.1.2 REQUIRED) + find_package(PIO 2.5.3 REQUIRED COMPONENTS C Fortran) + find_package(NetCDF 4.7.3 REQUIRED Fortran) +endif() + +if (OM3_BIN_INSTALL) + find_package(Access3Share REQUIRED cdeps cmeps nuopc_cap_share share timing) #should this list components which are required? + if(OM3_ENABLE_CICE6) + # find_package(Access3Share REQUIRED cdeps-docn) + find_package(AccessCiceCmeps REQUIRED) + endif() +endif() #[==============================================================================[ # Main definitions # #]==============================================================================] -# Some code shared by several components -add_subdirectory(share) - -## Components - -# Data component (CDEPS) -add_subdirectory(CDEPS) - -# # Ocean component (MOM6) -# if(OM3_BUILD_MOM6) -# add_subdirectory(MOM6) -# endif() - -# # Sea-ice component (CICE6) -# if(OM3_BUILD_CICE6) -# add_subdirectory(CICE) -# endif() - -# # Wave component (WW3) -# if(OM3_BUILD_WW3) -# add_subdirectory(WW3) -# endif() - -# Mediator component (CMEPS) -add_subdirectory(CMEPS) - -# Add executable for each enabled configuration -# foreach(CONF IN LISTS KnownConfigurations) -# if(NOT OM3_ENABLE_${CONF}) -# continue() -# endif() - -# set(ComponentsTargets "") -# if(OM3_${CONF} MATCHES MOM6) -# list(APPEND ComponentsTargets AccessOM3::mom6) -# else() -# list(APPEND ComponentsTargets AccessOM3::cdeps_docn) -# endif() -# if(OM3_${CONF} MATCHES CICE6) -# list(APPEND ComponentsTargets AccessOM3::cice) -# else() -# list(APPEND ComponentsTargets AccessOM3::cdeps_dice) -# endif() -# if(OM3_${CONF} MATCHES WW3) -# list(APPEND ComponentsTargets AccessOM3::ww3) -# else() -# list(APPEND ComponentsTargets AccessOM3::cdeps_dwav) -# endif() - -# # We use the CESM driver from CMEPS -# # add_fortran_library(OM3_cesm_driver_${CONF} mod/OM3_cesm_driver_${CONF} STATIC -# # CMEPS/CMEPS/cesm/driver/esm.F90 -# # CMEPS/CMEPS/cesm/driver/ensemble_driver.F90 -# # CMEPS/CMEPS/cesm/driver/esm_time_mod.F90 -# # ) -# # target_link_libraries(OM3_cesm_driver_${CONF} -# # PUBLIC esmf -# # PRIVATE ${ComponentsTargets} AccessOM3::cdeps_drof AccessOM3::cdeps_datm AccessOM3::cmeps AccessOM3::nuopc_cap_share AccessOM3::share AccessOM3::timing -# # ) -# # target_compile_definitions(OM3_cesm_driver_${CONF} PRIVATE MED_PRESENT -# # ATM_PRESENT -# # ICE_PRESENT -# # OCN_PRESENT -# # WAV_PRESENT -# # ROF_PRESENT -# # $<$:DEBUG> -# # ) - -# # add_executable(OM3_${CONF} CMEPS/CMEPS/cesm/driver/esmApp.F90) -# # target_link_libraries(OM3_${CONF} PRIVATE OM3_cesm_driver_${CONF} AccessOM3::share esmf) - -# set_target_properties(OM3_${CONF} PROPERTIES -# LINKER_LANGUAGE Fortran -# OUTPUT_NAME access-om3-${CONF} -# ) -# endforeach() +if(ACCESS3_LIB_INSTALL) + # Some code shared by several components + add_subdirectory(share) + + # Data component (CDEPS) + add_subdirectory(CDEPS) + + # Mediator component (CMEPS) + add_subdirectory(CMEPS) +endif() + +if (OM3_BIN_INSTALL) + # Add executable for each enabled configuration + foreach(CONF IN LISTS KnownConfigurations) + if(NOT OM3_ENABLE_${CONF}) + continue() + endif() + + set(ComponentsTargets "") + if(OM3_${CONF} MATCHES MOM6) + list(APPEND ComponentsTargets AccessMom6::mom6-cmeps) + else() + list(APPEND ComponentsTargets Access3Share::cdeps-docn) + endif() + if(OM3_${CONF} MATCHES CICE6) + list(APPEND ComponentsTargets AccessCiceCmeps::cice-cmeps) + else() + list(APPEND ComponentsTargets Access3Share::cdeps-dice) + endif() + if(OM3_${CONF} MATCHES WW3) + list(APPEND ComponentsTargets AccessWw3::ww3-cmeps) + else() + list(APPEND ComponentsTargets Access3Share::cdeps-dwav) + endif() + + # We use the CESM driver from CMEPS + add_fortran_library(OM3_cesm_driver_${CONF} mod/OM3_cesm_driver_${CONF} STATIC + CMEPS/CMEPS/cesm/driver/esm.F90 + CMEPS/CMEPS/cesm/driver/ensemble_driver.F90 + CMEPS/CMEPS/cesm/driver/esm_time_mod.F90 + ) + target_link_libraries(OM3_cesm_driver_${CONF} + PUBLIC esmf + PRIVATE ${ComponentsTargets} Access3Share::cdeps-drof Access3Share::cdeps-datm Access3Share::cmeps Access3Share::nuopc_cap_share Access3Share::share Access3Share::timing + ) + target_compile_definitions(OM3_cesm_driver_${CONF} PRIVATE MED_PRESENT + ATM_PRESENT + ICE_PRESENT + OCN_PRESENT + WAV_PRESENT + ROF_PRESENT + $<$:DEBUG> + ) + + add_executable(OM3_${CONF} CMEPS/CMEPS/cesm/driver/esmApp.F90) + target_link_libraries(OM3_${CONF} PRIVATE OM3_cesm_driver_${CONF} Access3Share::share esmf) + + set_target_properties(OM3_${CONF} PROPERTIES + LINKER_LANGUAGE Fortran + OUTPUT_NAME access-om3-${CONF} + ) + endforeach() +endif() #[==============================================================================[ # Install or Export # @@ -229,20 +229,20 @@ add_subdirectory(CMEPS) # Note that the installation of some components is done in the corresponding subdirectory # OM3 executables -# if(OM3_BIN_INSTALL) -# foreach(CONF IN LISTS KnownConfigurations) -# if(NOT OM3_ENABLE_${CONF}) -# continue() -# endif() - -# install(TARGETS OM3_${CONF} -# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -# ) -# endforeach() -# endif() +if(OM3_BIN_INSTALL) + foreach(CONF IN LISTS KnownConfigurations) + if(NOT OM3_ENABLE_${CONF}) + continue() + endif() + + install(TARGETS OM3_${CONF} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) + endforeach() +endif() # # Libraries -if(OM3_LIB_INSTALL) +if(ACCESS3_LIB_INSTALL) configure_package_config_file( cmake/Access3ShareConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/Access3ShareConfig.cmake diff --git a/cmake/Access3ShareConfig.cmake.in b/cmake/Access3ShareConfig.cmake.in old mode 100644 new mode 100755 index 37aaab1..10d79f7 --- a/cmake/Access3ShareConfig.cmake.in +++ b/cmake/Access3ShareConfig.cmake.in @@ -1,68 +1,50 @@ @PACKAGE_INIT@ -if(NOT AccessOM3_FIND_QUIETLY) +if(NOT Access3Share_FIND_QUIETLY) message(STATUS "Found Access3Share: ${PACKAGE_PREFIX_DIR}") endif() # Available components # The following components are always available (order is important!) -set(_supported_components timing share nuopc_cap_share cmeps cdeps) #mom6 cice ww3) +set(_supported_components timing share nuopc_cap_share cmeps cdeps) # Check validity of requested components -foreach(_comp ${AccessOM3_FIND_COMPONENTS}) +foreach(_comp ${Access3Share_FIND_COMPONENTS}) if (NOT _comp IN_LIST _supported_components) set(Access3Share_FOUND False) set(Access3Share_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}") endif() endforeach() -# Some components are only available if they were built -if ((mom6 IN_LIST ${AccessOM3_FIND_COMPONENTS}) AND (NOT @OM3_BUILD_MOM6@)) - set(Access3Share_FOUND False) - set(Access3Share_NOT_FOUND_MESSAGE "The following component is not available: mom6") -endif() -if ((cice IN_LIST ${AccessOM3_FIND_COMPONENTS}) AND (NOT @OM3_BUILD_CICE6@)) - set(Access3Share_FOUND False) - set(Access3Share_NOT_FOUND_MESSAGE "The following component is not available: cice") -endif() -if ((ww3 IN_LIST ${AccessOM3_FIND_COMPONENTS}) AND (NOT @OM3_BUILD_WW3@)) - set(Access3Share_FOUND False) - set(Access3Share_NOT_FOUND_MESSAGE "The following component is not available: ww3") -endif() - # Build a list of all the required components, taking into account their dependencies set(_required_components ${Access3Share_FIND_COMPONENTS}) -if(cice IN_LIST _required_components) - list(APPEND _required_components cdeps nuopc_cap_share share timing) -endif() -if(mom6 IN_LIST _required_components) - list(APPEND _required_components nuopc_cap_share share) -endif() -#if(cdeps IN_LIST _required_components) +if(cdeps IN_LIST _required_components) list(APPEND _required_components cmeps share nuopc_cap_share) -#endif() -#if(cmeps IN_LIST _required_components) +endif() +if(cmeps IN_LIST _required_components) list(APPEND _required_components nuopc_cap_share share timing) -#endif() -#if(nuopc_cap_share IN_LIST _required_components) +endif() +if(nuopc_cap_share IN_LIST _required_components) list(APPEND _required_components share timing) -#endif() -#if(share IN_LIST _required_components) +endif() +if(share IN_LIST _required_components) list(APPEND _required_components timing) -#endif() +endif() + list(REMOVE_DUPLICATES _required_components) -if(NOT AccessOM3_FIND_QUIETLY) - message(STATUS " - AccessOM3 Components: ${_required_components}") + +if(NOT Access3Share_FIND_QUIETLY) + message(STATUS " - Access3Share Components: ${_required_components}") endif() # Include required targets. We do this by looping over the _supported_components # list because the order in which targets are loaded matters. foreach(_comp ${_supported_components}) #if (_comp IN_LIST _required_components) - message(STATUS " - Including AccessOM3 Components: ${_comp}") - include("${CMAKE_CURRENT_LIST_DIR}/AccessOM3${_comp}Targets.cmake") + message(STATUS " - Including Access3Share Components: ${_comp}") + include("${CMAKE_CURRENT_LIST_DIR}/Access3Share${_comp}Targets.cmake") #endif() endforeach() @@ -71,12 +53,14 @@ include(CMakeFindDependencyMacro) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) -if (cdeps IN_LIST _required_components) +#if (cdeps IN_LIST _required_components) find_dependency(FoX) -endif() -if (mom6 IN_LIST _required_components) - find_dependency(fms COMPONENTS R8 REQUIRED) -endif() +#endif() + +#MOVE / CHECK in MOM6 package +#if (mom6 IN_LIST _required_components) +# find_dependency(fms COMPONENTS R8 REQUIRED) +#endif() list(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt old mode 100644 new mode 100755 index a58a21c..a04a115 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -1,19 +1,19 @@ ### Targets ## share library -add_fortran_library(OM3_share mod/share STATIC) -add_library(AccessOM3::share ALIAS OM3_share) -target_include_directories(OM3_share PUBLIC "$") +add_fortran_library(share mod/share STATIC) +add_library(Access3Share::share ALIAS share) +target_include_directories(share PUBLIC "$") if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") - target_compile_definitions(OM3_share PRIVATE CPRGNU NAMING=_ADD_UNDERSCORE FORTRANUNDERSCORE) + target_compile_definitions(share PRIVATE CPRGNU NAMING=_ADD_UNDERSCORE FORTRANUNDERSCORE) elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") - target_compile_definitions(OM3_share PRIVATE CPRINTEL NAMING=_ADD_UNDERSCORE FORTRANUNDERSCORE) + target_compile_definitions(share PRIVATE CPRINTEL NAMING=_ADD_UNDERSCORE FORTRANUNDERSCORE) endif() -target_link_libraries(OM3_share +target_link_libraries(share PUBLIC esmf PIO::PIO_Fortran - PRIVATE AccessOM3::timing + PRIVATE Access3Share::timing ) -target_sources(OM3_share PRIVATE +target_sources(share PRIVATE # The following files are generated with a script acting on templates # We include pre-generated files that are committed to the repository src/shr_assert_mod.F90 @@ -46,23 +46,23 @@ target_sources(OM3_share PRIVATE # The following file is a stub. stubs/mct_mod.F90 ) -add_patched_source(OM3_share CESM_share/src/shr_const_mod.F90) +add_patched_source(share CESM_share/src/shr_const_mod.F90) if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") # CESM reduces the precision and increases speed for the following file set_source_files_properties(CESM_share/src/shr_wv_sat_mod.F90 PROPERTIES COMPILE_FLAGS "-fimf-precision=low -fp-model fast") endif() ## GPTL timing library -add_fortran_library(OM3_timing mod/timing STATIC) -add_library(AccessOM3::timing ALIAS OM3_timing) -target_compile_definitions(OM3_timing PRIVATE NUOPC_INTERFACE HAVE_MPI) +add_fortran_library(ACCESS3_timing mod/timing STATIC) +add_library(Access3Share::timing ALIAS ACCESS3_timing) +target_compile_definitions(ACCESS3_timing PRIVATE NUOPC_INTERFACE HAVE_MPI) if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") - target_compile_definitions(OM3_timing PRIVATE CPRGNU NAMING=_ADD_UNDERSCORE FORTRANUNDERSCORE) + target_compile_definitions(ACCESS3_timing PRIVATE CPRGNU NAMING=_ADD_UNDERSCORE FORTRANUNDERSCORE) elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") - target_compile_definitions(OM3_timing PRIVATE CPRINTEL NAMING=_ADD_UNDERSCORE FORTRANUNDERSCORE) + target_compile_definitions(ACCESS3_timing PRIVATE CPRINTEL NAMING=_ADD_UNDERSCORE FORTRANUNDERSCORE) endif() -target_link_libraries(OM3_timing PRIVATE esmf) -target_sources(OM3_timing PRIVATE +target_link_libraries(ACCESS3_timing PRIVATE esmf) +target_sources(ACCESS3_timing PRIVATE timing/f_wrappers.c timing/gptl.c timing/GPTLget_memusage.c @@ -77,52 +77,52 @@ target_sources(OM3_timing PRIVATE ### Install and Export -if(OM3_LIB_INSTALL) +if(ACCESS3_LIB_INSTALL) ## share library - set_target_properties(OM3_share PROPERTIES + set_target_properties(share PROPERTIES OUTPUT_NAME access-share EXPORT_NAME share ) - install(TARGETS OM3_share - EXPORT AccessOM3share_Targets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT AccessOM3_RunTime NAMELINK_COMPONENT AccessOM3_Development - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT AccessOM3_Development + install(TARGETS share + EXPORT Access3Shareshare_Targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_RunTime NAMELINK_COMPONENT Access3Share_Development + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_Development ) # Fortran module files are a special case, as currently there is no standard # way of handling them in CMake - target_include_directories(OM3_share PUBLIC "$") - get_target_property(share_moddir OM3_share Fortran_MODULE_DIRECTORY) + target_include_directories(share PUBLIC "$") + get_target_property(share_moddir share Fortran_MODULE_DIRECTORY) install(DIRECTORY ${share_moddir}/ DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-share - COMPONENT AccessOM3_Development + COMPONENT Access3Share_Development ) - install(EXPORT AccessOM3share_Targets - FILE AccessOM3shareTargets.cmake - NAMESPACE AccessOM3:: + install(EXPORT Access3Shareshare_Targets + FILE Access3ShareshareTargets.cmake + NAMESPACE Access3Share:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share ) ## timing library - set_target_properties(OM3_timing PROPERTIES + set_target_properties(ACCESS3_timing PROPERTIES OUTPUT_NAME access-timing EXPORT_NAME timing ) - install(TARGETS OM3_timing - EXPORT AccessOM3timing_Targets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT AccessOM3_RunTime NAMELINK_COMPONENT AccessOM3_Development - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT AccessOM3_Development + install(TARGETS ACCESS3_timing + EXPORT Access3Sharetiming_Targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_RunTime NAMELINK_COMPONENT Access3Share_Development + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_Development ) # Fortran module files are a special case, as currently there is no standard # way of handling them in CMake - target_include_directories(OM3_timing PUBLIC "$") - get_target_property(timing_moddir OM3_timing Fortran_MODULE_DIRECTORY) + target_include_directories(ACCESS3_timing PUBLIC "$") + get_target_property(timing_moddir ACCESS3_timing Fortran_MODULE_DIRECTORY) install(DIRECTORY ${timing_moddir}/ DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-timing - COMPONENT AccessOM3_Development + COMPONENT Access3Share_Development ) - install(EXPORT AccessOM3timing_Targets - FILE AccessOM3timingTargets.cmake - NAMESPACE AccessOM3:: + install(EXPORT Access3Sharetiming_Targets + FILE Access3SharetimingTargets.cmake + NAMESPACE Access3Share:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share ) endif() From 5735271987c5193b66588938db2b23ff612dd915 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Mon, 13 Jan 2025 15:42:47 +1100 Subject: [PATCH 04/31] minor tidy --- .github/workflows/compilation.yml | 2 +- .../patches/med_phases_history_mod.F90.patch | 0 CMakeLists.txt | 24 ++++++++++++------- cmake/Access3ShareConfig.cmake.in | 4 ++-- 4 files changed, 18 insertions(+), 12 deletions(-) mode change 100755 => 100644 CMEPS/patches/med_phases_history_mod.F90.patch diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index c17b188..2171fb9 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -26,7 +26,7 @@ jobs: env: FC: mpifort CC: mpicc - run: . /etc/profile && cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_VERBOSE_MAKEFILE=ON + run: . /etc/profile && cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_VERBOSE_MAKEFILE=ON -DACCESS3_LIB_INSTALL=TRUE - name: Build # Build your program with the given configuration diff --git a/CMEPS/patches/med_phases_history_mod.F90.patch b/CMEPS/patches/med_phases_history_mod.F90.patch old mode 100755 new mode 100644 diff --git a/CMakeLists.txt b/CMakeLists.txt index baa553c..c6bcf50 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ list(APPEND KnownConfigurations MOM6 CICE6 WW3 MOM6-CICE6 CICE6-WW3 MOM6-WW3 MOM # Build options option(OM3_BIN_INSTALL "Install ACCESS-OM3 executables" ON) option(ACCESS3_LIB_INSTALL "Install ACCESS-OM3 libraries" OFF) -option(ACCESS3_OPENMP "Enable OpenMP threading" OFF) +option(OPENMP "Enable OpenMP threading" OFF) # option(ACCESS3_MOM_SYMMETRIC "Use symmetric memory" OFF) #move to MOM6 if(ACCESS3_LIB_INSTALL) @@ -31,7 +31,7 @@ endif() message(STATUS "Build options") message(STATUS " - OM3_BIN_INSTALL ${OM3_BIN_INSTALL}") message(STATUS " - ACCESS3_LIB_INSTALL ${ACCESS3_LIB_INSTALL}") -message(STATUS " - ACCESS3_OPENMP ${ACCESS3_OPENMP}") +message(STATUS " - OPENMP ${ACCESS3_OPENMP}") # message(STATUS " - ACCESS3_MOM_SYMMETRIC ${ACCESS3_MOM_SYMMETRIC}") if (OM3_BIN_INSTALL) @@ -87,7 +87,6 @@ if (OM3_BIN_INSTALL) else() set(OM3_ENABLE_WW3 OFF) endif() - endif() # Common compiler flags and definitions @@ -134,11 +133,12 @@ set(CMAKE_INSTALL_MODULEDIR ${CMAKE_INSTALL_INCLUDEDIR} # Find dependencies find_package(MPI REQUIRED) -find_package(ESMF 8.3.0 MODULE REQUIRED) -if(ACCESS3_OPENMP) +if(OPENMP) find_package(OpenMP REQUIRED) endif() +find_package(ESMF 8.3.0 MODULE REQUIRED) + if (ACCESS3_LIB_INSTALL) find_package(FoX 4.1.2 REQUIRED) find_package(PIO 2.5.3 REQUIRED COMPONENTS C Fortran) @@ -146,12 +146,18 @@ if (ACCESS3_LIB_INSTALL) endif() if (OM3_BIN_INSTALL) - find_package(Access3Share REQUIRED cdeps cmeps nuopc_cap_share share timing) #should this list components which are required? + find_package(Access3Share REQUIRED cdeps cmeps nuopc_cap_share share timing) if(OM3_ENABLE_CICE6) - # find_package(Access3Share REQUIRED cdeps-docn) find_package(AccessCiceCmeps REQUIRED) endif() + if(OM3_ENABLE_MOM6) + find_package(AccessMom6Cmeps REQUIRED) + endif() + if(OM3_ENABLE_WW3) + find_package(AccessWW3Cmeps REQUIRED) + endif() endif() + #[==============================================================================[ # Main definitions # #]==============================================================================] @@ -191,7 +197,7 @@ if (OM3_BIN_INSTALL) list(APPEND ComponentsTargets Access3Share::cdeps-dwav) endif() - # We use the CESM driver from CMEPS + # We use the CESM driver from CMEPS add_fortran_library(OM3_cesm_driver_${CONF} mod/OM3_cesm_driver_${CONF} STATIC CMEPS/CMEPS/cesm/driver/esm.F90 CMEPS/CMEPS/cesm/driver/ensemble_driver.F90 @@ -252,4 +258,4 @@ if(ACCESS3_LIB_INSTALL) DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share COMPONENT Access3Share ) -endif() +endif() \ No newline at end of file diff --git a/cmake/Access3ShareConfig.cmake.in b/cmake/Access3ShareConfig.cmake.in index 10d79f7..1ac3821 100755 --- a/cmake/Access3ShareConfig.cmake.in +++ b/cmake/Access3ShareConfig.cmake.in @@ -53,9 +53,9 @@ include(CMakeFindDependencyMacro) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) -#if (cdeps IN_LIST _required_components) +if (cdeps IN_LIST _required_components) find_dependency(FoX) -#endif() +endif() #MOVE / CHECK in MOM6 package #if (mom6 IN_LIST _required_components) From 835a8f52b0e7f577b9159b6795bb7cb944063b48 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Tue, 14 Jan 2025 13:12:00 +1100 Subject: [PATCH 05/31] tweaks --- .github/ISSUE_TEMPLATE/parameter-testing.yml | 41 -------------------- CMakeLists.txt | 4 +- 2 files changed, 2 insertions(+), 43 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/parameter-testing.yml diff --git a/.github/ISSUE_TEMPLATE/parameter-testing.yml b/.github/ISSUE_TEMPLATE/parameter-testing.yml deleted file mode 100644 index afdd3bc..0000000 --- a/.github/ISSUE_TEMPLATE/parameter-testing.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Parameter Testing -description: Template for tracking parameter testing issues -title: "[Parameter Testing] " -labels: "Parameter-testing" -assignees: [optional-assignee] -body: - - type: markdown - attributes: - value: | - Please fill out the sections below to clearly and concisely describe: - 1. the parameter(s) tested, - 2. the exact version of the test tool (Expts_manager) used. - - - type: textarea - attributes: - label: Parameter Tests Description - placeholder: "including a short description and Parameter Name(s): Value(s) Tested" - validations: - required: true - - - type: input - attributes: - label: Expts_manager Version - placeholder: Git URL including commit hash - validations: - required: true - - - type: textarea - attributes: - label: YAML input file - placeholder: | - ```yaml - Copy the yaml input file used - ``` - validations: - required: true - - - type: textarea - attributes: - label: Additional Information - placeholder: Any other relevant information... diff --git a/CMakeLists.txt b/CMakeLists.txt index c6bcf50..ce04a2e 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,7 +148,7 @@ endif() if (OM3_BIN_INSTALL) find_package(Access3Share REQUIRED cdeps cmeps nuopc_cap_share share timing) if(OM3_ENABLE_CICE6) - find_package(AccessCiceCmeps REQUIRED) + find_package(Cicelib REQUIRED COMPONENTS AccessCiceCmeps IO_PIO) endif() if(OM3_ENABLE_MOM6) find_package(AccessMom6Cmeps REQUIRED) @@ -187,7 +187,7 @@ if (OM3_BIN_INSTALL) list(APPEND ComponentsTargets Access3Share::cdeps-docn) endif() if(OM3_${CONF} MATCHES CICE6) - list(APPEND ComponentsTargets AccessCiceCmeps::cice-cmeps) + list(APPEND ComponentsTargets Cicelib::cicelib) else() list(APPEND ComponentsTargets Access3Share::cdeps-dice) endif() From 35195b6b8aa8fb6422d77412b758439a2cbe0944 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Tue, 14 Jan 2025 14:42:09 +1100 Subject: [PATCH 06/31] Comments --- CMakeLists.txt | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ce04a2e..b2ef2c8 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,7 @@ +# This CMakeLists file has two options: +# ACCESS3_LIB_INSTALL, to build shared libraries for CMEPS/CDEPS etc +# OM3_BIN_INSTALL, to build ACCESS-OM3 using CMEPS code and linked to model components (built elsewhere) + cmake_minimum_required(VERSION 3.18) # CMake version compatibility @@ -6,7 +10,7 @@ cmake_minimum_required(VERSION 3.18) #]==============================================================================] project(Access3Share VERSION "0.3.1" - HOMEPAGE_URL https://github.com/access-nri/access-om3 + HOMEPAGE_URL https://github.com/access-nri/access3-share DESCRIPTION "Global coupled ocean - sea ice - wave model" LANGUAGES C Fortran) @@ -21,7 +25,7 @@ list(APPEND KnownConfigurations MOM6 CICE6 WW3 MOM6-CICE6 CICE6-WW3 MOM6-WW3 MOM # Build options option(OM3_BIN_INSTALL "Install ACCESS-OM3 executables" ON) option(ACCESS3_LIB_INSTALL "Install ACCESS-OM3 libraries" OFF) -option(OPENMP "Enable OpenMP threading" OFF) +# option(OPENMP "Enable OpenMP threading" OFF) # option(ACCESS3_MOM_SYMMETRIC "Use symmetric memory" OFF) #move to MOM6 if(ACCESS3_LIB_INSTALL) @@ -31,8 +35,8 @@ endif() message(STATUS "Build options") message(STATUS " - OM3_BIN_INSTALL ${OM3_BIN_INSTALL}") message(STATUS " - ACCESS3_LIB_INSTALL ${ACCESS3_LIB_INSTALL}") -message(STATUS " - OPENMP ${ACCESS3_OPENMP}") -# message(STATUS " - ACCESS3_MOM_SYMMETRIC ${ACCESS3_MOM_SYMMETRIC}") +# message(STATUS " - OPENMP ${ACCESS3_OPENMP}") +# message(STATUS " - ACCESS3_MOM_SYMMETRIC ${ACCESS3_MOM_SYMMETRIC}") #move to MOM6 if (OM3_BIN_INSTALL) @@ -133,9 +137,9 @@ set(CMAKE_INSTALL_MODULEDIR ${CMAKE_INSTALL_INCLUDEDIR} # Find dependencies find_package(MPI REQUIRED) -if(OPENMP) - find_package(OpenMP REQUIRED) -endif() +# if(OPENMP) +# find_package(OpenMP REQUIRED) +# endif() find_package(ESMF 8.3.0 MODULE REQUIRED) @@ -148,7 +152,8 @@ endif() if (OM3_BIN_INSTALL) find_package(Access3Share REQUIRED cdeps cmeps nuopc_cap_share share timing) if(OM3_ENABLE_CICE6) - find_package(Cicelib REQUIRED COMPONENTS AccessCiceCmeps IO_PIO) + #TO-DO remove hardcoded IO_PIO ? + find_package(Cicelib REQUIRED COMPONENTS IO_PIO) endif() if(OM3_ENABLE_MOM6) find_package(AccessMom6Cmeps REQUIRED) @@ -232,8 +237,6 @@ endif() ## Installs -# Note that the installation of some components is done in the corresponding subdirectory - # OM3 executables if(OM3_BIN_INSTALL) foreach(CONF IN LISTS KnownConfigurations) @@ -249,6 +252,8 @@ endif() # # Libraries if(ACCESS3_LIB_INSTALL) +# Note that the installation of some components is done in the corresponding subdirectory + configure_package_config_file( cmake/Access3ShareConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/Access3ShareConfig.cmake From 5591c9c094c808027f03480196aa0583dbea43f5 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Tue, 14 Jan 2025 15:24:53 +1100 Subject: [PATCH 07/31] No default configuration, set this in spack instead --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b2ef2c8..b1fe2de 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,9 +44,9 @@ if (OM3_BIN_INSTALL) option(OM3_ENABLE_CICE6 "Build CICE6 configuration" OFF) option(OM3_ENABLE_WW3 "Build WW3 configuration" OFF) option(OM3_ENABLE_MOM6-WW3 "Build MOM6-WW3 configuration" OFF) - option(OM3_ENABLE_MOM6-CICE6 "Build MOM6-CICE6 configuration" ON) - option(OM3_ENABLE_CICE6-WW3 "Build CICE6-WW3 configuration" ON) - option(OM3_ENABLE_MOM6-CICE6-WW3 "Build MOM6-CICE6-WW3 configuration" ON) + option(OM3_ENABLE_MOM6-CICE6 "Build MOM6-CICE6 configuration" OFF) + option(OM3_ENABLE_CICE6-WW3 "Build CICE6-WW3 configuration" OFF) + option(OM3_ENABLE_MOM6-CICE6-WW3 "Build MOM6-CICE6-WW3 configuration" OFF) message(STATUS "Configurations") message(STATUS " - MOM6 ${OM3_ENABLE_MOM6}") @@ -91,6 +91,10 @@ if (OM3_BIN_INSTALL) else() set(OM3_ENABLE_WW3 OFF) endif() + if(NOT (OM3_ENABLE_MOM6 OR OM3_ENABLE_CICE6 OR OM3_ENABLE_WW3)) + message (FATAL_ERROR "No model components have been requested, atleast one OM3_ENABLE_ configuration must be set") + endif() + endif() # Common compiler flags and definitions From c023c28c6ae9aaa51025083a737dcc972e58f979 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Fri, 17 Jan 2025 15:08:14 +1100 Subject: [PATCH 08/31] tweak Namespace and variable names --- CDEPS/CMakeLists.txt | 31 ++++---- CMEPS/CMakeLists.txt | 12 +-- CMakeLists.txt | 181 ++++--------------------------------------- share/CMakeLists.txt | 10 +-- 4 files changed, 37 insertions(+), 197 deletions(-) diff --git a/CDEPS/CMakeLists.txt b/CDEPS/CMakeLists.txt index 988750c..0299fe7 100755 --- a/CDEPS/CMakeLists.txt +++ b/CDEPS/CMakeLists.txt @@ -2,11 +2,11 @@ ## Common library add_fortran_library(ACCESS3_cdeps_common mod/common STATIC) -add_library(Access3Share::cdeps_common ALIAS ACCESS3_cdeps_common) +add_library(Access3::cdeps_common ALIAS ACCESS3_cdeps_common) target_include_directories(ACCESS3_cdeps_common PRIVATE $) target_link_libraries(ACCESS3_cdeps_common PUBLIC esmf - PRIVATE Access3Share::share Access3Share::cmeps Access3Share::nuopc_cap_share FoX::FoX PIO::PIO_Fortran + PRIVATE Access3::share Access3::cmeps Access3::nuopc_cap_share FoX::FoX PIO::PIO_Fortran ) target_sources(ACCESS3_cdeps_common PRIVATE CDEPS/streams/dshr_methods_mod.F90 @@ -21,11 +21,11 @@ target_sources(ACCESS3_cdeps_common PRIVATE ## DATM add_fortran_library(ACCESS3_cdeps_datm mod/datm STATIC) -add_library(Access3Share::cdeps_datm ALIAS ACCESS3_cdeps_datm) +add_library(Access3::cdeps_datm ALIAS ACCESS3_cdeps_datm) target_include_directories(ACCESS3_cdeps_datm PRIVATE $) target_link_libraries(ACCESS3_cdeps_datm PUBLIC esmf - PRIVATE Access3Share::cdeps_common Access3Share::share + PRIVATE Access3::cdeps_common Access3::share ) target_sources(ACCESS3_cdeps_datm PRIVATE CDEPS/datm/datm_datamode_cfsr_mod.F90 @@ -42,11 +42,11 @@ add_patched_source(ACCESS3_cdeps_datm CDEPS/datm/atm_comp_nuopc.F90) ## DOCN add_fortran_library(ACCESS3_cdeps_docn mod/docn STATIC) -add_library(Access3Share::cdeps_docn ALIAS ACCESS3_cdeps_docn) +add_library(Access3::cdeps_docn ALIAS ACCESS3_cdeps_docn) target_include_directories(ACCESS3_cdeps_docn PRIVATE $) target_link_libraries(ACCESS3_cdeps_docn PUBLIC esmf - PRIVATE Access3Share::cdeps_common Access3Share::share + PRIVATE Access3::cdeps_common Access3::share ) target_sources(ACCESS3_cdeps_docn PRIVATE CDEPS/docn/docn_datamode_aquaplanet_mod.F90 @@ -60,11 +60,11 @@ target_sources(ACCESS3_cdeps_docn PRIVATE ## DICE add_fortran_library(ACCESS3_cdeps_dice mod/dice STATIC) -add_library(Access3Share::cdeps_dice ALIAS ACCESS3_cdeps_dice) +add_library(Access3::cdeps_dice ALIAS ACCESS3_cdeps_dice) target_include_directories(ACCESS3_cdeps_dice PRIVATE $) target_link_libraries(ACCESS3_cdeps_dice PUBLIC esmf - PRIVATE Access3Share::cdeps_common Access3Share::share + PRIVATE Access3::cdeps_common Access3::share ) target_sources(ACCESS3_cdeps_dice PRIVATE CDEPS/dice/dice_datamode_ssmi_mod.F90 @@ -74,11 +74,11 @@ target_sources(ACCESS3_cdeps_dice PRIVATE ## DWAV add_fortran_library(ACCESS3_cdeps_dwav mod/dwav STATIC) -add_library(Access3Share::cdeps_dwav ALIAS ACCESS3_cdeps_dwav) +add_library(Access3::cdeps_dwav ALIAS ACCESS3_cdeps_dwav) target_include_directories(ACCESS3_cdeps_dwav PRIVATE $) target_link_libraries(ACCESS3_cdeps_dwav PUBLIC esmf - PRIVATE Access3Share::cdeps_common Access3Share::share + PRIVATE Access3::cdeps_common Access3::share ) target_sources(ACCESS3_cdeps_dwav PRIVATE CDEPS/dwav/wav_comp_nuopc.F90 @@ -86,11 +86,11 @@ target_sources(ACCESS3_cdeps_dwav PRIVATE ## DROF add_fortran_library(ACCESS3_cdeps_drof mod/drof STATIC) -add_library(Access3Share::cdeps_drof ALIAS ACCESS3_cdeps_drof) +add_library(Access3::cdeps_drof ALIAS ACCESS3_cdeps_drof) target_include_directories(ACCESS3_cdeps_drof PRIVATE $) target_link_libraries(ACCESS3_cdeps_drof PUBLIC esmf - PRIVATE Access3Share::cdeps_common Access3Share::share + PRIVATE Access3::cdeps_common Access3::share ) target_sources(ACCESS3_cdeps_drof PRIVATE CDEPS/drof/rof_comp_nuopc.F90 @@ -145,15 +145,10 @@ if(ACCESS3_LIB_INSTALL) DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-cdeps-d${LIB} COMPONENT Access3Share_Development ) - # install(EXPORT ACCESS3_cdeps_d${LIB} - # FILE ACCESS3Sharecdeps_d${LIB}.cmake - # NAMESPACE Access3Share:: - # DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share - # ) endforeach() install(EXPORT Access3Sharecdeps_Targets FILE Access3SharecdepsTargets.cmake - NAMESPACE Access3Share:: + NAMESPACE Access3:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share ) endif() diff --git a/CMEPS/CMakeLists.txt b/CMEPS/CMakeLists.txt index fcc0212..4995521 100755 --- a/CMEPS/CMakeLists.txt +++ b/CMEPS/CMakeLists.txt @@ -2,10 +2,10 @@ ## CMEPS library add_fortran_library(ACCESS3_cmeps mod/cmeps STATIC) -add_library(Access3Share::cmeps ALIAS ACCESS3_cmeps) +add_library(Access3::cmeps ALIAS ACCESS3_cmeps) target_link_libraries(ACCESS3_cmeps PUBLIC esmf - PRIVATE Access3Share::nuopc_cap_share Access3Share::share Access3Share::timing + PRIVATE Access3::nuopc_cap_share Access3::share Access3::timing ) if(OpenMP_Fortran_FOUND) target_link_libraries(ACCESS3_cmeps PRIVATE OpenMP::OpenMP_Fortran) @@ -52,10 +52,10 @@ add_patched_source(ACCESS3_cmeps CMEPS/mediator/med_phases_history_mod.F90) ## NUOPC cap share add_fortran_library(ACCESS3_nuopc_cap_share mod/nuopc_cap_share STATIC) -add_library(Access3Share::nuopc_cap_share ALIAS ACCESS3_nuopc_cap_share) +add_library(Access3::nuopc_cap_share ALIAS ACCESS3_nuopc_cap_share) target_link_libraries(ACCESS3_nuopc_cap_share PUBLIC esmf - PRIVATE Access3Share::share + PRIVATE Access3::share ) target_sources(ACCESS3_nuopc_cap_share PRIVATE CMEPS/cesm/nuopc_cap_share/driver_pio_mod.F90 @@ -88,7 +88,7 @@ if(ACCESS3_LIB_INSTALL) ) install(EXPORT Access3Sharecmeps_Targets FILE Access3SharecmepsTargets.cmake - NAMESPACE Access3Share:: + NAMESPACE Access3:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share ) @@ -112,7 +112,7 @@ if(ACCESS3_LIB_INSTALL) ) install(EXPORT Access3Sharenuopc_cap_share_Targets FILE Access3Sharenuopc_cap_shareTargets.cmake - NAMESPACE Access3Share:: + NAMESPACE Access3:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share ) endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index b1fe2de..5313792 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ # This CMakeLists file has two options: -# ACCESS3_LIB_INSTALL, to build shared libraries for CMEPS/CDEPS etc -# OM3_BIN_INSTALL, to build ACCESS-OM3 using CMEPS code and linked to model components (built elsewhere) +# ACCESS3_LIB_INSTALL, to build libraries for the shared components (CMEPS/CDEPS/Share) +# ACCESS3_BIN_INSTALL, to build ACCESS-OM3 using CMEPS code and linked to model components (built elsewhere). +# This can be extended to included CM3 by linking against the UM libraries built with nuopc/cmeps driver. cmake_minimum_required(VERSION 3.18) # CMake version compatibility @@ -18,46 +19,23 @@ project(Access3Share VERSION "0.3.1" # Options # #]==============================================================================] -# Configurations to build -list(APPEND KnownConfigurations MOM6 CICE6 WW3 MOM6-CICE6 CICE6-WW3 MOM6-WW3 MOM6-CICE6-WW3) - - # Build options -option(OM3_BIN_INSTALL "Install ACCESS-OM3 executables" ON) -option(ACCESS3_LIB_INSTALL "Install ACCESS-OM3 libraries" OFF) +option(ACCESS3_BIN_INSTALL "Install ACCESS3 executables" ON) +option(ACCESS3_LIB_INSTALL "Install ACCESS3 libraries" OFF) # option(OPENMP "Enable OpenMP threading" OFF) # option(ACCESS3_MOM_SYMMETRIC "Use symmetric memory" OFF) #move to MOM6 if(ACCESS3_LIB_INSTALL) - set(OM3_BIN_INSTALL OFF) + set(ACCESS3_BIN_INSTALL OFF) endif() message(STATUS "Build options") -message(STATUS " - OM3_BIN_INSTALL ${OM3_BIN_INSTALL}") +message(STATUS " - ACCESS3_BIN_INSTALL ${ACCESS3_BIN_INSTALL}") message(STATUS " - ACCESS3_LIB_INSTALL ${ACCESS3_LIB_INSTALL}") # message(STATUS " - OPENMP ${ACCESS3_OPENMP}") # message(STATUS " - ACCESS3_MOM_SYMMETRIC ${ACCESS3_MOM_SYMMETRIC}") #move to MOM6 -if (OM3_BIN_INSTALL) - - option(OM3_ENABLE_MOM6 "Build MOM6 configuration" OFF) - option(OM3_ENABLE_CICE6 "Build CICE6 configuration" OFF) - option(OM3_ENABLE_WW3 "Build WW3 configuration" OFF) - option(OM3_ENABLE_MOM6-WW3 "Build MOM6-WW3 configuration" OFF) - option(OM3_ENABLE_MOM6-CICE6 "Build MOM6-CICE6 configuration" OFF) - option(OM3_ENABLE_CICE6-WW3 "Build CICE6-WW3 configuration" OFF) - option(OM3_ENABLE_MOM6-CICE6-WW3 "Build MOM6-CICE6-WW3 configuration" OFF) - message(STATUS "Configurations") - message(STATUS " - MOM6 ${OM3_ENABLE_MOM6}") - message(STATUS " - CICE6 ${OM3_ENABLE_CICE6}") - message(STATUS " - WW3 ${OM3_ENABLE_WW3}") - message(STATUS " - MOM6-WW3 ${OM3_ENABLE_MOM6-WW3}") - message(STATUS " - MOM6-CICE6 ${OM3_ENABLE_MOM6-CICE6}") - message(STATUS " - CICE6-WW3 ${OM3_ENABLE_CICE6-WW3}") - message(STATUS " - MOM6-CICE6-WW3 ${OM3_ENABLE_MOM6-CICE6-WW3}") - -endif() #[==============================================================================[ # Project configuration # @@ -65,38 +43,11 @@ endif() list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) include(GNUInstallDirs) -if(ACCESS3_LIB_INSTALL) - include(CMakePackageConfigHelpers) -endif() # Include some custom cmake modules include(FortranLib) include(AddPatchedSource) -## Configure project variables -if (OM3_BIN_INSTALL) - # Do not build components that are not going to be used - if(OM3_ENABLE_MOM6 OR OM3_ENABLE_MOM6-CICE6 OR OM3_ENABLE_MOM6-WW3 OR OM3_ENABLE_MOM6-CICE6-WW3) - set(OM3_ENABLE_MOM6 ON) - else() - set(OM3_ENABLE_MOM6 OFF) - endif() - if(OM3_ENABLE_CICE6 OR OM3_ENABLE_MOM6-CICE6 OR OM3_ENABLE_CICE6-WW3 OR OM3_ENABLE_MOM6-CICE6-WW3) - set(OM3_ENABLE_CICE6 ON) - else() - set(OM3_ENABLE_CICE6 OFF) - endif() - if(OM3_ENABLE_WW3 OR OM3_ENABLE_MOM6-WW3 OR OM3_ENABLE_CICE6-WW3 OR OM3_ENABLE_MOM6-CICE6-WW3) - set(OM3_ENABLE_WW3 ON) - else() - set(OM3_ENABLE_WW3 OFF) - endif() - if(NOT (OM3_ENABLE_MOM6 OR OM3_ENABLE_CICE6 OR OM3_ENABLE_WW3)) - message (FATAL_ERROR "No model components have been requested, atleast one OM3_ENABLE_ configuration must be set") - endif() - -endif() - # Common compiler flags and definitions if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fbacktrace -fconvert=big-endian -ffree-line-length-none -ffixed-line-length-none") @@ -147,124 +98,18 @@ find_package(MPI REQUIRED) find_package(ESMF 8.3.0 MODULE REQUIRED) -if (ACCESS3_LIB_INSTALL) - find_package(FoX 4.1.2 REQUIRED) - find_package(PIO 2.5.3 REQUIRED COMPONENTS C Fortran) - find_package(NetCDF 4.7.3 REQUIRED Fortran) -endif() - -if (OM3_BIN_INSTALL) - find_package(Access3Share REQUIRED cdeps cmeps nuopc_cap_share share timing) - if(OM3_ENABLE_CICE6) - #TO-DO remove hardcoded IO_PIO ? - find_package(Cicelib REQUIRED COMPONENTS IO_PIO) - endif() - if(OM3_ENABLE_MOM6) - find_package(AccessMom6Cmeps REQUIRED) - endif() - if(OM3_ENABLE_WW3) - find_package(AccessWW3Cmeps REQUIRED) - endif() -endif() - -#[==============================================================================[ -# Main definitions # -#]==============================================================================] - -if(ACCESS3_LIB_INSTALL) - # Some code shared by several components - add_subdirectory(share) - - # Data component (CDEPS) - add_subdirectory(CDEPS) - - # Mediator component (CMEPS) - add_subdirectory(CMEPS) -endif() - -if (OM3_BIN_INSTALL) - # Add executable for each enabled configuration - foreach(CONF IN LISTS KnownConfigurations) - if(NOT OM3_ENABLE_${CONF}) - continue() - endif() - - set(ComponentsTargets "") - if(OM3_${CONF} MATCHES MOM6) - list(APPEND ComponentsTargets AccessMom6::mom6-cmeps) - else() - list(APPEND ComponentsTargets Access3Share::cdeps-docn) - endif() - if(OM3_${CONF} MATCHES CICE6) - list(APPEND ComponentsTargets Cicelib::cicelib) - else() - list(APPEND ComponentsTargets Access3Share::cdeps-dice) - endif() - if(OM3_${CONF} MATCHES WW3) - list(APPEND ComponentsTargets AccessWw3::ww3-cmeps) - else() - list(APPEND ComponentsTargets Access3Share::cdeps-dwav) - endif() - - # We use the CESM driver from CMEPS - add_fortran_library(OM3_cesm_driver_${CONF} mod/OM3_cesm_driver_${CONF} STATIC - CMEPS/CMEPS/cesm/driver/esm.F90 - CMEPS/CMEPS/cesm/driver/ensemble_driver.F90 - CMEPS/CMEPS/cesm/driver/esm_time_mod.F90 - ) - target_link_libraries(OM3_cesm_driver_${CONF} - PUBLIC esmf - PRIVATE ${ComponentsTargets} Access3Share::cdeps-drof Access3Share::cdeps-datm Access3Share::cmeps Access3Share::nuopc_cap_share Access3Share::share Access3Share::timing - ) - target_compile_definitions(OM3_cesm_driver_${CONF} PRIVATE MED_PRESENT - ATM_PRESENT - ICE_PRESENT - OCN_PRESENT - WAV_PRESENT - ROF_PRESENT - $<$:DEBUG> - ) - - add_executable(OM3_${CONF} CMEPS/CMEPS/cesm/driver/esmApp.F90) - target_link_libraries(OM3_${CONF} PRIVATE OM3_cesm_driver_${CONF} Access3Share::share esmf) - - set_target_properties(OM3_${CONF} PROPERTIES - LINKER_LANGUAGE Fortran - OUTPUT_NAME access-om3-${CONF} - ) - endforeach() -endif() - #[==============================================================================[ -# Install or Export # +# Build and Install # #]==============================================================================] -## Installs +## Use seperate files for building libraries vs final exectuable # OM3 executables -if(OM3_BIN_INSTALL) - foreach(CONF IN LISTS KnownConfigurations) - if(NOT OM3_ENABLE_${CONF}) - continue() - endif() - - install(TARGETS OM3_${CONF} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ) - endforeach() +if(ACCESS3_BIN_INSTALL) + include(Access3BinInstall) endif() -# # Libraries +# Libraries if(ACCESS3_LIB_INSTALL) -# Note that the installation of some components is done in the corresponding subdirectory - - configure_package_config_file( - cmake/Access3ShareConfig.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/Access3ShareConfig.cmake - INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share - ) - install(FILES ${CMAKE_SOURCE_DIR}/cmake/FindFoX.cmake ${CMAKE_CURRENT_BINARY_DIR}/Access3ShareConfig.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share - COMPONENT Access3Share - ) + include(Access3LibInstall) endif() \ No newline at end of file diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index a04a115..d0c53be 100755 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -2,7 +2,7 @@ ## share library add_fortran_library(share mod/share STATIC) -add_library(Access3Share::share ALIAS share) +add_library(Access3::share ALIAS share) target_include_directories(share PUBLIC "$") if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") target_compile_definitions(share PRIVATE CPRGNU NAMING=_ADD_UNDERSCORE FORTRANUNDERSCORE) @@ -11,7 +11,7 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") endif() target_link_libraries(share PUBLIC esmf PIO::PIO_Fortran - PRIVATE Access3Share::timing + PRIVATE Access3::timing ) target_sources(share PRIVATE # The following files are generated with a script acting on templates @@ -54,7 +54,7 @@ endif() ## GPTL timing library add_fortran_library(ACCESS3_timing mod/timing STATIC) -add_library(Access3Share::timing ALIAS ACCESS3_timing) +add_library(Access3::timing ALIAS ACCESS3_timing) target_compile_definitions(ACCESS3_timing PRIVATE NUOPC_INTERFACE HAVE_MPI) if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") target_compile_definitions(ACCESS3_timing PRIVATE CPRGNU NAMING=_ADD_UNDERSCORE FORTRANUNDERSCORE) @@ -98,7 +98,7 @@ if(ACCESS3_LIB_INSTALL) ) install(EXPORT Access3Shareshare_Targets FILE Access3ShareshareTargets.cmake - NAMESPACE Access3Share:: + NAMESPACE Access3:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share ) @@ -122,7 +122,7 @@ if(ACCESS3_LIB_INSTALL) ) install(EXPORT Access3Sharetiming_Targets FILE Access3SharetimingTargets.cmake - NAMESPACE Access3Share:: + NAMESPACE Access3:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share ) endif() From 1302b5486b08d0ea00f44944be33376c3425e34e Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Mon, 20 Jan 2025 08:42:19 +1100 Subject: [PATCH 09/31] missing files --- cmake/Access3BinInstall.cmake | 122 ++++++++++++++++++++++++++++++++++ cmake/Access3LibInstall.cmake | 32 +++++++++ 2 files changed, 154 insertions(+) create mode 100644 cmake/Access3BinInstall.cmake create mode 100644 cmake/Access3LibInstall.cmake diff --git a/cmake/Access3BinInstall.cmake b/cmake/Access3BinInstall.cmake new file mode 100644 index 0000000..0ce6772 --- /dev/null +++ b/cmake/Access3BinInstall.cmake @@ -0,0 +1,122 @@ +#[==============================================================================[ +# Options # +#]==============================================================================] + +# Configurations to build +# TO-DO add UM +list(APPEND KnownConfigurations MOM6 CICE6 WW3 MOM6-CICE6 CICE6-WW3 MOM6-WW3 MOM6-CICE6-WW3) + +option(ENABLE_MOM6 "Build MOM6 configuration" OFF) +option(ENABLE_CICE6 "Build CICE6 configuration" OFF) +option(ENABLE_WW3 "Build WW3 configuration" OFF) +option(ENABLE_MOM6-WW3 "Build MOM6-WW3 configuration" OFF) +option(ENABLE_MOM6-CICE6 "Build MOM6-CICE6 configuration" OFF) +option(ENABLE_CICE6-WW3 "Build CICE6-WW3 configuration" OFF) +option(ENABLE_MOM6-CICE6-WW3 "Build MOM6-CICE6-WW3 configuration" OFF) + +message(STATUS "Configurations") +message(STATUS " - MOM6 ${ENABLE_MOM6}") +message(STATUS " - CICE6 ${ENABLE_CICE6}") +message(STATUS " - WW3 ${ENABLE_WW3}") +message(STATUS " - MOM6-WW3 ${ENABLE_MOM6-WW3}") +message(STATUS " - MOM6-CICE6 ${ENABLE_MOM6-CICE6}") +message(STATUS " - CICE6-WW3 ${ENABLE_CICE6-WW3}") +message(STATUS " - MOM6-CICE6-WW3 ${ENABLE_MOM6-CICE6-WW3}") + +# Do not build try to include that are not going to be used +if(ENABLE_MOM6 OR ENABLE_MOM6-CICE6 OR ENABLE_MOM6-WW3 OR ENABLE_MOM6-CICE6-WW3) + set(ENABLE_MOM6 ON) +else() + set(ENABLE_MOM6 OFF) +endif() +if(ENABLE_CICE6 OR ENABLE_MOM6-CICE6 OR ENABLE_CICE6-WW3 OR ENABLE_MOM6-CICE6-WW3) + set(ENABLE_CICE6 ON) +else() + set(ENABLE_CICE6 OFF) +endif() +if(ENABLE_WW3 OR ENABLE_MOM6-WW3 OR ENABLE_CICE6-WW3 OR ENABLE_MOM6-CICE6-WW3) + set(ENABLE_WW3 ON) +else() + set(ENABLE_WW3 OFF) +endif() +if(NOT (ENABLE_MOM6 OR ENABLE_CICE6 OR ENABLE_WW3)) + message (FATAL_ERROR "No model components have been requested, atleast one ENABLE_ configuration must be set") +endif() + +# External packages +find_package(Access3Share REQUIRED cdeps cmeps nuopc_cap_share share timing) +if(ENABLE_CICE6) +#TO-DO remove hardcoded IO_PIO ? + find_package(Cicelib REQUIRED COMPONENTS IO_PIO) +endif() +if(ENABLE_MOM6) + find_package(AccessMom6Cmeps REQUIRED) +endif() +if(ENABLE_WW3) + find_package(AccessWW3Cmeps REQUIRED) +endif() + +# Main Definitions + +# Add executable for each enabled configuration +foreach(CONF IN LISTS KnownConfigurations) + if(NOT ENABLE_${CONF}) + continue() + endif() + + set(ComponentsTargets "") + if(OM3_${CONF} MATCHES MOM6) + list(APPEND ComponentsTargets AccessMom6::mom6-cmeps) + else() + list(APPEND ComponentsTargets Access3::cdeps-docn) + endif() + if(OM3_${CONF} MATCHES CICE6) + list(APPEND ComponentsTargets Access3::cicelib) + else() + list(APPEND ComponentsTargets Access3::cdeps-dice) + endif() + if(OM3_${CONF} MATCHES WW3) + list(APPEND ComponentsTargets AccessWw3::ww3-cmeps) + else() + list(APPEND ComponentsTargets Access3::cdeps-dwav) + endif() + + # We use the CESM driver from CMEPS + add_fortran_library(OM3_cesm_driver_${CONF} mod/OM3_cesm_driver_${CONF} STATIC + CMEPS/CMEPS/cesm/driver/esm.F90 + CMEPS/CMEPS/cesm/driver/ensemble_driver.F90 + CMEPS/CMEPS/cesm/driver/esm_time_mod.F90 + ) + target_link_libraries(OM3_cesm_driver_${CONF} + PUBLIC esmf + PRIVATE ${ComponentsTargets} Access3::cdeps-drof Access3::cdeps-datm Access3::cmeps Access3::nuopc_cap_share Access3::share Access3::timing + ) + target_compile_definitions(OM3_cesm_driver_${CONF} PRIVATE MED_PRESENT + ATM_PRESENT + ICE_PRESENT + OCN_PRESENT + WAV_PRESENT + ROF_PRESENT + $<$:DEBUG> + ) + + add_executable(OM3_${CONF} CMEPS/CMEPS/cesm/driver/esmApp.F90) + target_link_libraries(OM3_${CONF} PRIVATE OM3_cesm_driver_${CONF} Access3::share esmf) + + set_target_properties(OM3_${CONF} PROPERTIES + LINKER_LANGUAGE Fortran + OUTPUT_NAME access-om3-${CONF} + ) +endforeach() + +# Install + +foreach(CONF IN LISTS KnownConfigurations) + if(NOT ENABLE_${CONF}) + continue() + endif() + + install(TARGETS OM3_${CONF} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) +endforeach() \ No newline at end of file diff --git a/cmake/Access3LibInstall.cmake b/cmake/Access3LibInstall.cmake new file mode 100644 index 0000000..7a0bb15 --- /dev/null +++ b/cmake/Access3LibInstall.cmake @@ -0,0 +1,32 @@ + +include(CMakePackageConfigHelpers) + +# External packages + +find_package(FoX 4.1.2 REQUIRED) +find_package(PIO 2.5.3 REQUIRED COMPONENTS C Fortran) +find_package(NetCDF 4.7.3 REQUIRED Fortran) + +# Main definitions + +# Some code shared by several components +add_subdirectory(share) + +# Data component (CDEPS) +add_subdirectory(CDEPS) + +# Mediator component (CMEPS) +add_subdirectory(CMEPS) + +# Install/Export +# Note that the installation of some components is done in the corresponding subdirectory + +configure_package_config_file( + cmake/Access3ShareConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/Access3ShareConfig.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share + ) +install(FILES ${CMAKE_SOURCE_DIR}/cmake/FindFoX.cmake ${CMAKE_CURRENT_BINARY_DIR}/Access3ShareConfig.cmake +DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share +COMPONENT Access3Share +) \ No newline at end of file From d7c6fee40301f7a36f64436299318a4200a57575 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Mon, 20 Jan 2025 13:11:43 +1100 Subject: [PATCH 10/31] Simplify mutually exclusive options --- CMakeLists.txt | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5313792..cdda75a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ -# This CMakeLists file has two options: -# ACCESS3_LIB_INSTALL, to build libraries for the shared components (CMEPS/CDEPS/Share) -# ACCESS3_BIN_INSTALL, to build ACCESS-OM3 using CMEPS code and linked to model components (built elsewhere). +# This CMakeLists file has option: +# ACCESS3_LIB_INSTALL: +# If ON, then build libraries for the shared components (CMEPS/CDEPS/Share) +# If OFF, then build ACCESS-OM3 using CMEPS code and linked to model components (built elsewhere). # This can be extended to included CM3 by linking against the UM libraries built with nuopc/cmeps driver. cmake_minimum_required(VERSION 3.18) @@ -20,21 +21,12 @@ project(Access3Share VERSION "0.3.1" #]==============================================================================] # Build options -option(ACCESS3_BIN_INSTALL "Install ACCESS3 executables" ON) option(ACCESS3_LIB_INSTALL "Install ACCESS3 libraries" OFF) # option(OPENMP "Enable OpenMP threading" OFF) -# option(ACCESS3_MOM_SYMMETRIC "Use symmetric memory" OFF) #move to MOM6 - -if(ACCESS3_LIB_INSTALL) - set(ACCESS3_BIN_INSTALL OFF) -endif() message(STATUS "Build options") -message(STATUS " - ACCESS3_BIN_INSTALL ${ACCESS3_BIN_INSTALL}") message(STATUS " - ACCESS3_LIB_INSTALL ${ACCESS3_LIB_INSTALL}") # message(STATUS " - OPENMP ${ACCESS3_OPENMP}") -# message(STATUS " - ACCESS3_MOM_SYMMETRIC ${ACCESS3_MOM_SYMMETRIC}") #move to MOM6 - #[==============================================================================[ @@ -104,12 +96,10 @@ find_package(ESMF 8.3.0 MODULE REQUIRED) ## Use seperate files for building libraries vs final exectuable -# OM3 executables -if(ACCESS3_BIN_INSTALL) - include(Access3BinInstall) -endif() - -# Libraries if(ACCESS3_LIB_INSTALL) + # Libraries include(Access3LibInstall) +else() + # OM3 executables + include(Access3BinInstall) endif() \ No newline at end of file From 21312b5c312c240245a11fc9bbfd01ac5e250194 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Tue, 21 Jan 2025 13:46:52 +1100 Subject: [PATCH 11/31] Remove unneeded _LIB_INSTALL variables --- CDEPS/CMakeLists.txt | 91 +++++++++++++++++++++--------------------- CMEPS/CMakeLists.txt | 94 ++++++++++++++++++++++---------------------- share/CMakeLists.txt | 94 ++++++++++++++++++++++---------------------- 3 files changed, 136 insertions(+), 143 deletions(-) diff --git a/CDEPS/CMakeLists.txt b/CDEPS/CMakeLists.txt index 0299fe7..b01fddd 100755 --- a/CDEPS/CMakeLists.txt +++ b/CDEPS/CMakeLists.txt @@ -98,57 +98,54 @@ target_sources(ACCESS3_cdeps_drof PRIVATE ### Install and Export -## Library -if(ACCESS3_LIB_INSTALL) - # cdeps_common - set_target_properties(ACCESS3_cdeps_common PROPERTIES - OUTPUT_NAME access-cdeps-common - EXPORT_NAME cdeps-common +# cdeps_common +set_target_properties(ACCESS3_cdeps_common PROPERTIES + OUTPUT_NAME access-cdeps-common + EXPORT_NAME cdeps-common +) +install(TARGETS ACCESS3_cdeps_common + EXPORT Access3Sharecdeps_Targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_RunTime NAMELINK_COMPONENT Access3Share_Development + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_Development +) +# Fortran module files are a special case, as currently there is no standard + # way of handling them in CMake + target_include_directories(ACCESS3_cdeps_common PUBLIC "$") + get_target_property(common_moddir ACCESS3_cdeps_common Fortran_MODULE_DIRECTORY) + install(FILES + ${common_moddir}/dshr_methods_mod.mod + ${common_moddir}/dshr_strdata_mod.mod + ${common_moddir}/dshr_stream_mod.mod + ${common_moddir}/dshr_tinterp_mod.mod + + ${common_moddir}/dshr_dfield_mod.mod + ${common_moddir}/dshr_fldlist_mod.mod + ${common_moddir}/dshr_mod.mod + DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-cdeps-common + COMPONENT Access3Share_Development + ) +# components +foreach(LIB atm ocn ice wav rof) + set_target_properties(ACCESS3_cdeps_d${LIB} PROPERTIES + OUTPUT_NAME access-cdeps-d${LIB} + EXPORT_NAME cdeps-d${LIB} ) - install(TARGETS ACCESS3_cdeps_common + install(TARGETS ACCESS3_cdeps_d${LIB} EXPORT Access3Sharecdeps_Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_RunTime NAMELINK_COMPONENT Access3Share_Development ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_Development ) # Fortran module files are a special case, as currently there is no standard - # way of handling them in CMake - target_include_directories(ACCESS3_cdeps_common PUBLIC "$") - get_target_property(common_moddir ACCESS3_cdeps_common Fortran_MODULE_DIRECTORY) - install(FILES - ${common_moddir}/dshr_methods_mod.mod - ${common_moddir}/dshr_strdata_mod.mod - ${common_moddir}/dshr_stream_mod.mod - ${common_moddir}/dshr_tinterp_mod.mod - - ${common_moddir}/dshr_dfield_mod.mod - ${common_moddir}/dshr_fldlist_mod.mod - ${common_moddir}/dshr_mod.mod - DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-cdeps-common - COMPONENT Access3Share_Development - ) - # components - foreach(LIB atm ocn ice wav rof) - set_target_properties(ACCESS3_cdeps_d${LIB} PROPERTIES - OUTPUT_NAME access-cdeps-d${LIB} - EXPORT_NAME cdeps-d${LIB} - ) - install(TARGETS ACCESS3_cdeps_d${LIB} - EXPORT Access3Sharecdeps_Targets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_RunTime NAMELINK_COMPONENT Access3Share_Development - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_Development - ) - # Fortran module files are a special case, as currently there is no standard - # way of handling them in CMake - target_include_directories(ACCESS3_cdeps_d${LIB} PUBLIC "$") - get_target_property(d${LIB}_moddir ACCESS3_cdeps_d${LIB} Fortran_MODULE_DIRECTORY) - install(FILES ${d${LIB}_moddir}/${LIB}_comp_nuopc.mod - DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-cdeps-d${LIB} - COMPONENT Access3Share_Development - ) - endforeach() - install(EXPORT Access3Sharecdeps_Targets - FILE Access3SharecdepsTargets.cmake - NAMESPACE Access3:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share + # way of handling them in CMake + target_include_directories(ACCESS3_cdeps_d${LIB} PUBLIC "$") + get_target_property(d${LIB}_moddir ACCESS3_cdeps_d${LIB} Fortran_MODULE_DIRECTORY) + install(FILES ${d${LIB}_moddir}/${LIB}_comp_nuopc.mod + DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-cdeps-d${LIB} + COMPONENT Access3Share_Development ) -endif() +endforeach() +install(EXPORT Access3Sharecdeps_Targets + FILE Access3SharecdepsTargets.cmake + NAMESPACE Access3:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share +) \ No newline at end of file diff --git a/CMEPS/CMakeLists.txt b/CMEPS/CMakeLists.txt index 4995521..d782714 100755 --- a/CMEPS/CMakeLists.txt +++ b/CMEPS/CMakeLists.txt @@ -67,52 +67,50 @@ target_sources(ACCESS3_nuopc_cap_share PRIVATE ### Install and Export -if(ACCESS3_LIB_INSTALL) - ## CMEPS library - set_target_properties(ACCESS3_cmeps PROPERTIES - OUTPUT_NAME access-cmeps - EXPORT_NAME cmeps - ) - install(TARGETS ACCESS3_cmeps - EXPORT Access3Sharecmeps_Targets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_RunTime NAMELINK_COMPONENT Access3Share_Development - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_Development - ) - # Fortran module files are a special case, as currently there is no standard - # way of handling them in CMake - target_include_directories(ACCESS3_cmeps PUBLIC "$") - get_target_property(cmeps_moddir ACCESS3_cmeps Fortran_MODULE_DIRECTORY) - install(FILES ${cmeps_moddir}/med.mod ${cmeps_moddir}/med_time_mod.mod ${cmeps_moddir}/med_internalstate_mod.mod - DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-cmeps - COMPONENT Access3Share_Development - ) - install(EXPORT Access3Sharecmeps_Targets - FILE Access3SharecmepsTargets.cmake - NAMESPACE Access3:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share - ) +## CMEPS library +set_target_properties(ACCESS3_cmeps PROPERTIES + OUTPUT_NAME access-cmeps + EXPORT_NAME cmeps +) +install(TARGETS ACCESS3_cmeps + EXPORT Access3Sharecmeps_Targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_RunTime NAMELINK_COMPONENT Access3Share_Development + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_Development +) +# Fortran module files are a special case, as currently there is no standard +# way of handling them in CMake +target_include_directories(ACCESS3_cmeps PUBLIC "$") +get_target_property(cmeps_moddir ACCESS3_cmeps Fortran_MODULE_DIRECTORY) +install(FILES ${cmeps_moddir}/med.mod ${cmeps_moddir}/med_time_mod.mod ${cmeps_moddir}/med_internalstate_mod.mod + DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-cmeps + COMPONENT Access3Share_Development +) +install(EXPORT Access3Sharecmeps_Targets + FILE Access3SharecmepsTargets.cmake + NAMESPACE Access3:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share +) - ## NUOPC cap share - set_target_properties(ACCESS3_nuopc_cap_share PROPERTIES - OUTPUT_NAME access-nuopc_cap_share - EXPORT_NAME nuopc_cap_share - ) - install(TARGETS ACCESS3_nuopc_cap_share - EXPORT Access3Sharenuopc_cap_share_Targets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_RunTime NAMELINK_COMPONENT Access3Share_Development - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_Development - ) - # Fortran module files are a special case, as currently there is no standard - # way of handling them in CMake - target_include_directories(ACCESS3_nuopc_cap_share PUBLIC "$") - get_target_property(nuopc_cap_share_moddir ACCESS3_nuopc_cap_share Fortran_MODULE_DIRECTORY) - install(DIRECTORY ${nuopc_cap_share_moddir}/ - DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-nuopc_cap_share - COMPONENT Access3Share_Development - ) - install(EXPORT Access3Sharenuopc_cap_share_Targets - FILE Access3Sharenuopc_cap_shareTargets.cmake - NAMESPACE Access3:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share - ) -endif() +## NUOPC cap share +set_target_properties(ACCESS3_nuopc_cap_share PROPERTIES + OUTPUT_NAME access-nuopc_cap_share + EXPORT_NAME nuopc_cap_share +) +install(TARGETS ACCESS3_nuopc_cap_share + EXPORT Access3Sharenuopc_cap_share_Targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_RunTime NAMELINK_COMPONENT Access3Share_Development + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_Development +) +# Fortran module files are a special case, as currently there is no standard +# way of handling them in CMake +target_include_directories(ACCESS3_nuopc_cap_share PUBLIC "$") +get_target_property(nuopc_cap_share_moddir ACCESS3_nuopc_cap_share Fortran_MODULE_DIRECTORY) +install(DIRECTORY ${nuopc_cap_share_moddir}/ + DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-nuopc_cap_share + COMPONENT Access3Share_Development +) +install(EXPORT Access3Sharenuopc_cap_share_Targets + FILE Access3Sharenuopc_cap_shareTargets.cmake + NAMESPACE Access3:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share +) diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index d0c53be..5a56c97 100755 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -77,52 +77,50 @@ target_sources(ACCESS3_timing PRIVATE ### Install and Export -if(ACCESS3_LIB_INSTALL) - ## share library - set_target_properties(share PROPERTIES - OUTPUT_NAME access-share - EXPORT_NAME share - ) - install(TARGETS share - EXPORT Access3Shareshare_Targets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_RunTime NAMELINK_COMPONENT Access3Share_Development - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_Development - ) - # Fortran module files are a special case, as currently there is no standard - # way of handling them in CMake - target_include_directories(share PUBLIC "$") - get_target_property(share_moddir share Fortran_MODULE_DIRECTORY) - install(DIRECTORY ${share_moddir}/ - DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-share - COMPONENT Access3Share_Development - ) - install(EXPORT Access3Shareshare_Targets - FILE Access3ShareshareTargets.cmake - NAMESPACE Access3:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share - ) +## share library +set_target_properties(share PROPERTIES + OUTPUT_NAME access-share + EXPORT_NAME share +) +install(TARGETS share + EXPORT Access3Shareshare_Targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_RunTime NAMELINK_COMPONENT Access3Share_Development + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_Development +) +# Fortran module files are a special case, as currently there is no standard +# way of handling them in CMake +target_include_directories(share PUBLIC "$") +get_target_property(share_moddir share Fortran_MODULE_DIRECTORY) +install(DIRECTORY ${share_moddir}/ + DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-share + COMPONENT Access3Share_Development +) +install(EXPORT Access3Shareshare_Targets + FILE Access3ShareshareTargets.cmake + NAMESPACE Access3:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share +) - ## timing library - set_target_properties(ACCESS3_timing PROPERTIES - OUTPUT_NAME access-timing - EXPORT_NAME timing - ) - install(TARGETS ACCESS3_timing - EXPORT Access3Sharetiming_Targets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_RunTime NAMELINK_COMPONENT Access3Share_Development - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_Development - ) - # Fortran module files are a special case, as currently there is no standard - # way of handling them in CMake - target_include_directories(ACCESS3_timing PUBLIC "$") - get_target_property(timing_moddir ACCESS3_timing Fortran_MODULE_DIRECTORY) - install(DIRECTORY ${timing_moddir}/ - DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-timing - COMPONENT Access3Share_Development - ) - install(EXPORT Access3Sharetiming_Targets - FILE Access3SharetimingTargets.cmake - NAMESPACE Access3:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share - ) -endif() +## timing library +set_target_properties(ACCESS3_timing PROPERTIES + OUTPUT_NAME access-timing + EXPORT_NAME timing +) +install(TARGETS ACCESS3_timing + EXPORT Access3Sharetiming_Targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_RunTime NAMELINK_COMPONENT Access3Share_Development + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Access3Share_Development +) +# Fortran module files are a special case, as currently there is no standard +# way of handling them in CMake +target_include_directories(ACCESS3_timing PUBLIC "$") +get_target_property(timing_moddir ACCESS3_timing Fortran_MODULE_DIRECTORY) +install(DIRECTORY ${timing_moddir}/ + DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-timing + COMPONENT Access3Share_Development +) +install(EXPORT Access3Sharetiming_Targets + FILE Access3SharetimingTargets.cmake + NAMESPACE Access3:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share +) From 042f7c4c2cc44fd3e0087a174fff2773c7a93194 Mon Sep 17 00:00:00 2001 From: Anton Steketee <79179784+anton-seaice@users.noreply.github.com> Date: Tue, 21 Jan 2025 13:59:47 +1100 Subject: [PATCH 12/31] Update Access3BinInstall.cmake --- cmake/Access3BinInstall.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/Access3BinInstall.cmake b/cmake/Access3BinInstall.cmake index 0ce6772..8698241 100644 --- a/cmake/Access3BinInstall.cmake +++ b/cmake/Access3BinInstall.cmake @@ -47,7 +47,7 @@ endif() find_package(Access3Share REQUIRED cdeps cmeps nuopc_cap_share share timing) if(ENABLE_CICE6) #TO-DO remove hardcoded IO_PIO ? - find_package(Cicelib REQUIRED COMPONENTS IO_PIO) + find_package(Cicelib REQUIRED COMPONENTS AccessCiceCmeps IO_PIO) endif() if(ENABLE_MOM6) find_package(AccessMom6Cmeps REQUIRED) @@ -119,4 +119,4 @@ foreach(CONF IN LISTS KnownConfigurations) install(TARGETS OM3_${CONF} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) -endforeach() \ No newline at end of file +endforeach() From 56a6cb3b49a4b554147a0ee32252935db55a4910 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Thu, 23 Jan 2025 15:41:04 +1100 Subject: [PATCH 13/31] refinements to component names --- cmake/Access3BinInstall.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/Access3BinInstall.cmake b/cmake/Access3BinInstall.cmake index 8698241..c35a135 100644 --- a/cmake/Access3BinInstall.cmake +++ b/cmake/Access3BinInstall.cmake @@ -47,13 +47,13 @@ endif() find_package(Access3Share REQUIRED cdeps cmeps nuopc_cap_share share timing) if(ENABLE_CICE6) #TO-DO remove hardcoded IO_PIO ? - find_package(Cicelib REQUIRED COMPONENTS AccessCiceCmeps IO_PIO) + find_package(Cicelib REQUIRED COMPONENTS AccessCiceCmeps_Development IO_PIO) endif() if(ENABLE_MOM6) - find_package(AccessMom6Cmeps REQUIRED) + find_package(mom6lib REQUIRED AccessMOM6Cmeps_Development) endif() if(ENABLE_WW3) - find_package(AccessWW3Cmeps REQUIRED) + find_package(AccessWW3Cmeps REQUIRED AccessWW3Cmeps_Development) endif() # Main Definitions @@ -66,7 +66,7 @@ foreach(CONF IN LISTS KnownConfigurations) set(ComponentsTargets "") if(OM3_${CONF} MATCHES MOM6) - list(APPEND ComponentsTargets AccessMom6::mom6-cmeps) + list(APPEND ComponentsTargets Access3::mom6lib) else() list(APPEND ComponentsTargets Access3::cdeps-docn) endif() From 08880526983e72ef83b67ff0504df43439db1cd7 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Thu, 23 Jan 2025 16:10:02 +1100 Subject: [PATCH 14/31] fix IO_PIO dependency finding --- cmake/Access3BinInstall.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/Access3BinInstall.cmake b/cmake/Access3BinInstall.cmake index c35a135..add0c6f 100644 --- a/cmake/Access3BinInstall.cmake +++ b/cmake/Access3BinInstall.cmake @@ -46,8 +46,7 @@ endif() # External packages find_package(Access3Share REQUIRED cdeps cmeps nuopc_cap_share share timing) if(ENABLE_CICE6) -#TO-DO remove hardcoded IO_PIO ? - find_package(Cicelib REQUIRED COMPONENTS AccessCiceCmeps_Development IO_PIO) + find_package(Cicelib REQUIRED COMPONENTS AccessCICECmeps_Development) endif() if(ENABLE_MOM6) find_package(mom6lib REQUIRED AccessMOM6Cmeps_Development) From 96859ad7a889e0dec564856f6c684c0f169422ef Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Thu, 23 Jan 2025 16:43:55 +1100 Subject: [PATCH 15/31] name tweaks --- cmake/Access3BinInstall.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Access3BinInstall.cmake b/cmake/Access3BinInstall.cmake index add0c6f..76dcd3e 100644 --- a/cmake/Access3BinInstall.cmake +++ b/cmake/Access3BinInstall.cmake @@ -49,7 +49,7 @@ if(ENABLE_CICE6) find_package(Cicelib REQUIRED COMPONENTS AccessCICECmeps_Development) endif() if(ENABLE_MOM6) - find_package(mom6lib REQUIRED AccessMOM6Cmeps_Development) + find_package(MOM6lib REQUIRED AccessMOM6Cmeps_Development) endif() if(ENABLE_WW3) find_package(AccessWW3Cmeps REQUIRED AccessWW3Cmeps_Development) From dd99e0221ac7abac972f4f2658b0fca13a2dae83 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Wed, 5 Feb 2025 16:04:30 +1100 Subject: [PATCH 16/31] clean up presets set through spack --- cmake/CMakePresets-compilers.json | 66 ------------------------------- cmake/CMakePresets-defaults.json | 30 -------------- cmake/CMakePresets-machines.json | 41 ------------------- 3 files changed, 137 deletions(-) delete mode 100644 cmake/CMakePresets-compilers.json delete mode 100644 cmake/CMakePresets-defaults.json delete mode 100644 cmake/CMakePresets-machines.json diff --git a/cmake/CMakePresets-compilers.json b/cmake/CMakePresets-compilers.json deleted file mode 100644 index e847096..0000000 --- a/cmake/CMakePresets-compilers.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "version": 5, - "include": [ - "CMakePresets-defaults.json" - ], - "configurePresets": [ - { - "name": "openmpi", - "displayName": "Configure preset for OpenMPI based toolchains", - "inherits": [ - "default" - ], - "cacheVariables": { - "CMAKE_Fortran_COMPILER": { - "value": "mpif90" - }, - "CMAKE_C_COMPILER": { - "value": "mpicc" - } - } - }, - { - "name": "intel-mpi", - "displayName": "Configure preset for Intel-MPI based toolchain", - "inherits": [ - "default" - ], - "cacheVariables": { - "CMAKE_Fortran_COMPILER": { - "type": "FILEPATH", - "value": "mpiifort" - }, - "CMAKE_C_COMPILER": { - "type": "FILEPATH", - "value": "mpiicc" - } - } - } - ], - "buildPresets": [ - { - "name": "toolchain-base", - "hidden": true, - "inherits": [ - "default" - ], - "cleanFirst": true - }, - { - "name": "openmpi", - "displayName": "Build preset for OpenMPI based toolchains", - "inherits": [ - "toolchain-base" - ], - "configurePreset": "openmpi" - }, - { - "name": "intel", - "displayName": "Build preset for Intel-MPI based toolchains", - "inherits": [ - "toolchain-base" - ], - "configurePreset": "intel-mpi" - } - ] -} diff --git a/cmake/CMakePresets-defaults.json b/cmake/CMakePresets-defaults.json deleted file mode 100644 index 78570c1..0000000 --- a/cmake/CMakePresets-defaults.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "version": 5, - "configurePresets": [ - { - "name": "default", - "displayName": "Default configuration preset", - "binaryDir": "cmake-build-release", - "cacheVariables": { - "CMAKE_BUILD_TYPE": { - "type": "STRING", - "value": "Release" - } - } - } - ], - "buildPresets": [ - { - "name": "default", - "displayName": "Default build preset", - "configurePreset": "default" - } - ], - "testPresets": [ - { - "name": "default", - "displayName": "Default test preset", - "configurePreset": "default" - } - ] -} diff --git a/cmake/CMakePresets-machines.json b/cmake/CMakePresets-machines.json deleted file mode 100644 index 1e7a712..0000000 --- a/cmake/CMakePresets-machines.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "version": 5, - "include": [ - "CMakePresets-defaults.json", - "CMakePresets-compilers.json" - ], - "configurePresets": [ - { - "name": "gadi", - "displayName": "Configure preset for Gadi", - "inherits": [ - "openmpi" - ], - "cacheVariables": { - "NetCDF_C_LIBRARY": { - "type": "FILEPATH", - "value": "$env{SPACK_NETCDF_C_ROOT}/lib/libnetcdf.so" - }, - "NetCDF_Fortran_LIBRARY": { - "type": "FILEPATH", - "value": "$env{SPACK_NETCDF_FORTRAN_ROOT}/lib/libnetcdff.so" - }, - "NetCDF_Fortran_INCLUDE_DIRS": { - "type": "FILEPATH", - "value": "$env{SPACK_NETCDF_FORTRAN_ROOT}/include" - } - } - } - ], - "buildPresets": [ - { - "name": "gadi", - "displayName": "Build preset for Gadi", - "inherits": [ - "openmpi" - ], - "cleanFirst": true, - "configurePreset": "gadi" - } - ] -} From dce08d458b3138dfe8a78b147fa7b486011ee0b5 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Thu, 6 Feb 2025 10:11:44 +1100 Subject: [PATCH 17/31] possible better deps handling --- cmake/Access3ShareConfig.cmake.in | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmake/Access3ShareConfig.cmake.in b/cmake/Access3ShareConfig.cmake.in index 1ac3821..13c3dde 100755 --- a/cmake/Access3ShareConfig.cmake.in +++ b/cmake/Access3ShareConfig.cmake.in @@ -57,10 +57,11 @@ if (cdeps IN_LIST _required_components) find_dependency(FoX) endif() -#MOVE / CHECK in MOM6 package -#if (mom6 IN_LIST _required_components) -# find_dependency(fms COMPONENTS R8 REQUIRED) -#endif() +if (NOT TARGET PIO::PIO_Fortran) + find_package(PIO 2.5.3 REQUIRED COMPONENTS C Fortran) +endif() + +find_package(NetCDF 4.7.3 REQUIRED Fortran) list(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) From 9297d8fd0ff00da0a888354802c561511361ebea Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Thu, 6 Feb 2025 10:12:11 +1100 Subject: [PATCH 18/31] Make BuildConfigurations a command line option --- cmake/Access3BinInstall.cmake | 34 +++++++++++++++------------------- cmake/Access3LibInstall.cmake | 2 +- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/cmake/Access3BinInstall.cmake b/cmake/Access3BinInstall.cmake index 76dcd3e..cde6e47 100644 --- a/cmake/Access3BinInstall.cmake +++ b/cmake/Access3BinInstall.cmake @@ -5,6 +5,14 @@ # Configurations to build # TO-DO add UM list(APPEND KnownConfigurations MOM6 CICE6 WW3 MOM6-CICE6 CICE6-WW3 MOM6-WW3 MOM6-CICE6-WW3) +set(BuildConfigurations) + +# Check validity of requested components +foreach(_conf IN LISTS BuildConfigurations) + if (NOT _conf IN_LIST KnownConfigurations) + message (FATAL_ERROR "Unsupported configuration: ${_conf}") + endif() +endforeach() option(ENABLE_MOM6 "Build MOM6 configuration" OFF) option(ENABLE_CICE6 "Build CICE6 configuration" OFF) @@ -14,27 +22,21 @@ option(ENABLE_MOM6-CICE6 "Build MOM6-CICE6 configuration" OFF) option(ENABLE_CICE6-WW3 "Build CICE6-WW3 configuration" OFF) option(ENABLE_MOM6-CICE6-WW3 "Build MOM6-CICE6-WW3 configuration" OFF) -message(STATUS "Configurations") -message(STATUS " - MOM6 ${ENABLE_MOM6}") -message(STATUS " - CICE6 ${ENABLE_CICE6}") -message(STATUS " - WW3 ${ENABLE_WW3}") -message(STATUS " - MOM6-WW3 ${ENABLE_MOM6-WW3}") -message(STATUS " - MOM6-CICE6 ${ENABLE_MOM6-CICE6}") -message(STATUS " - CICE6-WW3 ${ENABLE_CICE6-WW3}") -message(STATUS " - MOM6-CICE6-WW3 ${ENABLE_MOM6-CICE6-WW3}") +message(STATUS "BuildConfigurations") +message(STATUS "${BuildConfigurations}") # Do not build try to include that are not going to be used -if(ENABLE_MOM6 OR ENABLE_MOM6-CICE6 OR ENABLE_MOM6-WW3 OR ENABLE_MOM6-CICE6-WW3) +if(MOM6 IN_LIST BuildConfigurations OR MOM6-CICE6 IN_LIST BuildConfigurations OR MOM6-WW3 IN_LIST BuildConfigurations OR MOM6-CICE6-WW3 IN_LIST BuildConfigurations) set(ENABLE_MOM6 ON) else() set(ENABLE_MOM6 OFF) endif() -if(ENABLE_CICE6 OR ENABLE_MOM6-CICE6 OR ENABLE_CICE6-WW3 OR ENABLE_MOM6-CICE6-WW3) +if(CICE6 IN_LIST BuildConfigurations OR MOM6-CICE6 IN_LIST BuildConfigurations OR CICE6-WW3 IN_LIST BuildConfigurations OR MOM6-CICE6-WW3 IN_LIST BuildConfigurations) set(ENABLE_CICE6 ON) else() set(ENABLE_CICE6 OFF) endif() -if(ENABLE_WW3 OR ENABLE_MOM6-WW3 OR ENABLE_CICE6-WW3 OR ENABLE_MOM6-CICE6-WW3) +if(WW3 IN_LIST BuildConfigurations OR MOM6-WW3 IN_LIST BuildConfigurations OR CICE6-WW3 IN_LIST BuildConfigurations OR MOM6-CICE6-WW3 IN_LIST BuildConfigurations) set(ENABLE_WW3 ON) else() set(ENABLE_WW3 OFF) @@ -58,10 +60,7 @@ endif() # Main Definitions # Add executable for each enabled configuration -foreach(CONF IN LISTS KnownConfigurations) - if(NOT ENABLE_${CONF}) - continue() - endif() +foreach(CONF IN LISTS BuildConfigurations) set(ComponentsTargets "") if(OM3_${CONF} MATCHES MOM6) @@ -110,10 +109,7 @@ endforeach() # Install -foreach(CONF IN LISTS KnownConfigurations) - if(NOT ENABLE_${CONF}) - continue() - endif() +foreach(CONF IN LISTS BuildConfigurations) install(TARGETS OM3_${CONF} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} diff --git a/cmake/Access3LibInstall.cmake b/cmake/Access3LibInstall.cmake index 7a0bb15..f878c51 100644 --- a/cmake/Access3LibInstall.cmake +++ b/cmake/Access3LibInstall.cmake @@ -26,7 +26,7 @@ configure_package_config_file( ${CMAKE_CURRENT_BINARY_DIR}/Access3ShareConfig.cmake INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share ) -install(FILES ${CMAKE_SOURCE_DIR}/cmake/FindFoX.cmake ${CMAKE_CURRENT_BINARY_DIR}/Access3ShareConfig.cmake +install(FILES ${CMAKE_SOURCE_DIR}/cmake/FindFoX.cmake ${CMAKE_SOURCE_DIR}/cmake/FindNetCDF.cmake ${CMAKE_SOURCE_DIR}/cmake/FindPIO.cmake ${CMAKE_CURRENT_BINARY_DIR}/Access3ShareConfig.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share COMPONENT Access3Share ) \ No newline at end of file From ac938af83b5e55ce5b24cad07006a5a5d12a9852 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Thu, 27 Feb 2025 13:57:49 +1100 Subject: [PATCH 19/31] neaten up deps --- CMakeLists.txt | 15 ++++++----- cmake/Access3BinInstall.cmake | 47 +++++++++++++++-------------------- 2 files changed, 27 insertions(+), 35 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cdda75a..77c0f24 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,9 +11,9 @@ cmake_minimum_required(VERSION 3.18) # Basic project definition # #]==============================================================================] -project(Access3Share VERSION "0.3.1" +project(Access3Share HOMEPAGE_URL https://github.com/access-nri/access3-share - DESCRIPTION "Global coupled ocean - sea ice - wave model" + DESCRIPTION "Dependencies for global climate models" LANGUAGES C Fortran) #[==============================================================================[ @@ -22,11 +22,11 @@ project(Access3Share VERSION "0.3.1" # Build options option(ACCESS3_LIB_INSTALL "Install ACCESS3 libraries" OFF) -# option(OPENMP "Enable OpenMP threading" OFF) +option(OPENMP "Enable OpenMP threading" OFF) message(STATUS "Build options") message(STATUS " - ACCESS3_LIB_INSTALL ${ACCESS3_LIB_INSTALL}") -# message(STATUS " - OPENMP ${ACCESS3_OPENMP}") +message(STATUS " - OPENMP ${OPENMP}") #[==============================================================================[ @@ -84,9 +84,9 @@ set(CMAKE_INSTALL_MODULEDIR ${CMAKE_INSTALL_INCLUDEDIR} # Find dependencies find_package(MPI REQUIRED) -# if(OPENMP) -# find_package(OpenMP REQUIRED) -# endif() +if(OPENMP) + find_package(OpenMP REQUIRED) +endif() find_package(ESMF 8.3.0 MODULE REQUIRED) @@ -97,7 +97,6 @@ find_package(ESMF 8.3.0 MODULE REQUIRED) ## Use seperate files for building libraries vs final exectuable if(ACCESS3_LIB_INSTALL) - # Libraries include(Access3LibInstall) else() # OM3 executables diff --git a/cmake/Access3BinInstall.cmake b/cmake/Access3BinInstall.cmake index cde6e47..a32cc9f 100644 --- a/cmake/Access3BinInstall.cmake +++ b/cmake/Access3BinInstall.cmake @@ -7,40 +7,33 @@ list(APPEND KnownConfigurations MOM6 CICE6 WW3 MOM6-CICE6 CICE6-WW3 MOM6-WW3 MOM6-CICE6-WW3) set(BuildConfigurations) +option(ENABLE_MOM6 "Build MOM6 configuration" OFF) +option(ENABLE_CICE6 "Build CICE6 configuration" OFF) +option(ENABLE_WW3 "Build WW3 configuration" OFF) + # Check validity of requested components foreach(_conf IN LISTS BuildConfigurations) if (NOT _conf IN_LIST KnownConfigurations) message (FATAL_ERROR "Unsupported configuration: ${_conf}") endif() + # Do not build try to include that are not going to be used + if (_conf MATCHES MOM6) + set(ENABLE_MOM6 ON) + endif() + if (_conf MATCHES CICE6) + set(ENABLE_CICE6 ON) + endif() + if (_conf MATCHES WW3) + set(ENABLE_WW3 ON) + endif() endforeach() -option(ENABLE_MOM6 "Build MOM6 configuration" OFF) -option(ENABLE_CICE6 "Build CICE6 configuration" OFF) -option(ENABLE_WW3 "Build WW3 configuration" OFF) -option(ENABLE_MOM6-WW3 "Build MOM6-WW3 configuration" OFF) -option(ENABLE_MOM6-CICE6 "Build MOM6-CICE6 configuration" OFF) -option(ENABLE_CICE6-WW3 "Build CICE6-WW3 configuration" OFF) -option(ENABLE_MOM6-CICE6-WW3 "Build MOM6-CICE6-WW3 configuration" OFF) - message(STATUS "BuildConfigurations") message(STATUS "${BuildConfigurations}") +message(STATUS " - MOM6 ${ENABLE_MOM6}") +message(STATUS " - CICE6 ${ENABLE_CICE6}") +message(STATUS " - WW3 ${ENABLE_WW3}") -# Do not build try to include that are not going to be used -if(MOM6 IN_LIST BuildConfigurations OR MOM6-CICE6 IN_LIST BuildConfigurations OR MOM6-WW3 IN_LIST BuildConfigurations OR MOM6-CICE6-WW3 IN_LIST BuildConfigurations) - set(ENABLE_MOM6 ON) -else() - set(ENABLE_MOM6 OFF) -endif() -if(CICE6 IN_LIST BuildConfigurations OR MOM6-CICE6 IN_LIST BuildConfigurations OR CICE6-WW3 IN_LIST BuildConfigurations OR MOM6-CICE6-WW3 IN_LIST BuildConfigurations) - set(ENABLE_CICE6 ON) -else() - set(ENABLE_CICE6 OFF) -endif() -if(WW3 IN_LIST BuildConfigurations OR MOM6-WW3 IN_LIST BuildConfigurations OR CICE6-WW3 IN_LIST BuildConfigurations OR MOM6-CICE6-WW3 IN_LIST BuildConfigurations) - set(ENABLE_WW3 ON) -else() - set(ENABLE_WW3 OFF) -endif() if(NOT (ENABLE_MOM6 OR ENABLE_CICE6 OR ENABLE_WW3)) message (FATAL_ERROR "No model components have been requested, atleast one ENABLE_ configuration must be set") endif() @@ -63,17 +56,17 @@ endif() foreach(CONF IN LISTS BuildConfigurations) set(ComponentsTargets "") - if(OM3_${CONF} MATCHES MOM6) + if(CONF MATCHES MOM6) list(APPEND ComponentsTargets Access3::mom6lib) else() list(APPEND ComponentsTargets Access3::cdeps-docn) endif() - if(OM3_${CONF} MATCHES CICE6) + if(CONF MATCHES CICE6) list(APPEND ComponentsTargets Access3::cicelib) else() list(APPEND ComponentsTargets Access3::cdeps-dice) endif() - if(OM3_${CONF} MATCHES WW3) + if(CONF MATCHES WW3) list(APPEND ComponentsTargets AccessWw3::ww3-cmeps) else() list(APPEND ComponentsTargets Access3::cdeps-dwav) From 87ad9bc4fba34fec76cc93811ebdf177d04639e8 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Thu, 27 Feb 2025 21:23:02 +1100 Subject: [PATCH 20/31] build ci --- .github/workflows/model-build-test-ci.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/model-build-test-ci.yml diff --git a/.github/workflows/model-build-test-ci.yml b/.github/workflows/model-build-test-ci.yml new file mode 100644 index 0000000..5c36727 --- /dev/null +++ b/.github/workflows/model-build-test-ci.yml @@ -0,0 +1,15 @@ +name: Test model build + +on: + workflow_dispatch: + pull_request: + push: + branches: + - "main" + +jobs: + build: + name: Build ${{ github.repository }} via spack + uses: access-nri/build-ci/.github/workflows/model-1-build.yml@main + permissions: + packages: read \ No newline at end of file From 1e07258fb81334c4755b5461c8bd510bafcda681 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Fri, 28 Feb 2025 15:10:47 +1100 Subject: [PATCH 21/31] correction for lib install --- CMEPS/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMEPS/CMakeLists.txt b/CMEPS/CMakeLists.txt index ae2194d..0362d0f 100755 --- a/CMEPS/CMakeLists.txt +++ b/CMEPS/CMakeLists.txt @@ -78,7 +78,7 @@ install(TARGETS ACCESS3_cmeps # way of handling them in CMake target_include_directories(ACCESS3_cmeps PUBLIC "$") get_target_property(cmeps_moddir ACCESS3_cmeps Fortran_MODULE_DIRECTORY) -install(FILES ${cmeps_moddir}/med.mod ${cmeps_moddir}/med_time_mod.mod ${cmeps_moddir}/med_internalstate_mod.mod +install(FILES ${cmeps_moddir}/med.mod ${cmeps_moddir}/med_internalstate_mod.mod DESTINATION ${CMAKE_INSTALL_MODULEDIR}/access-cmeps COMPONENT Access3Share_Development ) From 76fbef72aece6f7c4c2691127073b69ef8676bab Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Thu, 13 Mar 2025 16:26:53 +1100 Subject: [PATCH 22/31] fp-model precise and tidy up --- CMakeLists.txt | 2 +- cmake/Access3BinInstall.cmake | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 77c0f24..c1af20f 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(CMAKE_Fortran_FLAGS_RELEASE "-O") set(CMAKE_Fortran_FLAGS_DEBUG "-g -Wall -Og -ffpe-trap=zero,overflow -fcheck=bounds") elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") - set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model precise") set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -debug minimal") set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created") else() diff --git a/cmake/Access3BinInstall.cmake b/cmake/Access3BinInstall.cmake index a32cc9f..31f729f 100644 --- a/cmake/Access3BinInstall.cmake +++ b/cmake/Access3BinInstall.cmake @@ -44,10 +44,10 @@ if(ENABLE_CICE6) find_package(Cicelib REQUIRED COMPONENTS AccessCICECmeps_Development) endif() if(ENABLE_MOM6) - find_package(MOM6lib REQUIRED AccessMOM6Cmeps_Development) + find_package(Mom6lib REQUIRED AccessMOM6Cmeps_Development) endif() if(ENABLE_WW3) - find_package(AccessWW3Cmeps REQUIRED AccessWW3Cmeps_Development) + find_package(Ww3lib REQUIRED AccessWW3Cmeps_Development) endif() # Main Definitions @@ -67,7 +67,7 @@ foreach(CONF IN LISTS BuildConfigurations) list(APPEND ComponentsTargets Access3::cdeps-dice) endif() if(CONF MATCHES WW3) - list(APPEND ComponentsTargets AccessWw3::ww3-cmeps) + list(APPEND ComponentsTargets Access3::ww3lib) else() list(APPEND ComponentsTargets Access3::cdeps-dwav) endif() From 65e006a5149779b0a6e390fbcf51f7e8331ad4a1 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Fri, 14 Mar 2025 17:10:52 +1100 Subject: [PATCH 23/31] tidy --- CMakeLists.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c1af20f..a8f48f0 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,11 +22,9 @@ project(Access3Share # Build options option(ACCESS3_LIB_INSTALL "Install ACCESS3 libraries" OFF) -option(OPENMP "Enable OpenMP threading" OFF) message(STATUS "Build options") message(STATUS " - ACCESS3_LIB_INSTALL ${ACCESS3_LIB_INSTALL}") -message(STATUS " - OPENMP ${OPENMP}") #[==============================================================================[ @@ -84,9 +82,6 @@ set(CMAKE_INSTALL_MODULEDIR ${CMAKE_INSTALL_INCLUDEDIR} # Find dependencies find_package(MPI REQUIRED) -if(OPENMP) - find_package(OpenMP REQUIRED) -endif() find_package(ESMF 8.3.0 MODULE REQUIRED) From bab3b04cb8c7305a3ea40d622ca9bf5c8616ceca Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Mon, 17 Mar 2025 15:48:40 +1100 Subject: [PATCH 24/31] updated ESMF cmake file with license --- cmake/FindESMF.cmake | 181 ++++++++++++++++++++++++++++--------------- 1 file changed, 120 insertions(+), 61 deletions(-) diff --git a/cmake/FindESMF.cmake b/cmake/FindESMF.cmake index 5ba7003..8dfb926 100644 --- a/cmake/FindESMF.cmake +++ b/cmake/FindESMF.cmake @@ -1,34 +1,81 @@ +# Earth System Modeling Framework + +# Copyright (c) 2002-2025 University Corporation for Atmospheric Research, +# Massachusetts Institute of Technology, Geophysical Fluid Dynamics Laboratory, +# University of Michigan, National Centers for Environmental Prediction, +# Los Alamos National Laboratory, Argonne National Laboratory, +# NASA Goddard Space Flight Center. +# All rights reserved. + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal with the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimers. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimers in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the names of the organizations developing this software, nor +# the names of its contributors may be used to endorse or promote products +# derived from this Software without specific prior written permission. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# WITH THE SOFTWARE. + # - Try to find ESMF # -# Requires setting ESMFMKFILE to the filepath of esmf.mk. If this is NOT set, -# then ESMF_FOUND will always be FALSE. If ESMFMKFILE exists, then ESMF_FOUND=TRUE -# and all ESMF makefile variables will be set in the global scope. Optionally, -# set ESMF_MKGLOBALS to a string list to filter makefile variables. For example, -# to globally scope only ESMF_LIBSDIR and ESMF_APPSDIR variables, use this CMake -# command in CMakeLists.txt: +# Uses ESMFMKFILE to find the filepath of esmf.mk. If this is NOT set, then this +# module will attempt to find esmf.mk. If ESMFMKFILE exists, then +# ESMF_FOUND=TRUE and all ESMF makefile variables will be set in the global +# scope. Optionally, set ESMF_MKGLOBALS to a string list to filter makefile +# variables. For example, to globally scope only ESMF_LIBSDIR and ESMF_APPSDIR +# variables, use this CMake command in CMakeLists.txt: # # set(ESMF_MKGLOBALS "LIBSDIR" "APPSDIR") +# Set ESMFMKFILE as defined by system env variable. If it's not explicitly set +# try to find esmf.mk file in default locations (ESMF_ROOT, CMAKE_PREFIX_PATH, +# etc) -# Add the ESMFMKFILE path to the cache if defined as system env variable -if(DEFINED ENV{ESMFMKFILE} AND NOT DEFINED ESMFMKFILE) - set(ESMFMKFILE $ENV{ESMFMKFILE} CACHE FILEPATH "Path to ESMF mk file") -endif() +# - Common Usage +# +# Where to look for this FindESMF.cmake file +# list(APPEND CMAKE_MODULE_PATH "") +# is to be replaced with the directory for this file +# +# How to locate ESMF libraries and create target +# find_package(ESMF MODULE REQUIRED) +# is to be replaced with the minimum version required +# +# How to link targets +# target_link_libraries( PUBLIC ESMF::ESMF) +# is to be replaced with your CMake target -# If it's not explicitly set try to find esmf.mk file in default locations (ESMF_ROOT, CMAKE_PREFIX_PATH, etc) if(NOT DEFINED ESMFMKFILE) - find_path(ESMFMKFILE_PATH esmf.mk PATH_SUFFIXES lib lib64) - if(ESMFMKFILE_PATH) - set(ESMFMKFILE ${ESMFMKFILE_PATH}/esmf.mk) - message(STATUS "Found esmf.mk file ${ESMFMKFILE}") + if(NOT DEFINED ENV{ESMFMKFILE}) + find_path(ESMFMKFILE_PATH esmf.mk PATH_SUFFIXES lib lib64) + if(ESMFMKFILE_PATH) + set(ESMFMKFILE ${ESMFMKFILE_PATH}/esmf.mk) + message(STATUS "Found esmf.mk file ${ESMFMKFILE}") + endif() else() - message(STATUS "ESMFMKFILE not defined. This is the path to esmf.mk file. \ -Without this filepath, ESMF_FOUND will always be FALSE.") + set(ESMFMKFILE $ENV{ESMFMKFILE}) endif() endif() # Only parse the mk file if it is found if(EXISTS ${ESMFMKFILE}) + set(ESMFMKFILE ${ESMFMKFILE} CACHE FILEPATH "Path to esmf.mk file") + set(ESMF_FOUND TRUE CACHE BOOL "esmf.mk file found" FORCE) + # Read the mk file file(STRINGS "${ESMFMKFILE}" esmfmkfile_contents) # Parse each line in the mk file @@ -78,58 +125,70 @@ if(EXISTS ${ESMFMKFILE}) set(ESMF_BETA_RELEASE FALSE) if(ESMF_VERSION_BETASNAPSHOT MATCHES "^('T')$") set(ESMF_BETA_RELEASE TRUE) - string(REGEX REPLACE ".*beta_snapshot_*\([0-9]*\).*" "\\1" ESMF_BETA_SNAPSHOT "${ESMF_VERSION_STRING_GIT}") - message(STATUS "Detected ESMF Beta snapshot ${ESMF_BETA_SNAPSHOT}") + if(ESMF_VERSION_STRING_GIT MATCHES "^ESMF.*beta_snapshot") + set(ESMF_BETA_SNAPSHOT ${ESMF_VERSION_STRING_GIT}) + elseif(ESMF_VERSION_STRING_GIT MATCHES "^v.\..\..b") + set(ESMF_BETA_SNAPSHOT ${ESMF_VERSION_STRING_GIT}) + else() + set(ESMF_BETA_SNAPSHOT 0) + endif() + message(STATUS "Detected ESMF Beta snapshot: ${ESMF_BETA_SNAPSHOT}") endif() set(ESMF_VERSION "${ESMF_VERSION_MAJOR}.${ESMF_VERSION_MINOR}.${ESMF_VERSION_PATCH}") - separate_arguments(ESMF_F90COMPILEPATHS NATIVE_COMMAND ${ESMF_F90COMPILEPATHS}) - foreach(ITEM ${ESMF_F90COMPILEPATHS}) - string(REGEX REPLACE "^-I" "" ITEM "${ITEM}") - list(APPEND tmp ${ITEM}) - endforeach() - set(ESMF_F90COMPILEPATHS ${tmp}) - - # Look for static library, if not found try dynamic library - find_library(esmf_lib NAMES libesmf.a PATHS ${ESMF_LIBSDIR}) - if(esmf_lib MATCHES "esmf_lib-NOTFOUND") - unset(esmf_lib) - message(STATUS "Static ESMF library not found, searching for dynamic library instead") - find_library(esmf_lib NAMES esmf_fullylinked libesmf.so PATHS ${ESMF_LIBSDIR}) - if(esmf_lib MATCHES "esmf_lib-NOTFOUND") - unset(esmf_lib) - message(STATUS "Neither the dynamic nor the static ESMF library was found") - else() - set(_library_type SHARED) + # Find the ESMF library + if(USE_ESMF_STATIC_LIBS) + find_library(ESMF_LIBRARY_LOCATION NAMES libesmf.a PATHS ${ESMF_LIBSDIR} NO_DEFAULT_PATH) + if(ESMF_LIBRARY_LOCATION MATCHES "ESMF_LIBRARY_LOCATION-NOTFOUND") + message(WARNING "Static ESMF library (libesmf.a) not found in \ + ${ESMF_LIBSDIR}. Try setting USE_ESMF_STATIC_LIBS=OFF") + endif() + if(NOT TARGET ESMF::ESMF) + add_library(ESMF::ESMF STATIC IMPORTED) endif() else() - set(_library_type STATIC) + find_library(ESMF_LIBRARY_LOCATION NAMES esmf PATHS ${ESMF_LIBSDIR} NO_DEFAULT_PATH) + if(ESMF_LIBRARY_LOCATION MATCHES "ESMF_LIBRARY_LOCATION-NOTFOUND") + message(WARNING "ESMF library not found in ${ESMF_LIBSDIR}.") + endif() + if(NOT TARGET ESMF::ESMF) + add_library(ESMF::ESMF UNKNOWN IMPORTED) + endif() endif() - string(STRIP "${ESMF_F90ESMFLINKRPATHS} ${ESMF_F90ESMFLINKPATHS} ${ESMF_F90LINKPATHS} ${ESMF_F90LINKLIBS} ${ESMF_F90LINKOPTS}" ESMF_INTERFACE_LINK_LIBRARIES) - set(ESMF_LIBRARY_LOCATION ${esmf_lib}) + # Add ESMF as an alias to ESMF::ESMF for backward compatibility + if(NOT TARGET ESMF) + add_library(ESMF ALIAS ESMF::ESMF) + endif() -else() + # Add ESMF include directories + set(ESMF_INCLUDE_DIRECTORIES "") + separate_arguments(_ESMF_F90COMPILEPATHS UNIX_COMMAND ${ESMF_F90COMPILEPATHS}) + foreach(_ITEM ${_ESMF_F90COMPILEPATHS}) + string(REGEX REPLACE "^-I" "" _ITEM "${_ITEM}") + list(APPEND ESMF_INCLUDE_DIRECTORIES ${_ITEM}) + endforeach() - message(WARNING "ESMFMKFILE ${ESMFMKFILE} does not exist") + # Add ESMF link libraries + string(STRIP "${ESMF_F90LINKRPATHS} ${ESMF_F90ESMFLINKRPATHS} ${ESMF_F90ESMFLINKPATHS} ${ESMF_F90LINKPATHS} ${ESMF_F90LINKLIBS} ${ESMF_F90LINKOPTS}" ESMF_INTERFACE_LINK_LIBRARIES) -endif() + # Finalize find_package + include(FindPackageHandleStandardArgs) -## Finalize find_package -include(FindPackageHandleStandardArgs) - -find_package_handle_standard_args( - ${CMAKE_FIND_PACKAGE_NAME} - REQUIRED_VARS ESMF_LIBRARY_LOCATION - ESMF_INTERFACE_LINK_LIBRARIES - ESMF_F90COMPILEPATHS - VERSION_VAR ESMF_VERSION) - -## If ESMF is found create imported library target -if(ESMF_FOUND) - add_library(esmf ${_library_type} IMPORTED) - set_target_properties(esmf PROPERTIES - IMPORTED_LOCATION "${ESMF_LIBRARY_LOCATION}" - INTERFACE_INCLUDE_DIRECTORIES "${ESMF_F90COMPILEPATHS}" - INTERFACE_LINK_LIBRARIES "${ESMF_INTERFACE_LINK_LIBRARIES}") -endif() + find_package_handle_standard_args( + ${CMAKE_FIND_PACKAGE_NAME} + REQUIRED_VARS ESMF_LIBRARY_LOCATION + ESMF_INTERFACE_LINK_LIBRARIES + ESMF_F90COMPILEPATHS + VERSION_VAR ESMF_VERSION) + + set_target_properties(ESMF::ESMF PROPERTIES + IMPORTED_LOCATION "${ESMF_LIBRARY_LOCATION}" + INTERFACE_INCLUDE_DIRECTORIES "${ESMF_INCLUDE_DIRECTORIES}" + INTERFACE_LINK_LIBRARIES "${ESMF_INTERFACE_LINK_LIBRARIES}") + +else() + set(ESMF_FOUND FALSE CACHE BOOL "esmf.mk file NOT found" FORCE) + message(WARNING "ESMFMKFILE ${ESMFMKFILE} not found. Try setting ESMFMKFILE \ + to esmf.mk location.") +endif() \ No newline at end of file From 32c325d8b2cd3d1aa71f9314e464dc646f157898 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Mon, 17 Mar 2025 16:34:23 +1100 Subject: [PATCH 25/31] license --- CDEPS/CMakeLists.txt | 3 + .../datm_datamode_jra55do_mod.F90 | 3 + CDEPS/patches/atm_comp_nuopc.F90.patch | 3 + CMEPS/CMakeLists.txt | 3 + CMakeLists.txt | 3 + CMakePresets.json | 13 -- COPYRIGHT.txt | 13 ++ LICENSE | 201 ++++++++++++++++++ README.md | 13 +- cmake/Access3BinInstall.cmake | 3 + cmake/Access3LibInstall.cmake | 2 + cmake/Access3ShareConfig.cmake.in | 3 + cmake/AddPatchedSource.cmake | 3 + cmake/FortranLib.cmake | 3 + cmake/PatchFile.cmake | 3 + share/CMakeLists.txt | 2 + share/patches/nuopc_shr_methods.F90.patch | 3 + share/patches/shr_const_mod.F90.patch | 3 + 18 files changed, 258 insertions(+), 22 deletions(-) delete mode 100644 CMakePresets.json create mode 100644 COPYRIGHT.txt create mode 100644 LICENSE diff --git a/CDEPS/CMakeLists.txt b/CDEPS/CMakeLists.txt index 03b4050..ee04f21 100755 --- a/CDEPS/CMakeLists.txt +++ b/CDEPS/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. +# SPDX-License-Identifier: Apache-2.0 + ### Targets ## Common library diff --git a/CDEPS/extra_sources/datm_datamode_jra55do_mod.F90 b/CDEPS/extra_sources/datm_datamode_jra55do_mod.F90 index d97837b..53d6e49 100644 --- a/CDEPS/extra_sources/datm_datamode_jra55do_mod.F90 +++ b/CDEPS/extra_sources/datm_datamode_jra55do_mod.F90 @@ -1,3 +1,6 @@ +! Copyright ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. +! SPDX-License-Identifier: Apache-2.0 + module datm_datamode_jra55do_mod use ESMF , only : ESMF_State, ESMF_StateGet, ESMF_SUCCESS, ESMF_LogWrite, ESMF_LOGMSG_INFO diff --git a/CDEPS/patches/atm_comp_nuopc.F90.patch b/CDEPS/patches/atm_comp_nuopc.F90.patch index 3e8dd23..43ffb73 100644 --- a/CDEPS/patches/atm_comp_nuopc.F90.patch +++ b/CDEPS/patches/atm_comp_nuopc.F90.patch @@ -1,3 +1,6 @@ +# Copyright ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. +# SPDX-License-Identifier: Apache-2.0 + diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 index b74e0d3..bb31c22 100644 --- a/datm/atm_comp_nuopc.F90 diff --git a/CMEPS/CMakeLists.txt b/CMEPS/CMakeLists.txt index 0362d0f..a9fd274 100755 --- a/CMEPS/CMakeLists.txt +++ b/CMEPS/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. +# SPDX-License-Identifier: Apache-2.0 + ### Targets ## CMEPS library diff --git a/CMakeLists.txt b/CMakeLists.txt index a8f48f0..306dccd 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. +# SPDX-License-Identifier: Apache-2.0 + # This CMakeLists file has option: # ACCESS3_LIB_INSTALL: # If ON, then build libraries for the shared components (CMEPS/CDEPS/Share) diff --git a/CMakePresets.json b/CMakePresets.json deleted file mode 100644 index 70cb850..0000000 --- a/CMakePresets.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "version": 5, - "cmakeMinimumRequired": { - "major": 3, - "minor": 23, - "patch": 0 - }, - "include": [ - "cmake/CMakePresets-defaults.json", - "cmake/CMakePresets-compilers.json", - "cmake/CMakePresets-machines.json" - ] -} diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt new file mode 100644 index 0000000..63b00ed --- /dev/null +++ b/COPYRIGHT.txt @@ -0,0 +1,13 @@ + Copyright 2025 ACCESS-NRI + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f49a4e1 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/README.md b/README.md index a931c09..32f1d1e 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,11 @@ -                -

-[![Compilation Status](https://github.com/COSIMA/access-om3/actions/workflows/compilation.yml/badge.svg)](https://github.com/COSIMA/access-om3/actions/workflows/compilation.yml) +# ACCESS3-Share-OM3 -# ACCESS-OM3 +ACCESS3-Share repository contains the common tools for coupling the components of 3rd generation ACCESS earth system models. These are the framework for ACCESS-OM3 (an ocean and sea-ice model), ACCESS-ESM3 (a global climate model) and other ACCESS models. This repository contains a CMake based build system for the [Community Mediator for Earth Prediction Systems](https://github.com/ESCOMP/CMEPS/), the [Community Data Models for Earth Prediction Systems](https://github.com/ESCOMP/CDEPS/) and the [Community Earth System Model shared code](https://github.com/ESCOMP/CESM_share). -ACCESS-OM3 is a global coupled ocean - sea ice - wave model being developed by [COSIMA](http://www.cosima.org.au) and [ACCESS-NRI](https://www.access-nri.org.au/). -WARNING: this is a very early pre-release development version and doesn't yet work! +The contents of this repository are licensed under the _Apache 2.0_ license unless otherwise noted. For any submodules, please refer to the seperate repositories for license information. -# Downloading - -NCI-based users of ACCESS-OM3 typically won't need to download this repository, as there are pre-built executables available on NCI (see the [quick start](https://github.com/COSIMA/access-om3/wiki/Quick-start)). +NCI-based users of ACCESS-OM3 typically won't need to mess with this package. There are pre-built executables available on NCI and some [configurations](https://github.com/accESS-NRI/access-om3-configs). This respository contains submodules, so you will need to clone it with the `--recursive` flag: ``` diff --git a/cmake/Access3BinInstall.cmake b/cmake/Access3BinInstall.cmake index 31f729f..4a42762 100644 --- a/cmake/Access3BinInstall.cmake +++ b/cmake/Access3BinInstall.cmake @@ -1,3 +1,6 @@ +# Copyright ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. +# SPDX-License-Identifier: Apache-2.0 + #[==============================================================================[ # Options # #]==============================================================================] diff --git a/cmake/Access3LibInstall.cmake b/cmake/Access3LibInstall.cmake index f878c51..f21dcfc 100644 --- a/cmake/Access3LibInstall.cmake +++ b/cmake/Access3LibInstall.cmake @@ -1,3 +1,5 @@ +# Copyright ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. +# SPDX-License-Identifier: Apache-2.0 include(CMakePackageConfigHelpers) diff --git a/cmake/Access3ShareConfig.cmake.in b/cmake/Access3ShareConfig.cmake.in index 13c3dde..ff7fb90 100755 --- a/cmake/Access3ShareConfig.cmake.in +++ b/cmake/Access3ShareConfig.cmake.in @@ -1,3 +1,6 @@ +# Copyright ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. +# SPDX-License-Identifier: Apache-2.0 + @PACKAGE_INIT@ if(NOT Access3Share_FIND_QUIETLY) diff --git a/cmake/AddPatchedSource.cmake b/cmake/AddPatchedSource.cmake index 6a54755..5859442 100644 --- a/cmake/AddPatchedSource.cmake +++ b/cmake/AddPatchedSource.cmake @@ -1,3 +1,6 @@ +# Copyright ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. +# SPDX-License-Identifier: Apache-2.0 + # Apply a patch to a source file and add the resulting file to the sources of a # given target. function(add_patched_source TARGET FILE) diff --git a/cmake/FortranLib.cmake b/cmake/FortranLib.cmake index 08bcccb..ddab739 100644 --- a/cmake/FortranLib.cmake +++ b/cmake/FortranLib.cmake @@ -1,3 +1,6 @@ +# Copyright ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. +# SPDX-License-Identifier: Apache-2.0 + function(add_fortran_library LIB MOD_DIR) add_library(${LIB} ${ARGN}) diff --git a/cmake/PatchFile.cmake b/cmake/PatchFile.cmake index 7f83ad1..c6d1738 100644 --- a/cmake/PatchFile.cmake +++ b/cmake/PatchFile.cmake @@ -1,3 +1,6 @@ +# Copyright ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. +# SPDX-License-Identifier: Apache-2.0 + # use GNU Patch from any platform if(WIN32) diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index 2822697..622693f 100755 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -1,3 +1,5 @@ +# Copyright ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. +# SPDX-License-Identifier: Apache-2.0 ## share library add_fortran_library(share mod/share STATIC) diff --git a/share/patches/nuopc_shr_methods.F90.patch b/share/patches/nuopc_shr_methods.F90.patch index afe9086..70a4f80 100644 --- a/share/patches/nuopc_shr_methods.F90.patch +++ b/share/patches/nuopc_shr_methods.F90.patch @@ -1,3 +1,6 @@ +# Copyright ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. +# SPDX-License-Identifier: Apache-2.0 + diff --git a/src/nuopc_shr_methods.F90 b/src/nuopc_shr_methods.F90 index 07cf7e5..8bdf11f 100644 --- a/src/nuopc_shr_methods.F90 diff --git a/share/patches/shr_const_mod.F90.patch b/share/patches/shr_const_mod.F90.patch index b1b0b64..c72cf29 100644 --- a/share/patches/shr_const_mod.F90.patch +++ b/share/patches/shr_const_mod.F90.patch @@ -1,3 +1,6 @@ +# Copyright ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. +# SPDX-License-Identifier: Apache-2.0 + diff --git a/src/shr_const_mod.F90 b/src/shr_const_mod.F90 index 8437190..9696c81 100644 --- shr_const_mod.F90.old From b7a718d41a61c2a137614a013ef6c6075e330170 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Tue, 18 Mar 2025 13:42:38 +1100 Subject: [PATCH 26/31] rm workflows --- .github/workflows/compilation.yml | 33 ----------------------- .github/workflows/model-build-test-ci.yml | 15 ----------- CMakeLists.txt | 1 - 3 files changed, 49 deletions(-) delete mode 100644 .github/workflows/compilation.yml delete mode 100644 .github/workflows/model-build-test-ci.yml diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml deleted file mode 100644 index 2171fb9..0000000 --- a/.github/workflows/compilation.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: compilation - -on: - push: - -jobs: - compilation: - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - compiler: [gcc] - build_type: [Debug, Release] - - container: - image: ghcr.io/cosima/access-om3-ci-images/${{matrix.compiler}}:main - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Configure CMake - env: - FC: mpifort - CC: mpicc - run: . /etc/profile && cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_VERBOSE_MAKEFILE=ON -DACCESS3_LIB_INSTALL=TRUE - - - name: Build - # Build your program with the given configuration - run: . /etc/profile && cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} diff --git a/.github/workflows/model-build-test-ci.yml b/.github/workflows/model-build-test-ci.yml deleted file mode 100644 index 5c36727..0000000 --- a/.github/workflows/model-build-test-ci.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Test model build - -on: - workflow_dispatch: - pull_request: - push: - branches: - - "main" - -jobs: - build: - name: Build ${{ github.repository }} via spack - uses: access-nri/build-ci/.github/workflows/model-1-build.yml@main - permissions: - packages: read \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 306dccd..1e90f0b 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,7 +85,6 @@ set(CMAKE_INSTALL_MODULEDIR ${CMAKE_INSTALL_INCLUDEDIR} # Find dependencies find_package(MPI REQUIRED) - find_package(ESMF 8.3.0 MODULE REQUIRED) #[==============================================================================[ From 56bede8a7fd8856657f55df4da7c2d2a1d3abf3d Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Wed, 19 Mar 2025 14:58:22 +1100 Subject: [PATCH 27/31] permissions and tidy comments --- CDEPS/CMakeLists.txt | 0 CMEPS/CMakeLists.txt | 0 CMakeLists.txt | 12 ++++++------ README.md | 5 ++--- 4 files changed, 8 insertions(+), 9 deletions(-) mode change 100755 => 100644 CDEPS/CMakeLists.txt mode change 100755 => 100644 CMEPS/CMakeLists.txt mode change 100755 => 100644 CMakeLists.txt diff --git a/CDEPS/CMakeLists.txt b/CDEPS/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/CMEPS/CMakeLists.txt b/CMEPS/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100755 new mode 100644 index 1e90f0b..6406f18 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,11 @@ # Copyright ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. # SPDX-License-Identifier: Apache-2.0 -# This CMakeLists file has option: +# This CMakeLists file has an option to control what to build: # ACCESS3_LIB_INSTALL: # If ON, then build libraries for the shared components (CMEPS/CDEPS/Share) -# If OFF, then build ACCESS-OM3 using CMEPS code and linked to model components (built elsewhere). +# If OFF, then build ACCESS-OM3 using CMEPS code and linked to model components (built elsewhere). +# Build components are set through the KnownConfigurations CMAKE variable # This can be extended to included CM3 by linking against the UM libraries built with nuopc/cmeps driver. cmake_minimum_required(VERSION 3.18) @@ -15,9 +16,9 @@ cmake_minimum_required(VERSION 3.18) #]==============================================================================] project(Access3Share - HOMEPAGE_URL https://github.com/access-nri/access3-share - DESCRIPTION "Dependencies for global climate models" - LANGUAGES C Fortran) + HOMEPAGE_URL https://github.com/access-nri/access3-share + DESCRIPTION "Dependencies for global climate models" + LANGUAGES C Fortran) #[==============================================================================[ # Options # @@ -96,6 +97,5 @@ find_package(ESMF 8.3.0 MODULE REQUIRED) if(ACCESS3_LIB_INSTALL) include(Access3LibInstall) else() - # OM3 executables include(Access3BinInstall) endif() \ No newline at end of file diff --git a/README.md b/README.md index 32f1d1e..9c8a201 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ -# ACCESS3-Share-OM3 +# ACCESS3-Share ACCESS3-Share repository contains the common tools for coupling the components of 3rd generation ACCESS earth system models. These are the framework for ACCESS-OM3 (an ocean and sea-ice model), ACCESS-ESM3 (a global climate model) and other ACCESS models. This repository contains a CMake based build system for the [Community Mediator for Earth Prediction Systems](https://github.com/ESCOMP/CMEPS/), the [Community Data Models for Earth Prediction Systems](https://github.com/ESCOMP/CDEPS/) and the [Community Earth System Model shared code](https://github.com/ESCOMP/CESM_share). - The contents of this repository are licensed under the _Apache 2.0_ license unless otherwise noted. For any submodules, please refer to the seperate repositories for license information. NCI-based users of ACCESS-OM3 typically won't need to mess with this package. There are pre-built executables available on NCI and some [configurations](https://github.com/accESS-NRI/access-om3-configs). @@ -24,4 +23,4 @@ to update all the submodules. # Further information (including building and running the model) -See the [ACCESS-OM3 wiki](https://github.com/COSIMA/access-om3/wiki), particularly the [quick start](https://github.com/COSIMA/access-om3/wiki/Quick-start). +See the [ACCESS-OM3 configurations](https://github.com/accESS-NRI/access-om3-configs) From db7726a75de14a02acb3ee09efe6b3adf8db5c5e Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Thu, 20 Mar 2025 12:11:51 +1100 Subject: [PATCH 28/31] make more deps avaialble for linking later --- CDEPS/CMakeLists.txt | 14 +++++++------- CMEPS/CMakeLists.txt | 4 ++-- cmake/Access3BinInstall.cmake | 4 ++-- cmake/Access3LibInstall.cmake | 5 ++++- cmake/Access3ShareConfig.cmake.in | 6 ++---- share/CMakeLists.txt | 6 +++--- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/CDEPS/CMakeLists.txt b/CDEPS/CMakeLists.txt index ee04f21..785c1eb 100644 --- a/CDEPS/CMakeLists.txt +++ b/CDEPS/CMakeLists.txt @@ -8,8 +8,8 @@ add_fortran_library(ACCESS3_cdeps_common mod/common STATIC) add_library(Access3::cdeps_common ALIAS ACCESS3_cdeps_common) target_include_directories(ACCESS3_cdeps_common PRIVATE $) target_link_libraries(ACCESS3_cdeps_common - PUBLIC esmf - PRIVATE Access3::share Access3::cmeps Access3::nuopc_cap_share FoX::FoX PIO::PIO_Fortran + PUBLIC ESMF::ESMF + PRIVATE Access3::share Access3::cmeps Access3::nuopc_cap_share FoX::FoX ) target_sources(ACCESS3_cdeps_common PRIVATE CDEPS/streams/dshr_methods_mod.F90 @@ -27,7 +27,7 @@ add_fortran_library(ACCESS3_cdeps_datm mod/datm STATIC) add_library(Access3::cdeps_datm ALIAS ACCESS3_cdeps_datm) target_include_directories(ACCESS3_cdeps_datm PRIVATE $) target_link_libraries(ACCESS3_cdeps_datm - PUBLIC esmf + PUBLIC ESMF::ESMF PRIVATE Access3::cdeps_common Access3::share ) target_sources(ACCESS3_cdeps_datm PRIVATE @@ -48,7 +48,7 @@ add_fortran_library(ACCESS3_cdeps_docn mod/docn STATIC) add_library(Access3::cdeps_docn ALIAS ACCESS3_cdeps_docn) target_include_directories(ACCESS3_cdeps_docn PRIVATE $) target_link_libraries(ACCESS3_cdeps_docn - PUBLIC esmf + PUBLIC ESMF::ESMF PRIVATE Access3::cdeps_common Access3::share ) target_sources(ACCESS3_cdeps_docn PRIVATE @@ -68,7 +68,7 @@ add_fortran_library(ACCESS3_cdeps_dice mod/dice STATIC) add_library(Access3::cdeps_dice ALIAS ACCESS3_cdeps_dice) target_include_directories(ACCESS3_cdeps_dice PRIVATE $) target_link_libraries(ACCESS3_cdeps_dice - PUBLIC esmf + PUBLIC ESMF::ESMF PRIVATE Access3::cdeps_common Access3::share ) target_sources(ACCESS3_cdeps_dice PRIVATE @@ -82,7 +82,7 @@ add_fortran_library(ACCESS3_cdeps_dwav mod/dwav STATIC) add_library(Access3::cdeps_dwav ALIAS ACCESS3_cdeps_dwav) target_include_directories(ACCESS3_cdeps_dwav PRIVATE $) target_link_libraries(ACCESS3_cdeps_dwav - PUBLIC esmf + PUBLIC ESMF::ESMF PRIVATE Access3::cdeps_common Access3::share ) target_sources(ACCESS3_cdeps_dwav PRIVATE @@ -94,7 +94,7 @@ add_fortran_library(ACCESS3_cdeps_drof mod/drof STATIC) add_library(Access3::cdeps_drof ALIAS ACCESS3_cdeps_drof) target_include_directories(ACCESS3_cdeps_drof PRIVATE $) target_link_libraries(ACCESS3_cdeps_drof - PUBLIC esmf + PUBLIC ESMF::ESMF PRIVATE Access3::cdeps_common Access3::share ) target_sources(ACCESS3_cdeps_drof PRIVATE diff --git a/CMEPS/CMakeLists.txt b/CMEPS/CMakeLists.txt index a9fd274..9d628e4 100644 --- a/CMEPS/CMakeLists.txt +++ b/CMEPS/CMakeLists.txt @@ -7,7 +7,7 @@ add_fortran_library(ACCESS3_cmeps mod/cmeps STATIC) add_library(Access3::cmeps ALIAS ACCESS3_cmeps) target_link_libraries(ACCESS3_cmeps - PUBLIC esmf + PUBLIC ESMF::ESMF PRIVATE Access3::nuopc_cap_share Access3::share Access3::timing ) if(OpenMP_Fortran_FOUND) @@ -55,7 +55,7 @@ target_sources(ACCESS3_cmeps PRIVATE add_fortran_library(ACCESS3_nuopc_cap_share mod/nuopc_cap_share STATIC) add_library(Access3::nuopc_cap_share ALIAS ACCESS3_nuopc_cap_share) target_link_libraries(ACCESS3_nuopc_cap_share - PUBLIC esmf + PUBLIC ESMF::ESMF PRIVATE Access3::share ) target_sources(ACCESS3_nuopc_cap_share PRIVATE diff --git a/cmake/Access3BinInstall.cmake b/cmake/Access3BinInstall.cmake index 4a42762..07d3fd7 100644 --- a/cmake/Access3BinInstall.cmake +++ b/cmake/Access3BinInstall.cmake @@ -82,7 +82,7 @@ foreach(CONF IN LISTS BuildConfigurations) CMEPS/CMEPS/cesm/driver/esm_time_mod.F90 ) target_link_libraries(OM3_cesm_driver_${CONF} - PUBLIC esmf + PUBLIC ESMF::ESMF PRIVATE ${ComponentsTargets} Access3::cdeps-drof Access3::cdeps-datm Access3::cmeps Access3::nuopc_cap_share Access3::share Access3::timing ) target_compile_definitions(OM3_cesm_driver_${CONF} PRIVATE MED_PRESENT @@ -95,7 +95,7 @@ foreach(CONF IN LISTS BuildConfigurations) ) add_executable(OM3_${CONF} CMEPS/CMEPS/cesm/driver/esmApp.F90) - target_link_libraries(OM3_${CONF} PRIVATE OM3_cesm_driver_${CONF} Access3::share esmf) + target_link_libraries(OM3_${CONF} PRIVATE OM3_cesm_driver_${CONF} Access3::share ESMF::ESMF) set_target_properties(OM3_${CONF} PROPERTIES LINKER_LANGUAGE Fortran diff --git a/cmake/Access3LibInstall.cmake b/cmake/Access3LibInstall.cmake index f21dcfc..39a3cc1 100644 --- a/cmake/Access3LibInstall.cmake +++ b/cmake/Access3LibInstall.cmake @@ -20,6 +20,9 @@ add_subdirectory(CDEPS) # Mediator component (CMEPS) add_subdirectory(CMEPS) +# make some common deps available +target_link_libraries(share PUBLIC ESMF::ESMF PIO::PIO_Fortran PIO::PIO_C NetCDF::NetCDF_Fortran NetCDF::NetCDF_C) + # Install/Export # Note that the installation of some components is done in the corresponding subdirectory @@ -28,7 +31,7 @@ configure_package_config_file( ${CMAKE_CURRENT_BINARY_DIR}/Access3ShareConfig.cmake INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share ) -install(FILES ${CMAKE_SOURCE_DIR}/cmake/FindFoX.cmake ${CMAKE_SOURCE_DIR}/cmake/FindNetCDF.cmake ${CMAKE_SOURCE_DIR}/cmake/FindPIO.cmake ${CMAKE_CURRENT_BINARY_DIR}/Access3ShareConfig.cmake +install(FILES ${CMAKE_SOURCE_DIR}/cmake/FindFoX.cmake ${CMAKE_SOURCE_DIR}/cmake/FindNetCDF.cmake ${CMAKE_SOURCE_DIR}/cmake/FindPIO.cmake ${CMAKE_SOURCE_DIR}/cmake/FindESMF.cmake ${CMAKE_CURRENT_BINARY_DIR}/Access3ShareConfig.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Access3Share COMPONENT Access3Share ) \ No newline at end of file diff --git a/cmake/Access3ShareConfig.cmake.in b/cmake/Access3ShareConfig.cmake.in index ff7fb90..5abbca3 100755 --- a/cmake/Access3ShareConfig.cmake.in +++ b/cmake/Access3ShareConfig.cmake.in @@ -60,11 +60,9 @@ if (cdeps IN_LIST _required_components) find_dependency(FoX) endif() -if (NOT TARGET PIO::PIO_Fortran) - find_package(PIO 2.5.3 REQUIRED COMPONENTS C Fortran) -endif() - +find_package(PIO 2.5.3 REQUIRED COMPONENTS C Fortran) find_package(NetCDF 4.7.3 REQUIRED Fortran) +find_package(ESMF 8.3.0 MODULE REQUIRED) list(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index 622693f..91c12ab 100755 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -11,8 +11,8 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") target_compile_definitions(share PRIVATE CPRINTEL NAMING=_ADD_UNDERSCORE FORTRANUNDERSCORE) endif() target_link_libraries(share - PUBLIC esmf PIO::PIO_Fortran - PRIVATE Access3::timing + PUBLIC ESMF::ESMF + PRIVATE Access3::timing PIO::PIO_Fortran ) target_sources(share PRIVATE # The following files are generated with a script acting on templates @@ -64,7 +64,7 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") target_compile_definitions(ACCESS3_timing PRIVATE CPRINTEL NAMING=_ADD_UNDERSCORE FORTRANUNDERSCORE) endif() -target_link_libraries(ACCESS3_timing PRIVATE esmf) +target_link_libraries(ACCESS3_timing PRIVATE ESMF::ESMF) target_sources(ACCESS3_timing PRIVATE timing/f_wrappers.c timing/gptl.c From 70e5c763f0d0d122a9043430ee37c3162005545b Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Fri, 28 Mar 2025 09:06:37 +1100 Subject: [PATCH 29/31] code version note --- cmake/Access3LibInstall.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/Access3LibInstall.cmake b/cmake/Access3LibInstall.cmake index 39a3cc1..172a14a 100644 --- a/cmake/Access3LibInstall.cmake +++ b/cmake/Access3LibInstall.cmake @@ -7,7 +7,8 @@ include(CMakePackageConfigHelpers) find_package(FoX 4.1.2 REQUIRED) find_package(PIO 2.5.3 REQUIRED COMPONENTS C Fortran) -find_package(NetCDF 4.7.3 REQUIRED Fortran) +find_package(NetCDF 4.7.3 REQUIRED C Fortran) +# Code has not been tested with older PIO/NetCDF versions , but probably still works fine # Main definitions From ada3dc58a5c8fcf133ff30d1d247f9a880512857 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Fri, 28 Mar 2025 09:08:18 +1100 Subject: [PATCH 30/31] make sure C Netcdf C is required --- cmake/Access3ShareConfig.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Access3ShareConfig.cmake.in b/cmake/Access3ShareConfig.cmake.in index 5abbca3..51e4d18 100755 --- a/cmake/Access3ShareConfig.cmake.in +++ b/cmake/Access3ShareConfig.cmake.in @@ -61,7 +61,7 @@ if (cdeps IN_LIST _required_components) endif() find_package(PIO 2.5.3 REQUIRED COMPONENTS C Fortran) -find_package(NetCDF 4.7.3 REQUIRED Fortran) +find_package(NetCDF 4.7.3 REQUIRED C Fortran) find_package(ESMF 8.3.0 MODULE REQUIRED) list(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) From e6277a17a95eafd75c22f530bcea6e00362addaf Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Fri, 28 Mar 2025 09:08:41 +1100 Subject: [PATCH 31/31] This change is based on the https://github.com/cOSIMA/access-om3 build system Co-authored-by: Micael Oliveira