From de353993ecd24c70b4d86bcebb1ffa245c0794be Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Thu, 21 Sep 2023 14:07:54 -0700 Subject: [PATCH 1/4] Fix cmake config for non-_4 builds --- cmake/PackageConfig.cmake.in | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/cmake/PackageConfig.cmake.in b/cmake/PackageConfig.cmake.in index 86eed6e7..c63b4fb5 100644 --- a/cmake/PackageConfig.cmake.in +++ b/cmake/PackageConfig.cmake.in @@ -9,16 +9,25 @@ include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake") include(CMakeFindDependencyMacro) -# ON/OFF implies ip was compiled with/without OPENMP +find_dependency(sp CONFIG) + if(@OPENMP@) find_dependency(OpenMP COMPONENTS Fortran) endif() -find_dependency(sp CONFIG) +# The target name needs to be one that's built, even if the dependent +# build does not use that version. +if(@BUILD_4@) + set(precision 4) +elseif(@BUILD_D@) + set(precision d) +elseif(@BUILD_8@) + set(precision 8) +endif() -get_target_property(@PROJECT_NAME@_BUILD_TYPES @PROJECT_NAME@::@PROJECT_NAME@_4 IMPORTED_CONFIGURATIONS) +get_target_property(@PROJECT_NAME@_BUILD_TYPES @PROJECT_NAME@::@PROJECT_NAME@_${precision} IMPORTED_CONFIGURATIONS) check_required_components("@PROJECT_NAME@") -get_target_property(location @PROJECT_NAME@::@PROJECT_NAME@_4 LOCATION) +get_target_property(location @PROJECT_NAME@::@PROJECT_NAME@_${precision} LOCATION) message(STATUS "Found @PROJECT_NAME@: ${location} (found version \"@PROJECT_VERSION@\")") From f3faa29c3120486c4027d1c94d8cc4dba5a6276f Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Thu, 21 Sep 2023 14:10:48 -0700 Subject: [PATCH 2/4] Add variant checks to spack CI --- .github/workflows/Spack.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/Spack.yml b/.github/workflows/Spack.yml index eaecd5b9..4a0b1599 100644 --- a/.github/workflows/Spack.yml +++ b/.github/workflows/Spack.yml @@ -24,7 +24,7 @@ jobs: openmp: ["+openmp", "~openmp"] sharedlibs: ["+shared", "~shared"] pic: ["+pic", "~pic"] - precision: ["precision=d", "precision=4", "precision=8"] + precision: ["d", "4", "8"] runs-on: ${{ matrix.os }} steps: @@ -41,15 +41,16 @@ jobs: spack env create ip-env spack env activate ip-env cp $GITHUB_WORKSPACE/ip/spack/package.py $SPACK_ROOT/var/spack/repos/builtin/packages/ip/package.py - mv $GITHUB_WORKSPACE/ip $SPACK_ENV/ip - spack develop --no-clone ip@develop - spack add ip@develop%gcc@11 ${{ matrix.openmp }} ${{ matrix.sharedlibs }} ${{ matrix.pic }} ${{ matrix.precision }} target=x86_64 + spack develop --no-clone --path $GITHUB_WORKSPACE/ip ip@develop + spack add ip@develop%gcc@11 ${{ matrix.openmp }} ${{ matrix.sharedlibs }} ${{ matrix.pic }} precision=${{ matrix.precision }} target=x86_64 spack external find cmake gmake spack concretize # Run installation and run CTest suite spack install --verbose --fail-fast --test root - # Run 'spack load' to check for obvious errors in setup_run_environment + # Run 'spack load' and check that key build options were respected spack load ip + if [ ${{ matrix.sharedlibs }} == "+shared" ]; then suffix="so" ; else suffix="a"; fi + ls ${IP_LIB${{ matrix.precision }}} | grep -cE '/libip_${{ matrix.precision }}\.'$suffix'$' # This job validates the Spack recipe by making sure each cmake build option is represented recipe-check: From 7a488252b33b817db593f417fb1a6d3127abef06 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Thu, 21 Sep 2023 14:14:14 -0700 Subject: [PATCH 3/4] Add grib-util build-n-test to Spack CI --- .github/workflows/Spack.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/Spack.yml b/.github/workflows/Spack.yml index 4a0b1599..ffdc685d 100644 --- a/.github/workflows/Spack.yml +++ b/.github/workflows/Spack.yml @@ -43,6 +43,7 @@ jobs: cp $GITHUB_WORKSPACE/ip/spack/package.py $SPACK_ROOT/var/spack/repos/builtin/packages/ip/package.py spack develop --no-clone --path $GITHUB_WORKSPACE/ip ip@develop spack add ip@develop%gcc@11 ${{ matrix.openmp }} ${{ matrix.sharedlibs }} ${{ matrix.pic }} precision=${{ matrix.precision }} target=x86_64 + spack add grib-util@develop spack external find cmake gmake spack concretize # Run installation and run CTest suite From ee406d17a8e9dbb8f449a925de6032256b66b7eb Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Thu, 21 Sep 2023 14:33:39 -0700 Subject: [PATCH 4/4] Update Spack.yml --- .github/workflows/Spack.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Spack.yml b/.github/workflows/Spack.yml index ffdc685d..633850c6 100644 --- a/.github/workflows/Spack.yml +++ b/.github/workflows/Spack.yml @@ -43,7 +43,7 @@ jobs: cp $GITHUB_WORKSPACE/ip/spack/package.py $SPACK_ROOT/var/spack/repos/builtin/packages/ip/package.py spack develop --no-clone --path $GITHUB_WORKSPACE/ip ip@develop spack add ip@develop%gcc@11 ${{ matrix.openmp }} ${{ matrix.sharedlibs }} ${{ matrix.pic }} precision=${{ matrix.precision }} target=x86_64 - spack add grib-util@develop + if [ ${{ matrix.precision }} == "d" ]; then spack add grib-util@develop ; fi spack external find cmake gmake spack concretize # Run installation and run CTest suite