Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ script.
- [Eigen](http://eigen.tuxfamily.org/)
- [JSON for C++](https://github.com/nlohmann/json/)
- [JSON Schema Validator for C++](https://github.com/pboettch/json-schema-validator)
- [pybind11](https://github.com/pybind/pybind11)

* UFS Dependencies
- [ESMF](https://www.earthsystemcog.org/projects/esmf/)
Expand Down
1 change: 1 addition & 0 deletions build_stack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ build_lib tau2
build_lib cgal
build_lib json
build_lib json_schema_validator
build_lib pybind11

# JCSDA JEDI dependencies

Expand Down
4 changes: 4 additions & 0 deletions config/stack_custom.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ json_schema_validator:
build: YES
version: 2.1.0

pybind11:
build: YES
version: 2.5.0

ecbuild:
build: YES
version: release-stable
Expand Down
4 changes: 4 additions & 0 deletions config/stack_gaea.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ json_schema_validator:
build: NO
version: 2.1.0

pybind11:
build: YES
version: 2.5.0

ecbuild:
build: NO
version: release-stable
Expand Down
4 changes: 4 additions & 0 deletions config/stack_jedi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ json_schema_validator:
build: YES
version: 2.1.0

pybind11:
build: YES
version: 2.5.0

ecbuild:
build: YES
version: release-stable
Expand Down
4 changes: 4 additions & 0 deletions config/stack_mac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ json_schema_validator:
build: YES
version: 2.1.0

pybind11:
build: YES
version: 2.5.0

ecbuild:
build: YES
version: release-stable
Expand Down
4 changes: 4 additions & 0 deletions config/stack_noaa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ json_schema_validator:
build: YES
version: 2.1.0

pybind11:
build: YES
version: 2.5.0

ecbuild:
build: YES
version: release-stable
Expand Down
45 changes: 45 additions & 0 deletions libs/build_pybind11.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

set -eux

name="pybind11"
version=${1:-${STACK_pybind11_version}}

# Hyphenated version used for install prefix
compiler=$(echo $HPC_COMPILER | sed 's/\//-/g')

if $MODULES; then
set +x
source $MODULESHOME/init/bash
module try-load cmake
module list
set -x

prefix="${PREFIX:-"/opt/modules"}/core/$name/$version"
if [[ -d $prefix ]]; then
[[ $OVERWRITE =~ [yYtT] ]] && ( echo "WARNING: $prefix EXISTS: OVERWRITING!"; $SUDO rm -rf $prefix; $SUDO mkdir $prefix ) \
|| ( echo "WARNING: $prefix EXISTS, SKIPPING"; exit 1 )
fi
else
prefix="/usr/local"
fi

cd ${HPC_STACK_ROOT}/${PKGDIR:-"pkg"}

software=$name-$version
gitURL="https://github.com/pybind/pybind11"
[[ -d $software ]] || ( git clone -b "v$version" $gitURL $software )
[[ ${DOWNLOAD_ONLY} =~ [yYtT] ]] && exit 0
[[ -d $software ]] && cd $software || ( echo "$software does not exist, ABORT!"; exit 1 )
[[ -d build ]] && rm -rf build
mkdir -p build && cd build

cmake -DCMAKE_INSTALL_PREFIX=$prefix \
-DPYBIND11_TEST=OFF \
-DCMAKE_VERBOSE_MAKEFILE=1 ..
VERBOSE=$MAKE_VERBOSE $SUDO make -j${NTHREADS:-4} install

# generate modulefile from template
$MODULES && update_modules core $name $version \
|| echo $name $version >> ${HPC_STACK_ROOT}/hpc-stack-contents.log

22 changes: 22 additions & 0 deletions modulefiles/core/pybind11/pybind11.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
help([[
]])

local pkgName = myModuleName()
local pkgVersion = myModuleVersion()
local pkgNameVer = myModuleFullName()

conflict(pkgName)

local opt = os.getenv("HPC_OPT") or os.getenv("OPT") or "/opt/modules"

local base = pathJoin(opt,"core",pkgName,pkgVersion)

prepend_path("CPATH", pathJoin(base,"include"))

setenv("pybind11_ROOT", base)
setenv("pybind11_DIR", pathJoin(base,"share","cmake","pybind11"))

whatis("Name: ".. pkgName)
whatis("Version: " .. pkgVersion)
whatis("Category: Library")
whatis("Description: pybind11 - Python C++ Interoperability Library")
10 changes: 5 additions & 5 deletions stack_helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ function update_modules {
esac

[[ -e $tmpl_file ]] || ( echo "ERROR: $tmpl_file NOT FOUND! ABORT!"; exit 1 )
[[ -d $to_dir ]] || ( echo "ERROR: $mod_dir MODULE DIRECTORY NOT FOUND! ABORT!"; exit 1 )
[[ -d $to_dir ]] || ( mkdir -p $to_dir )

cd $to_dir
cd $to_dir || ( echo "ERROR: $to_dir MODULE DIRECTORY NOT FOUND! ABORT!"; exit 1 )
$SUDO mkdir -p $name; cd $name

if [[ $name != "cmake" || $name != "mpi" || $name != "gnu" ]]; then
Expand Down Expand Up @@ -56,7 +56,7 @@ EOF
else
$SUDO cp $tmpl_file $version.lua
fi

# Make the latest installed version the default
[[ -e default ]] && $SUDO rm -f default
$SUDO ln -s $version.lua default
Expand Down Expand Up @@ -180,7 +180,7 @@ function build_lib() {
[[ -f $logdir/$1.log ]] && ( logDate=$(date -r $logdir/$1.log +%F_%H%M); mv -f $logdir/$1.log $logdir/$1.log.$logDate )
${HPC_STACK_ROOT}/libs/build_$1.sh 2>&1 | tee "$logdir/$1.log"
local ret=${PIPESTATUS[0]}
if [[ $ret > 0 ]]; then
if [[ $ret -gt 0 ]]; then
echo "BUILD FAIL! Lib: $1 Error:$ret"
[[ ${STACK_EXIT_ON_FAIL} =~ [yYtT] ]] && exit $ret
fi
Expand All @@ -200,7 +200,7 @@ function build_nceplib() {
[[ -f $logdir/$1.log ]] && ( logDate=$(date -r $logdir/$1.log +%F_%H%M); mv -f $logdir/$1.log $logdir/$1.log.$logDate )
${HPC_STACK_ROOT}/libs/build_nceplibs.sh "$1" 2>&1 | tee "$logdir/$1.log"
local ret=${PIPESTATUS[0]}
if [[ $ret > 0 ]]; then
if [[ $ret -gt 0 ]]; then
echo "BUILD FAIL! NCEPlib: $1 Error:$ret"
[[ ${STACK_EXIT_ON_FAIL} =~ [yYtT] ]] && exit $ret
fi
Expand Down