Skip to content

Commit

Permalink
Move nmodl directory to nocmodl (#3110)
Browse files Browse the repository at this point in the history
  • Loading branch information
alkino authored Oct 3, 2024
1 parent 0a545a3 commit 51bb95d
Show file tree
Hide file tree
Showing 28 changed files with 32 additions and 30 deletions.
10 changes: 5 additions & 5 deletions cmake/NeuronFileLists.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ set(MODLUNIT_FILES_LIST
units1.cpp
version.cpp)

set(NMODL_FILES_LIST
set(NOCMODL_FILES_LIST
consist.cpp
deriv.cpp
discrete.cpp
Expand Down Expand Up @@ -430,7 +430,7 @@ set(NRN_NODEORDEROPTIM_SRC_DIR ${PROJECT_SOURCE_DIR}/src/coreneuron/permute)
set(NRN_NRNCVODE_SRC_DIR ${PROJECT_SOURCE_DIR}/src/nrncvode)
set(NRN_NRNIV_SRC_DIR ${PROJECT_SOURCE_DIR}/src/nrniv)
set(NRN_MODLUNIT_SRC_DIR ${PROJECT_SOURCE_DIR}/src/modlunit)
set(NRN_NMODL_SRC_DIR ${PROJECT_SOURCE_DIR}/src/nmodl)
set(NRN_NOCMODL_SRC_DIR ${PROJECT_SOURCE_DIR}/src/nocmodl)
set(NRN_IVOS_SRC_DIR ${PROJECT_SOURCE_DIR}/src/ivos)
set(NRN_MUSIC_SRC_DIR ${PROJECT_SOURCE_DIR}/src/neuronmusic)
set(NRN_PARALLEL_SRC_DIR ${PROJECT_SOURCE_DIR}/src/parallel)
Expand Down Expand Up @@ -462,13 +462,13 @@ nrn_create_file_list(NRN_MODFILE_BASE_NAMES src/nrnoc ${MODFILE_BASE_NAMES})
nrn_create_file_list(NRN_BIN_SRC_FILES ${PROJECT_SOURCE_DIR}/src/ivoc/ nrnmain.cpp)
nrn_create_file_list(NRN_BIN_SRC_FILES ${PROJECT_SOURCE_DIR}/src/oc/ ockludge.cpp modlreg.cpp)
nrn_create_file_list(NRN_MODLUNIT_SRC_FILES ${NRN_MODLUNIT_SRC_DIR} ${MODLUNIT_FILES_LIST})
nrn_create_file_list(NRN_NMODL_SRC_FILES ${NRN_NMODL_SRC_DIR} ${NMODL_FILES_LIST})
nrn_create_file_list(NRN_NOCMODL_SRC_FILES ${NRN_NOCMODL_SRC_DIR} ${NOCMODL_FILES_LIST})
nrn_create_file_list(NRNMPI_DYNAMIC_INCLUDE_FILE ${PROJECT_SOURCE_DIR}/src/nrnmpi
${MPI_DYNAMIC_INCLUDE})
nrn_create_file_list(NRN_IVOS_SRC_FILES ${NRN_IVOS_SRC_DIR} ${IVOS_FILES_LIST})
nrn_create_file_list(NRN_MUSIC_SRC_FILES ${NRN_MUSIC_SRC_DIR} ${NRN_MUSIC_FILES_LIST})
list(APPEND NRN_OC_SRC_FILES ${PROJECT_BINARY_DIR}/src/oc/hocusr.h)
list(APPEND NRN_NMODL_SRC_FILES ${NRN_MODLUNIT_SRC_DIR}/units.cpp)
list(APPEND NRN_NOCMODL_SRC_FILES ${NRN_MODLUNIT_SRC_DIR}/units.cpp)

# =============================================================================
# Create mswin install lists needed for setup_exe target
Expand All @@ -480,7 +480,7 @@ if(MINGW)
list(APPEND MSWIN_FILES ${MSWIN_SRC_DIR}/notes.txt)

list(APPEND NRN_MODLUNIT_SRC_FILES ${PROJECT_SOURCE_DIR}/src/mswin/extra/d2upath.cpp)
list(APPEND NRN_NMODL_SRC_FILES ${PROJECT_SOURCE_DIR}/src/mswin/extra/d2upath.cpp)
list(APPEND NRN_NOCMODL_SRC_FILES ${PROJECT_SOURCE_DIR}/src/mswin/extra/d2upath.cpp)
list(APPEND NRN_OC_SRC_FILES ${PROJECT_SOURCE_DIR}/src/mswin/extra/d2upath.cpp)

nrn_create_file_list(MSWIN_BIN_FILES ${MSWIN_SRC_DIR} nrniv.ico nrniv10.ico nmodl2a.ico)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
52 changes: 27 additions & 25 deletions src/nrniv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,45 +51,47 @@ cpp_cc_configure_sanitizers(TARGET modlunit)
# Generated .cpp needs to find source-directory .hpp and vice versa.
target_include_directories(modlunit PRIVATE "${NRN_MODLUNIT_SRC_DIR}" "${NRN_MODLUNIT_GEN}")

if(NRN_NMODL_CXX_FLAGS)
target_compile_options(modlunit PRIVATE ${NRN_NMODL_CXX_FLAGS})
if(NRN_NOCMODL_CXX_FLAGS)
target_compile_options(modlunit PRIVATE ${NRN_NOCMODL_CXX_FLAGS})
endif()

# =============================================================================
# Build nocmodl : source-to-source compiler for NMODL
# Build nocmodl : source-to-source compiler for NOCMODL
# =============================================================================
set(NRN_NMODL_GEN "${CMAKE_CURRENT_BINARY_DIR}/nocmodl_generated")
file(MAKE_DIRECTORY "${NRN_NMODL_GEN}")
file(RELATIVE_PATH NRN_NMODL_GEN_REL "${BISON_FLEX_WORKING_DIR}" "${NRN_NMODL_GEN}")
file(RELATIVE_PATH NRN_NMODL_SRC_REL "${BISON_FLEX_WORKING_DIR}" "${NRN_NMODL_SRC_DIR}")
set(NRN_NOCMODL_GEN "${CMAKE_CURRENT_BINARY_DIR}/nocmodl_generated")
file(MAKE_DIRECTORY "${NRN_NOCMODL_GEN}")
file(RELATIVE_PATH NRN_NOCMODL_GEN_REL "${BISON_FLEX_WORKING_DIR}" "${NRN_NOCMODL_GEN}")
file(RELATIVE_PATH NRN_NOCMODL_SRC_REL "${BISON_FLEX_WORKING_DIR}" "${NRN_NOCMODL_SRC_DIR}")
add_custom_command(
OUTPUT "${NRN_NMODL_GEN}/lex.cpp"
OUTPUT "${NRN_NOCMODL_GEN}/lex.cpp"
WORKING_DIRECTORY "${BISON_FLEX_WORKING_DIR}"
COMMAND "${FLEX_EXECUTABLE}" ARGS -o "${NRN_NMODL_GEN_REL}/lex.cpp" "${NRN_NMODL_SRC_REL}/lex.lpp"
DEPENDS "${NRN_NMODL_SRC_DIR}/lex.lpp"
COMMAND "${FLEX_EXECUTABLE}" ARGS -o "${NRN_NOCMODL_GEN_REL}/lex.cpp"
"${NRN_NOCMODL_SRC_REL}/lex.lpp"
DEPENDS "${NRN_NOCMODL_SRC_DIR}/lex.lpp"
COMMENT "[FLEX][nocmodllexer] Building scanner with flex ${FLEX_VERSION}")
add_custom_command(
OUTPUT "${NRN_NMODL_GEN}/parse1.hpp" "${NRN_NMODL_GEN}/parse1.cpp"
OUTPUT "${NRN_NOCMODL_GEN}/parse1.hpp" "${NRN_NOCMODL_GEN}/parse1.cpp"
WORKING_DIRECTORY "${BISON_FLEX_WORKING_DIR}"
COMMAND "${BISON_EXECUTABLE}" ARGS "--defines=${NRN_NMODL_GEN_REL}/parse1.hpp" -o
"${NRN_NMODL_GEN_REL}/parse1.cpp" "${NRN_NMODL_SRC_REL}/parse1.ypp"
DEPENDS "${NRN_NMODL_SRC_DIR}/parse1.ypp"
COMMAND "${BISON_EXECUTABLE}" ARGS "--defines=${NRN_NOCMODL_GEN_REL}/parse1.hpp" -o
"${NRN_NOCMODL_GEN_REL}/parse1.cpp" "${NRN_NOCMODL_SRC_REL}/parse1.ypp"
DEPENDS "${NRN_NOCMODL_SRC_DIR}/parse1.ypp"
COMMENT "[BISON][nocmodlparser] Building parser with bison ${BISON_VERSION}")
add_custom_command(
OUTPUT "${NRN_NMODL_GEN}/diffeq.hpp" "${NRN_NMODL_GEN}/diffeq.cpp"
OUTPUT "${NRN_NOCMODL_GEN}/diffeq.hpp" "${NRN_NOCMODL_GEN}/diffeq.cpp"
WORKING_DIRECTORY "${BISON_FLEX_WORKING_DIR}"
COMMAND "${BISON_EXECUTABLE}" ARGS "--defines=${NRN_NMODL_GEN_REL}/diffeq.hpp" -o
"${NRN_NMODL_GEN_REL}/diffeq.cpp" "${NRN_NMODL_SRC_REL}/diffeq.ypp"
DEPENDS "${NRN_NMODL_SRC_DIR}/diffeq.ypp"
COMMAND "${BISON_EXECUTABLE}" ARGS "--defines=${NRN_NOCMODL_GEN_REL}/diffeq.hpp" -o
"${NRN_NOCMODL_GEN_REL}/diffeq.cpp" "${NRN_NOCMODL_SRC_REL}/diffeq.ypp"
DEPENDS "${NRN_NOCMODL_SRC_DIR}/diffeq.ypp"
COMMENT "[BISON][nocmodlparser] Building parser with bison ${BISON_VERSION}")

add_custom_target(
nocmodl_generated_files
DEPENDS "${NRN_NMODL_GEN}/lex.cpp" "${NRN_NMODL_GEN}/parse1.hpp" "${NRN_NMODL_GEN}/parse1.cpp"
"${NRN_NMODL_GEN}/diffeq.hpp" "${NRN_NMODL_GEN}/diffeq.cpp")
DEPENDS "${NRN_NOCMODL_GEN}/lex.cpp" "${NRN_NOCMODL_GEN}/parse1.hpp"
"${NRN_NOCMODL_GEN}/parse1.cpp" "${NRN_NOCMODL_GEN}/diffeq.hpp"
"${NRN_NOCMODL_GEN}/diffeq.cpp")
add_dependencies(generated_source_files nocmodl_generated_files)
add_executable(nocmodl ${NRN_NMODL_SRC_FILES} "${NRN_NMODL_GEN}/lex.cpp"
"${NRN_NMODL_GEN}/parse1.cpp" "${NRN_NMODL_GEN}/diffeq.cpp")
add_executable(nocmodl ${NRN_NOCMODL_SRC_FILES} "${NRN_NOCMODL_GEN}/lex.cpp"
"${NRN_NOCMODL_GEN}/parse1.cpp" "${NRN_NOCMODL_GEN}/diffeq.cpp")
cpp_cc_configure_sanitizers(TARGET nocmodl)
target_compile_definitions(nocmodl PRIVATE COMPILE_DEFINITIONS NMODL=1 CVODE=1)
# Otherwise the generated code in the binary directory does not find headers in the modlunit source
Expand All @@ -98,10 +100,10 @@ target_compile_definitions(nocmodl PRIVATE COMPILE_DEFINITIONS NMODL=1 CVODE=1)
# submodule. Right now this doesn't work because the CLI11 targets are not exported/installed but
# coreneuron-core is.
get_target_property(CLI11_HEADER_DIRECTORY CLI11::CLI11 INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(nocmodl PRIVATE "${NRN_NMODL_GEN}" "${NRN_NMODL_SRC_DIR}"
target_include_directories(nocmodl PRIVATE "${NRN_NOCMODL_GEN}" "${NRN_NOCMODL_SRC_DIR}"
"${CLI11_HEADER_DIRECTORY}")
if(NRN_NMODL_CXX_FLAGS)
target_compile_options(nocmodl PRIVATE ${NRN_NMODL_CXX_FLAGS})
if(NRN_NOCMODL_CXX_FLAGS)
target_compile_options(nocmodl PRIVATE ${NRN_NOCMODL_CXX_FLAGS})
endif()

# =============================================================================
Expand Down

0 comments on commit 51bb95d

Please sign in to comment.