Skip to content

Commit

Permalink
Update with the new install step
Browse files Browse the repository at this point in the history
  • Loading branch information
makepath-alex committed Jan 7, 2025
1 parent 9a6fa1b commit 72eae7a
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 42 deletions.
32 changes: 16 additions & 16 deletions recipes/rte-rrtmgp/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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% ^
Expand All @@ -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
32 changes: 14 additions & 18 deletions recipes/rte-rrtmgp/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}" \
Expand All @@ -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/ \;
# Run tests
ctest --output-on-failure --test-dir "${BUILD_DIR}" -V
21 changes: 13 additions & 8 deletions recipes/rte-rrtmgp/meta.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 72eae7a

Please sign in to comment.