Skip to content

Commit

Permalink
Updated the recipe with the latest cmake changes
Browse files Browse the repository at this point in the history
  • Loading branch information
makepath-alex committed Jan 7, 2025
1 parent 72eae7a commit 9d38980
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 43 deletions.
27 changes: 11 additions & 16 deletions recipes/rte-rrtmgp/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@
setlocal ENABLEEXTENSIONS

set BUILD_DIR=build

set BUILD_TYPE=Debug
set RRTMGP_DATA_VERSION=v1.8.2
set FP_MODEL=DP
set RTE_CBOOL=ON
set ENABLE_TESTS=ON
set RTE_KERNELS=default
set FAILURE_THRESHOLD=7.e-4

set FCFLAGS="-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fmodule-private -fimplicit-none -finit-real=nan -fbacktrace"
set BUILD_TYPE=Release

set "HOST=x86_64-w64-mingw32"
set "FC=%HOST%-gfortran.exe"
set FCFLAGS="-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fmodule-private -fimplicit-none -finit-real=nan -fbacktrace"

set BUILD_TESTING=ON
set RTE_ENABLE_SP=OFF
set KERNEL_MODE=default
set FAILURE_THRESHOLD='7.e-4'

:: Ensure the directories exist
if not exist %BUILD_DIR% mkdir %BUILD_DIR%
Expand All @@ -26,15 +23,13 @@ if not exist %PREFIX%/include mkdir %PREFIX%/include
:: 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% ^
-DRRTMGP_DATA_VERSION=%RRTMGP_DATA_VERSION% ^
-DPRECISION=%FP_MODEL% ^
-DUSE_C_BOOL=%RTE_CBOOL% ^
-DKERNEL_MODE=%RTE_KERNELS% ^
-DENABLE_TESTS=%ENABLE_TESTS% ^
-DRTE_ENABLE_SP=%RTE_ENABLE_SP% ^
-DKERNEL_MODE=%KERNEL_MODE% ^
-DBUILD_TESTING=%BUILD_TESTING% ^
-DFAILURE_THRESHOLD=%FAILURE_THRESHOLD% ^
-DCMAKE_BUILD_TYPE=%BUILD_TYPE% ^
-G Ninja

:: Compile
Expand Down
38 changes: 17 additions & 21 deletions recipes/rte-rrtmgp/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
set -e

BUILD_DIR=build
BUILD_TYPE=Release

BUILD_TYPE=Debug
RRTMGP_DATA_VERSION=v1.8.2
FP_MODEL=DP
RTE_CBOOL=ON
ENABLE_TESTS=ON
RTE_KERNELS=default
FAILURE_THRESHOLD=7.e-4
FFLAGS='-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fmodule-private -fimplicit-none -finit-real=nan'

FCFLAGS="-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fmodule-private -fimplicit-none -finit-real=nan -fbacktrace"
BUILD_TESTING=ON
RTE_ENABLE_SP=OFF
KERNEL_MODE=default
FAILURE_THRESHOLD='7.e-4'

# Ensure the directories exist
mkdir -p "${BUILD_DIR}"
Expand All @@ -21,24 +19,22 @@ mkdir -p $PREFIX/include

# Note: $CMAKE_ARGS is automatically provided by conda-forge.
# It sets default paths and platform-independent CMake arguments.
cmake -S . -B "${BUILD_DIR}" \
cmake -S . -B ${BUILD_DIR} \
${CMAKE_ARGS} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_Fortran_COMPILER=${FC} \
-DCMAKE_Fortran_FLAGS="${FCFLAGS}" \
-DRRTMGP_DATA_VERSION=${RRTMGP_DATA_VERSION} \
-DPRECISION=${FP_MODEL} \
-DUSE_C_BOOL=${RTE_CBOOL} \
-DKERNEL_MODE=${RTE_KERNELS} \
-DENABLE_TESTS=${ENABLE_TESTS} \
-DFAILURE_THRESHOLD=${FAILURE_THRESHOLD} \
-DCMAKE_Fortran_COMPILER=$FC \
-DCMAKE_Fortran_FLAGS="$FFLAGS" \
-DRTE_ENABLE_SP=$RTE_ENABLE_SP \
-DKERNEL_MODE=$KERNEL_MODE \
-DBUILD_TESTING=$BUILD_TESTING \
-DFAILURE_THRESHOLD=$FAILURE_THRESHOLD \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-G Ninja

# Compile
cmake --build "${BUILD_DIR}" --parallel
cmake --build ${BUILD_DIR} --parallel

# Install the necessery files into the package
cmake --install "${BUILD_DIR}" --prefix "${PREFIX}"
cmake --install ${BUILD_DIR} --prefix "${PREFIX}"

# Run tests
ctest --output-on-failure --test-dir "${BUILD_DIR}" -V
ctest --output-on-failure --test-dir ${BUILD_DIR} -V
8 changes: 2 additions & 6 deletions recipes/rte-rrtmgp/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ 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: efc20fa0310ff337bf862414dd706a558186d236059b98ae2eac82f522a4efb6
url: https://github.com/makepath-alex/rte-rrtmgp/archive/refs/heads/conda-recipe-dev.zip
sha256: 2d45e38b17dc676546066f6885a1af0f8c7f9bfe075673ddcae1e70dce7cc4bc

build:
number: 0
Expand Down Expand Up @@ -53,9 +53,7 @@ test:
- 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
Expand All @@ -65,9 +63,7 @@ outputs:
- include/rte_kernels.h
- include/rte_types.h
- lib/librrtmgp.a
- lib/librrtmgpkernels.a
- lib/librte.a
- lib/librtekernels.a

about:
home: https://github.com/earth-system-radiation/rte-rrtmgp
Expand Down

0 comments on commit 9d38980

Please sign in to comment.