Skip to content

Commit

Permalink
Cleanup #include cpp file (#2857)
Browse files Browse the repository at this point in the history
* Create a Parallel list of files
* Remove symlink cpp files that were there for autotools
  • Loading branch information
mgeplf committed Apr 29, 2024
1 parent 8b35309 commit 13654b3
Show file tree
Hide file tree
Showing 25 changed files with 334 additions and 366 deletions.
38 changes: 25 additions & 13 deletions cmake/NeuronFileLists.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,7 @@ endif()
# =============================================================================
set(NRNIV_FILE_LIST
backtrace_utils.cpp
bbs.cpp
bbsavestate.cpp
bbsdirect.cpp
bbslocal.cpp
bbslsrv.cpp
bbslsrv2.cpp
bbsrcli.cpp
bbssrv.cpp
classreg.cpp
cxprop.cpp
datapath.cpp
Expand Down Expand Up @@ -243,7 +236,6 @@ set(NRNIV_FILE_LIST
nvector_nrnserial_ld.cpp
nvector_nrnthread.cpp
nvector_nrnthread_ld.cpp
ocbbs.cpp
ocjump.cpp
partrans.cpp
ppshape.cpp
Expand Down Expand Up @@ -424,7 +416,6 @@ set(NMODL_FILES_LIST
simultan.cpp
solve.cpp
symbol.cpp
units.cpp
version.cpp)

set(IVOS_FILES_LIST observe.cpp resource.cpp)
Expand All @@ -433,6 +424,16 @@ set(MPI_DYNAMIC_INCLUDE nrnmpi_dynam.h nrnmpi_dynam_cinc nrnmpi_dynam_wrappers.i

set(NRN_MUSIC_FILES_LIST nrnmusic.cpp)

set(NRN_PARALLEL_FILES_LIST
bbs.cpp
bbsclimpi.cpp
bbsdirectmpi.cpp
bbslocal.cpp
bbslsrv.cpp
bbssrv2mpi.cpp
bbssrvmpi.cpp
ocbbs.cpp)

# =============================================================================
# Top level directories under src
# =============================================================================
Expand All @@ -447,6 +448,7 @@ set(NRN_MODLUNIT_SRC_DIR ${PROJECT_SOURCE_DIR}/src/modlunit)
set(NRN_NMODL_SRC_DIR ${PROJECT_SOURCE_DIR}/src/nmodl)
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)

# =============================================================================
# Create source file lists by gathering from various directories
Expand All @@ -460,10 +462,13 @@ nrn_create_file_list(NRN_NODEORDEROPTIM_SRC_FILES ${NRN_NODEORDEROPTIM_SRC_DIR}
list(APPEND NRN_NODEORDEROPTIM_SRC_FILES ${PROJECT_SOURCE_DIR}/src/coreneuron/utils/lpt.cpp)
nrn_create_file_list(NRN_NRNCVODE_SRC_FILES ${NRN_NRNCVODE_SRC_DIR} ${NRNCVODE_FILE_LIST})
nrn_create_file_list(NRN_NRNIV_SRC_FILES ${NRN_NRNIV_SRC_DIR} ${NRNIV_FILE_LIST})
nrn_create_file_list(NRN_PARALLEL_SRC_FILES ${PROJECT_SOURCE_DIR}/src/nrniv
nvector_nrnparallel_ld.cpp)
nrn_create_file_list(NRN_PARALLEL_SRC_FILES ${PROJECT_SOURCE_DIR}/src/sundials/shared
nvector_parallel.c)
nrn_create_file_list(NRN_PARALLEL_SRC_FILES ${NRN_PARALLEL_SRC_DIR} ${NRN_PARALLEL_FILES_LIST})
if(NRN_ENABLE_MPI)
nrn_create_file_list(NRN_PARALLEL_SRC_FILES ${PROJECT_SOURCE_DIR}/src/nrniv
nvector_nrnparallel_ld.cpp)
nrn_create_file_list(NRN_PARALLEL_SRC_FILES ${PROJECT_SOURCE_DIR}/src/sundials/shared
nvector_parallel.c)
endif()
nrn_create_file_list(NRN_SPARSE_SRC_FILES ${PROJECT_SOURCE_DIR}/src/sparse ${SPARSE_FILES_LIST})
nrn_create_file_list(NRN_SCOPMATH_SRC_FILES ${PROJECT_SOURCE_DIR}/src/scopmath
${SCOPMATH_FILES_LIST})
Expand All @@ -480,14 +485,21 @@ nrn_create_file_list(NRNMPI_DYNAMIC_INCLUDE_FILE ${PROJECT_SOURCE_DIR}/src/nrnmp
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)

# =============================================================================
# Create mswin install lists needed for setup_exe target
# =============================================================================
if(MINGW)
set(MSWIN_SRC_DIR ${PROJECT_SOURCE_DIR}/src/mswin)
nrn_create_file_list(MSWIN_FILES ${PROJECT_SOURCE_DIR}/src/parallel test0.hoc test0.py)

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_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)
nrn_create_file_list(
MSWIN_LIB_FILES
Expand Down
7 changes: 0 additions & 7 deletions src/ivoc/ivocman1.cpp

This file was deleted.

5 changes: 3 additions & 2 deletions src/modlunit/units.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
#include <cstring>

#ifdef MINGW
#include "../mswin/extra/d2upath.cpp"
#include "../mswin/extra/d2upath.h"
#endif

#if defined(WIN32)
#include <windows.h>
#endif
Expand Down Expand Up @@ -109,7 +110,7 @@ static int Getc(FILE* inp) {
static struct unit unit_stack[UNIT_STK_SIZE], *usp{nullptr};

static char* neuronhome() {
#if defined(WIN32)
#if defined(MINGW)
int i;
static char buf[256];
GetModuleFileName(NULL, buf, 256);
Expand Down
4 changes: 2 additions & 2 deletions src/mswin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ if(MINGW)
DEPENDS ${mswinsrc}/nrniv10.ico)
set_source_files_properties(${mswinsrc}/extra/neuron.cpp ${mswinsrc}/extra/mos2nrn.cpp
${mswinsrc}/extra/nrnbinstr.cpp PROPERTIES COMPILE_DEFINITIONS MINGW)
add_executable(neuron ${mswinsrc}/extra/neuron.cpp nrnicon.res)
add_executable(mos2nrn ${mswinsrc}/extra/mos2nrn.cpp)
add_executable(neuron ${mswinsrc}/extra/neuron.cpp ${mswinsrc}/extra/d2upath.cpp nrnicon.res)
add_executable(mos2nrn ${mswinsrc}/extra/mos2nrn.cpp ${mswinsrc}/extra/d2upath.cpp)
add_executable(nrnbinstr ${mswinsrc}/extra/nrnbinstr.cpp)
set(INCDIRS ${PROJECT_SOURCE_DIR}/src/oc)
target_include_directories(mos2nrn PUBLIC ${INCDIRS})
Expand Down
11 changes: 6 additions & 5 deletions src/mswin/extra/d2upath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ up to 11 characters longer.
the output string should be freed with free() when no longer needed.
*/

#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <cstdlib>
#include <cstring>
#include <cassert>

char* hoc_dos2unixpath(const char* d) {
/* translate x: and x:/ and x:\, to /cygdrive/x/ */
/* and all backslashes to forward slashes */
/* or, for mingw, just backslashes to forward slashes */
char* cp;
char* cp = nullptr;
auto* const u = static_cast<char*>(malloc(strlen(d) + 12));
assert(u);
int i{}, j{};
size_t i = 0;
int j = 0;
if (d[0] && d[1] == ':') {
strcpy(u, "/cygdrive/");
i = strlen(u);
Expand Down
1 change: 1 addition & 0 deletions src/mswin/extra/d2upath.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
char* hoc_dos2unixpath(const char* d);
2 changes: 1 addition & 1 deletion src/mswin/extra/mos2nrn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include "d2upath.cpp"
#include "d2upath.h"

char* nrnhome;
char* nh;
Expand Down
6 changes: 3 additions & 3 deletions src/mswin/extra/neuron.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
// finally executes nrniv.exe. Nrniv.exe can be run by itself if
// it does not need a console or system("command")
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>

#include "d2upath.cpp"
#include "d2upath.h"

#include <cstdio>
#include <cstdlib>
#include <cstring>

char* nrnhome;
char* nh;
Expand Down
6 changes: 0 additions & 6 deletions src/nmodl/units.cpp

This file was deleted.

186 changes: 0 additions & 186 deletions src/nrncvode/hocevent.cpp

This file was deleted.

0 comments on commit 13654b3

Please sign in to comment.