Skip to content

Commit

Permalink
Functional CMake build scripts (PR #1)
Browse files Browse the repository at this point in the history
Created CMake build scripts. Build succeeds on local dev machine (Ubuntu 20.04 LTS) and JUWELS (CentOS 8).
  • Loading branch information
kvrigor committed Mar 11, 2021
1 parent f6b981f commit 5014d75
Show file tree
Hide file tree
Showing 24 changed files with 3,129 additions and 44 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
outputs/*
src/externals/mct/*/*.o
src/externals/mct/*/*.mod
src/externals/mct/*/*.a
src/externals/mct/Makefile.conf
src/externals/mct/config.h
src/externals/mct/config.log
src/externals/mct/config.status
40 changes: 40 additions & 0 deletions build_tools/build.juwels-centos8
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

# ------- User-specified variables ------------
ARCH="juwels-centos8"
CLM5_TSMP_ROOT=$(git rev-parse --show-toplevel)
BUILD_FOLDER="$CLM5_TSMP_ROOT/outputs/$ARCH/build"
INSTALL_PATH="$CLM5_TSMP_ROOT/outputs/$ARCH/run"
# ---------------------------------------------

module purge
module use $OTHERSTAGES
module load Stages/2020
module load Intel
module load ParaStationMPI
module load ESMF
module load NCO
module load Perl
module load CMake
module load parallel-netcdf
module load imkl
module load NCL
module load Python
module li

echo "NetCDF_C_PATH=$EBROOTNETCDF"
echo "NetCDF_Fortran_PATH=$EBROOTNETCDFMINFORTRAN"
echo "PnetCDF_C_PATH=$EBROOTPARALLELMINNETCDF"
GENF90_PATH=$(pwd)
rm -rf $BUILD_FOLDER
cmake -S "$CLM5_TSMP_ROOT/src" \
-B "$BUILD_FOLDER" \
-DCMAKE_MODULE_PATH="$(pwd)/cmake" \
-DCMAKE_C_COMPILER=mpicc \
-DCMAKE_Fortran_COMPILER=mpifort \
-DGENF90_PATH=$GENF90_PATH \
-DNetCDF_C_PATH=$EBROOTNETCDF \
-DNetCDF_Fortran_PATH=$EBROOTNETCDFMINFORTRAN \
-DPnetCDF_PATH=$EBROOTPARALLELMINNETCDF
cmake --build "$BUILD_FOLDER" --clean-first
cmake --install "$BUILD_FOLDER"
23 changes: 23 additions & 0 deletions build_tools/build.ubuntu-20.04LTS
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

# ------- User-specified variables ------------
ARCH="ubuntu-20.04LTS"
CLM5_TSMP_ROOT=$(git rev-parse --show-toplevel)
BUILD_FOLDER="$CLM5_TSMP_ROOT/outputs/$ARCH/build"
INSTALL_PATH="$CLM5_TSMP_ROOT/outputs/$ARCH/run"
# ---------------------------------------------

NetCDF_ROOT=/opt/custom
GENF90_PATH=$(pwd)
rm -rf $BUILD_FOLDER
cmake -S "$CLM5_TSMP_ROOT/src" \
-B "$BUILD_FOLDER" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" \
-DCMAKE_MODULE_PATH="$(pwd)/cmake" \
-DCMAKE_C_COMPILER=mpicc \
-DCMAKE_Fortran_COMPILER=mpifort \
-DGENF90_PATH=$GENF90_PATH \
-DNetCDF_PATH=$NetCDF_ROOT \
-DPnetCDF_PATH=$NetCDF_ROOT
cmake --build "$BUILD_FOLDER" --clean-first
cmake --install "$BUILD_FOLDER"
Loading

0 comments on commit 5014d75

Please sign in to comment.