From 9edc8dee761901ccec1f97bc19792f1d0ceb0ea9 Mon Sep 17 00:00:00 2001 From: "Benjamin T. Johnson" Date: Mon, 29 Jul 2024 20:18:56 +0000 Subject: [PATCH 1/3] blindly copied over jedi-bundle CMakeLists.txt front material regarding RPATH, replacing ufs-bundle cmake prefix material. --- CMakeLists.txt | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8643d6..23fa1a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,26 +11,40 @@ find_package( ecbuild 3.5 REQUIRED HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CUR project( ufs-bundle VERSION 1.1.0 LANGUAGES C CXX Fortran ) -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +# Default release mode +set( ECBUILD_DEFAULT_BUILD_TYPE Release ) -include( ecbuild_bundle ) -include( GNUInstallDirs ) -set(CMAKE_INSTALL_LIBDIR "lib") +# Enable OpenMP and MPI +set( ENABLE_MPI ON CACHE BOOL "Compile with MPI" ) +set( ENABLE_OMP ON CACHE BOOL "Compile with OpenMP" ) +# Depend path for non-ecbuild packages set(DEPEND_LIB_ROOT ${CMAKE_CURRENT_BINARY_DIR}/Depends) list(APPEND CMAKE_PREFIX_PATH ${DEPEND_LIB_ROOT}) -message("prefix path is ${CMAKE_PREFIX_PATH}") -# Default release mode -set( ECBUILD_DEFAULT_BUILD_TYPE Release ) +# Library path for non-ecbuild packages +link_directories(${CMAKE_CURRENT_BINARY_DIR}/lib) + +include( GNUInstallDirs ) +if(APPLE) + list( APPEND CMAKE_INSTALL_RPATH $ENV{llvm_openmp_ROOT}/lib ) +endif() +list( APPEND CMAKE_INSTALL_RPATH ${CMAKE_CURRENT_BINARY_DIR}/fv3 ) -# Enable MPI -set( ENABLE_MPI ON CACHE BOOL "Compile with MPI") -set( ENABLE_OMP ON CACHE BOOL "Compile with OpenMP") +# add the automatically determined parts of the RPATH +# which point to directories outside the build tree to the install RPATH +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) -# Use external jedi-cmake or build in bundle +# when building, already use the install RPATH +set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) + +# Define bundle +ecbuild_bundle_initialize() + +# Use external jedi-cmake include( $ENV{jedi_cmake_ROOT}/share/jedicmake/Functions/git_functions.cmake ) + # ECMWF libs # ---------- # ecbuild_bundle( PROJECT eckit GIT "https://github.com/ecmwf/eckit.git" TAG 1.23.0 ) @@ -53,7 +67,7 @@ if(UFS_APP MATCHES "^(ATMAERO)$" OR UFS_APP MATCHES "^(S2S)$" OR UFS_APP MATCHES endif() # Use last known working tag until issues with new pure cmake build are resolved -ecbuild_bundle( PROJECT crtm GIT "https://github.com/JCSDA/CRTMv3.git" TAG v3.1.0-skylabv7 ) # BRANCH develop UPDATE ) +ecbuild_bundle( PROJECT crtm GIT "https://github.com/JCSDA/CRTMv3.git" BRANCH develop UPDATE ) option(ENABLE_IODA_DATA "Obtain ioda test data from ioda-data repository (vs tarball)" ON) ecbuild_bundle( PROJECT ioda-data GIT "https://github.com/JCSDA-internal/ioda-data.git" BRANCH develop UPDATE ) From 600781b64be42e96c4dd5b6aa6b72dea23a41ffe Mon Sep 17 00:00:00 2001 From: Benjamin Johnson <33431190+BenjaminTJohnson@users.noreply.github.com> Date: Tue, 17 Sep 2024 18:15:15 -0400 Subject: [PATCH 2/3] Update CMakeLists.txt removed a space Co-authored-by: Dom Heinzeller --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 23fa1a5..ddd9230 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,7 @@ if(UFS_APP MATCHES "^(ATMAERO)$" OR UFS_APP MATCHES "^(S2S)$" OR UFS_APP MATCHES endif() # Use last known working tag until issues with new pure cmake build are resolved -ecbuild_bundle( PROJECT crtm GIT "https://github.com/JCSDA/CRTMv3.git" BRANCH develop UPDATE ) +ecbuild_bundle( PROJECT crtm GIT "https://github.com/JCSDA/CRTMv3.git" BRANCH develop UPDATE ) option(ENABLE_IODA_DATA "Obtain ioda test data from ioda-data repository (vs tarball)" ON) ecbuild_bundle( PROJECT ioda-data GIT "https://github.com/JCSDA-internal/ioda-data.git" BRANCH develop UPDATE ) From 5ce79d2bab32fc36daf782d17f934261a9071f63 Mon Sep 17 00:00:00 2001 From: Benjamin Johnson <33431190+BenjaminTJohnson@users.noreply.github.com> Date: Tue, 17 Sep 2024 18:17:26 -0400 Subject: [PATCH 3/3] Update CMakeLists.txt removed append of RPATH with fv3 directory --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ddd9230..42a96cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,6 @@ include( GNUInstallDirs ) if(APPLE) list( APPEND CMAKE_INSTALL_RPATH $ENV{llvm_openmp_ROOT}/lib ) endif() -list( APPEND CMAKE_INSTALL_RPATH ${CMAKE_CURRENT_BINARY_DIR}/fv3 ) # add the automatically determined parts of the RPATH # which point to directories outside the build tree to the install RPATH