diff --git a/recipes/rte-rrtmgp/bld.bat b/recipes/rte-rrtmgp/bld.bat index 2ad241f360fe1..14400009eec5b 100644 --- a/recipes/rte-rrtmgp/bld.bat +++ b/recipes/rte-rrtmgp/bld.bat @@ -2,6 +2,8 @@ :: Stop on any error setlocal ENABLEEXTENSIONS +set BUILD_DIR=build + set BUILD_TYPE=Debug set RRTMGP_DATA_VERSION=v1.8.2 set FP_MODEL=DP @@ -15,12 +17,15 @@ set FCFLAGS="-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-chec set "HOST=x86_64-w64-mingw32" set "FC=%HOST%-gfortran.exe" -:: CMake configuration -mkdir build -cd build +:: Ensure the directories exist +if not exist %BUILD_DIR% mkdir %BUILD_DIR% +if not exist %PREFIX%/lib mkdir %PREFIX%/lib +if not exist %PREFIX%/include mkdir %PREFIX%/include -:: Note: %CMAKE_ARGS% is automatically provided by conda-forge. -cmake %CMAKE_ARGS% ^ +:: Note: $CMAKE_ARGS is automatically provided by conda-forge. +:: It sets default paths and platform-independent CMake arguments. +cmake -S . -B %BUILD_DIR% ^ + %CMAKE_ARGS% ^ -DCMAKE_BUILD_TYPE=%BUILD_TYPE% ^ -DCMAKE_Fortran_COMPILER=%FC% ^ -DCMAKE_Fortran_FLAGS=%FCFLAGS% ^ @@ -30,18 +35,13 @@ cmake %CMAKE_ARGS% ^ -DKERNEL_MODE=%RTE_KERNELS% ^ -DENABLE_TESTS=%ENABLE_TESTS% ^ -DFAILURE_THRESHOLD=%FAILURE_THRESHOLD% ^ - -G Ninja .. + -G Ninja :: Compile -cmake --build . -- -j%NUMBER_OF_PROCESSORS% - -:: Run tests -ctest --output-on-failure --test-dir . -V +cmake --build %BUILD_DIR% --parallel -:: Manually copy libraries, binaries, and Fortran module files to %PREFIX% -xcopy /s /y rte-kernels\*.a %PREFIX%\lib\ -xcopy /s /y rte-frontend\*.a %PREFIX%\lib\ -xcopy /s /y rrtmgp-kernels\*.a %PREFIX%\lib\ -xcopy /s /y rrtmgp-frontend\*.a %PREFIX%\lib\ -xcopy /s /y modules\*.mod %PREFIX%\include\ +:: Install the necessery files into the package +cmake --install %BUILD_DIR% --prefix %PREFIX% +:: Run tests +ctest --output-on-failure --test-dir %BUILD_DIR% -V diff --git a/recipes/rte-rrtmgp/build.sh b/recipes/rte-rrtmgp/build.sh index 438149be2b725..ab40eda1bf5d3 100644 --- a/recipes/rte-rrtmgp/build.sh +++ b/recipes/rte-rrtmgp/build.sh @@ -2,6 +2,8 @@ # Stop on any error set -e +BUILD_DIR=build + BUILD_TYPE=Debug RRTMGP_DATA_VERSION=v1.8.2 FP_MODEL=DP @@ -12,13 +14,15 @@ FAILURE_THRESHOLD=7.e-4 FCFLAGS="-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fmodule-private -fimplicit-none -finit-real=nan -fbacktrace" -# CMake configuration -mkdir -p build -cd build +# Ensure the directories exist +mkdir -p "${BUILD_DIR}" +mkdir -p $PREFIX/lib +mkdir -p $PREFIX/include # Note: $CMAKE_ARGS is automatically provided by conda-forge. # It sets default paths and platform-independent CMake arguments. -cmake ${CMAKE_ARGS} \ +cmake -S . -B "${BUILD_DIR}" \ + ${CMAKE_ARGS} \ -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -DCMAKE_Fortran_COMPILER=${FC} \ -DCMAKE_Fortran_FLAGS="${FCFLAGS}" \ @@ -28,21 +32,13 @@ cmake ${CMAKE_ARGS} \ -DKERNEL_MODE=${RTE_KERNELS} \ -DENABLE_TESTS=${ENABLE_TESTS} \ -DFAILURE_THRESHOLD=${FAILURE_THRESHOLD} \ - -G Ninja .. + -G Ninja # Compile -cmake --build . -- -j${CPU_COUNT} +cmake --build "${BUILD_DIR}" --parallel -# Run tests -ctest --output-on-failure --test-dir . -V +# Install the necessery files into the package +cmake --install "${BUILD_DIR}" --prefix "${PREFIX}" -# Manually copy libraries, binaries, and Fortran module files to $PREFIX -# Ensure the directories exist before copying -mkdir -p $PREFIX/lib -mkdir -p $PREFIX/include - -# Copy libraries -find $SRC_DIR/build/ -name "*.a" -exec cp {} $PREFIX/lib/ \; - -# Copy Fortran module files -find $SRC_DIR/build/modules -name "*.mod" -exec cp {} $PREFIX/include/ \; \ No newline at end of file +# Run tests +ctest --output-on-failure --test-dir "${BUILD_DIR}" -V diff --git a/recipes/rte-rrtmgp/meta.yaml b/recipes/rte-rrtmgp/meta.yaml index 0ad0be46c9362..bfc1fdb236ded 100644 --- a/recipes/rte-rrtmgp/meta.yaml +++ b/recipes/rte-rrtmgp/meta.yaml @@ -1,6 +1,5 @@ -{% set name = "rte_rrtmgp" %} -{% set version = "cmake.dev" %} - +{% set name = "rte-rrtmgp" %} +{% set version = "0.0.1" %} package: name: {{ name|lower }} @@ -9,7 +8,7 @@ package: source: # TODO: Set `makepath-cmake` to {{ version }} when we have real version url: https://github.com/makepath-alex/rte-rrtmgp/archive/refs/heads/conda-rec.zip - sha256: 6f89c13252cc494b97af043427e825d23a490dfec4378a4d619a8349b3918056 + sha256: efc20fa0310ff337bf862414dd706a558186d236059b98ae2eac82f522a4efb6 build: number: 0 @@ -50,15 +49,21 @@ test: commands: # Check if the files exists # Unix & Win (we build with mingw, so it generates .a files) - # - test -f $PREFIX/lib/librrtmgp.a - # - test -f $PREFIX/lib/librrtmgpkernels.a - # - test -f $PREFIX/lib/librte.a - # - test -f $PREFIX/lib/librtekernels.a + - test -f $PREFIX/include/rrtmgp_kernels.h + - test -f $PREFIX/include/rte_kernels.h + - test -f $PREFIX/include/rte_types.h + - test -f $PREFIX/lib/librrtmgp.a + - test -f $PREFIX/lib/librrtmgpkernels.a + - test -f $PREFIX/lib/librte.a + - test -f $PREFIX/lib/librtekernels.a outputs: - name: rte_rrtmgp files: # Unix & Win + - include/rrtmgp_kernels.h + - include/rte_kernels.h + - include/rte_types.h - lib/librrtmgp.a - lib/librrtmgpkernels.a - lib/librte.a