Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit 92b443c

Browse files
authored
Add a way to enable NRN_PRCELLSTATE inside nrnivmodl-core (#604)
* Add a way to enable NRN_PRCELLSTATE inside nrnivmodl-core * CMake default option disabled * update nmodl submodule to grab PRCELLSTATE
1 parent 3952d28 commit 92b443c

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ option(CORENRN_ENABLE_UNIT_TESTS "Enable unit tests execution" ON)
9494
option(CORENRN_ENABLE_GPU "Enable GPU support using OpenACC" OFF)
9595
option(CORENRN_ENABLE_SHARED "Enable shared library build" ON)
9696
option(CORENRN_ENABLE_LEGACY_UNITS "Enable legacy FARADAY, R, etc" OFF)
97+
option(CORENRN_ENABLE_PRCELLSTATE "Enable NRN_PRCELLSTATE debug feature" OFF)
9798

9899
set(CORENRN_GPU_CUDA_COMPUTE_CAPABILITY
99100
"60" "70"
@@ -249,6 +250,11 @@ set(NMODL_ENABLE_LEGACY_UNITS
249250
${CORENRN_ENABLE_LEGACY_UNITS}
250251
CACHE BOOL "" FORCE)
251252

253+
if(CORENRN_ENABLE_PRCELLSTATE)
254+
set(CORENRN_NRN_PRCELLSTATE 1)
255+
else()
256+
set(CORENRN_NRN_PRCELLSTATE 0)
257+
endif()
252258
if(MINGW)
253259
add_definitions("-DMINGW")
254260
endif()

extra/nrnivmodl-core.in

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ ROOT_DIR=$(@PERL_EXECUTABLE@ -e "use Cwd 'abs_path'; print abs_path('$PARENT_DIR
2525
PARALLEL_BUILDS=4
2626
params_MODS_PATH="."
2727
params_BUILD_TYPE="@COMPILE_LIBRARY_TYPE@"
28+
params_NRN_PRCELLSTATE="@CORENRN_NRN_PRCELLSTATE@"
2829

2930
# prefix for common options : make sure to rename these if options are changed.
30-
MAKE_OPTIONS="MECHLIB_SUFFIX MOD2CPP_BINARY MOD2CPP_RUNTIME_FLAGS DESTDIR INCFLAGS LINKFLAGS MODS_PATH VERBOSE BUILD_TYPE"
31+
MAKE_OPTIONS="MECHLIB_SUFFIX MOD2CPP_BINARY MOD2CPP_RUNTIME_FLAGS DESTDIR INCFLAGS LINKFLAGS MODS_PATH VERBOSE BUILD_TYPE NRN_PRCELLSTATE"
3132

3233
# parse CLI args
33-
while getopts "n:m:a:d:i:l:Vp:b:h" OPT; do
34+
while getopts "n:m:a:d:i:l:Vp:r:b:h" OPT; do
3435
case "$OPT" in
3536
n)
3637
# suffix for mechanism library
@@ -59,6 +60,9 @@ while getopts "n:m:a:d:i:l:Vp:b:h" OPT; do
5960
b)
6061
# make with verbose
6162
params_BUILD_TYPE="$OPTARG";;
63+
r)
64+
# enable NRN_PRCELLSTATE mechanism
65+
params_NRN_PRCELLSTATE="$OPTARG";;
6266
h)
6367
echo "$APP_NAME [options, ...] [mods_path]"
6468
echo "Options:"
@@ -68,6 +72,7 @@ while getopts "n:m:a:d:i:l:Vp:b:h" OPT; do
6872
echo " -i <incl_flags> Definitions passed to the compiler, typically '-I dir..'"
6973
echo " -l <link_flags> Definitions passed to the linker, typically '-Lx -lylib..'"
7074
echo " -d <dest_dir> Install to dest_dir. Default: Off."
75+
echo " -r <0|1> Enable NRN_PRCELLSTATE mechanism. Default: @CORENRN_NRN_PRCELLSTATE@."
7176
echo " -V Verbose: show commands executed by make"
7277
echo " -p <n_procs> Number of parallel builds (Default: $PARALLEL_BUILDS)"
7378
echo " -b <STATIC|SHARED> libcorenrnmech library type"

extra/nrnivmodl_core_makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ coremech_lib_static: $(ALL_OBJS) $(ENGINEMECH_OBJ) build_always
210210

211211
# compile cpp files to .o
212212
$(MOD_OBJS_DIR)/%.o: $(MOD_TO_CPP_DIR)/%.cpp $(KINDERIV_H_PATH) | $(MOD_OBJS_DIR)
213-
$(CXX_COMPILE_CMD) -c $< -o $@
213+
$(CXX_COMPILE_CMD) -c $< -o $@ -DNRN_PRCELLSTATE=$(NRN_PRCELLSTATE)
214214

215215
# compile ispc files to .obj
216216
$(MOD_OBJS_DIR)/%.obj: $(MOD_TO_CPP_DIR)/%.ispc | $(MOD_OBJS_DIR)

0 commit comments

Comments
 (0)