Skip to content

Commit c267a07

Browse files
committed
nrnivmodl: default NMODL_PYLIB and NMODLHOME when unset
Classic nrnivmodl did not export NMODL_PYLIB or NMODLHOME, so nmodl aborted when NRN_ENABLE_NMODL is ON (or -nmodl). Set NMODL_PYLIB from configure-time PYTHON_LIBRARY and NMODLHOME from the install prefix. Harmless with nocmodl.
1 parent 3b273d4 commit c267a07

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

bin/nrnivmodl.in

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,21 @@ export prefix
3535
export bindir
3636
export libdir
3737

38+
# NMODL (default when NRN_ENABLE_NMODL=ON, or via -nmodl) embeds Python and
39+
# requires NMODL_PYLIB + NMODLHOME. Prefer existing env values; otherwise use
40+
# the Python library from configure and the install/build prefix of this
41+
# script. Harmless when using nocmodl.
42+
if [ -z "${NMODL_PYLIB:-}" ]; then
43+
_nrn_nmodl_pylib="@PYTHON_LIBRARY@"
44+
if [ -n "${_nrn_nmodl_pylib}" ]; then
45+
export NMODL_PYLIB="${_nrn_nmodl_pylib}"
46+
fi
47+
unset _nrn_nmodl_pylib
48+
fi
49+
if [ -z "${NMODLHOME:-}" ]; then
50+
export NMODLHOME="$(cd "$(dirname "${0}")/.." && pwd)"
51+
fi
52+
3853
if command -v xcrun >/dev/null 2>&1; then
3954
@NRN_OSX_BUILD_TRUE@export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
4055
@NRN_OSX_BUILD_TRUE@export MACOSX_DEPLOYMENT_TARGET="@CMAKE_OSX_DEPLOYMENT_TARGET@"

0 commit comments

Comments
 (0)