Skip to content

Commit

Permalink
rename src/code_base -> src/bmdscore (#73)
Browse files Browse the repository at this point in the history
* reformat

* move over some of the functions

* see if a few more files can be deleted

* remove?

* move test scripts

* move pybind11.cmake?

* rename src/code_base -> src/bmdscore

* added project name to CMake file

---------

Co-authored-by: Cody Simmons <[email protected]>
  • Loading branch information
shapiromatron and cwsimmon authored Oct 29, 2024
1 parent 582a33d commit d77f3be
Show file tree
Hide file tree
Showing 51 changed files with 17 additions and 15 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ find_library(NLOPT_LIB NAMES NLopt nlopt libnlopt REQUIRED HINTS ${NLOPT_DIR})

project(bmdscore)

include_directories("${CMAKE_SOURCE_DIR}/src/code_base" "${CMAKE_SOURCE_DIR}/src/include" ${EIGEN_DIR} ${NLOPT_DIR}/../include ${NLOPT_DIR} ${GSL_DIR})
include_directories("${CMAKE_SOURCE_DIR}/src/bmdscore" "${CMAKE_SOURCE_DIR}/src/include" ${EIGEN_DIR} ${NLOPT_DIR}/../include ${NLOPT_DIR} ${GSL_DIR})
link_directories(${GSL_LIB_DIR} ${NLOPT_LIB_DIR})

file (GLOB SOURCE_FILES "${CMAKE_SOURCE_DIR}/src/code_base/*.cpp")
file (GLOB HEADER_FILES "src/include/*.h" "src/code_base/*.h" ${EIGEN_DIR})
file (GLOB SOURCE_FILES "${CMAKE_SOURCE_DIR}/src/bmdscore/*.cpp")
file (GLOB HEADER_FILES "src/include/*.h" "src/bmdscore/*.h" ${EIGEN_DIR})
file (GLOB PYTHON_FILES "src/pybmdscpp/*.cpp" "src/pybmdscpp/*.h")

# Set up such that XCode organizes the files
Expand Down
10 changes: 6 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ IF(WIN32)
add_compile_definitions(RBMDS_EXPORTS)
ENDIF()

project(bmdscore)

# Find libraries
IF(WIN32)
find_library(GSL_LIB gsl REQUIRED HINTS ${GSL_DIR})
Expand All @@ -43,10 +45,10 @@ find_library(NLOPT_LIB NAMES NLopt nlopt libnlopt REQUIRED HINTS ${NLOPT_DIR})
link_directories(${GSL_LIB_DIR} ${NLOPT_LIB_DIR})

# Include dir
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/code_base ${CMAKE_CURRENT_SOURCE_DIR}/include ${EIGEN_DIR} ${GSL_DIR} ${NLOPT_DIR} ${NLOPT_DIR}/../include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/bmdscore ${CMAKE_CURRENT_SOURCE_DIR}/include ${EIGEN_DIR} ${GSL_DIR} ${NLOPT_DIR} ${NLOPT_DIR}/../include)

# Headers
set(PROJECT_SOURCE_DIR "code_base")
set(PROJECT_SOURCE_DIR "bmdscore")
set(PROJECT_INCLUDE_DIR "include")

# Source files
Expand Down Expand Up @@ -163,7 +165,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
add_custom_target(coverage
COMMAND ${CMAKE_COMMAND} -E env "LCOV_EXCL_BR_LINE=:${PROJECT_SOURCE_DIR}/../unitTests/*" gcov -b ${PROJECT_SOURCE_DIR}../unitTests ${PROJECT_SOURCE_DIR}/../build/CMakeFiles/unit_tests.dir/unitTests/test_main.cpp.gcno ${PROJECT_SOURCE_DIR}/../build/CMakeFiles/bmdscore.dir/*.gcno

COMMAND lcov -d ./CMakeFiles/bmdscore.dir/code_base/ -c -o ./coverage.info
COMMAND lcov -d ./CMakeFiles/bmdscore.dir/bmdscore/ -c -o ./coverage.info
COMMAND lcov -r ./coverage.info ${TEST_EXC} ${EIGEN_DIR} '*gcc*' -o ./coverage.info --ignore-errors unused
COMMAND lcov -r ./coverage.info
COMMAND lcov -r ./coverage.info -o ./coverage.info
Expand All @@ -186,7 +188,7 @@ add_custom_target(run_tests
add_custom_target(run_tests_with_coverage
COMMAND ./unit_tests
COMMAND ${CMAKE_COMMAND} -E env "LCOV_EXCL_BR_LINE=:${PROJECT_SOURCE_DIR}/../unitTests/*" gcov -b ${PROJECT_SOURCE_DIR}../unitTests ${PROJECT_SOURCE_DIR}/../build/CMakeFiles/unit_tests.dir/unitTests/test_main.cpp.gcno ${PROJECT_SOURCE_DIR}/../build/CMakeFiles/bmdscore.dir/*.gcno
COMMAND lcov -d ./CMakeFiles/bmdscore.dir/code_base/ -c -o ./coverage.info
COMMAND lcov -d ./CMakeFiles/bmdscore.dir/bmdscore/ -c -o ./coverage.info
COMMAND lcov -r ./coverage.info ${TEST_EXC} ${EIGEN_DIR} '*gcc*' -o ./coverage.info --ignore-errors unused
COMMAND genhtml ./coverage.info -o ./coverage
WORKING_DIRECTORY ./ #${PROJECT_BINARY_DIR}
Expand Down
6 changes: 3 additions & 3 deletions src/Makevars
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
DISTRO = $(shell uname)

ifeq ($(DISTRO), Linux)
PKG_CPPFLAGS = -I"./include" -I"./code_base" -ftree-vectorize -Os -march=native
PKG_CPPFLAGS = -I"./include" -I"./bmdscore" -ftree-vectorize -Os -march=native
PKG_CPPFLAGS += $(shell pkg-config --cflags nlopt gsl) -DR_COMPILATION -Wno-ignored-attributes -flto -fopenmp
PKG_LIBS = $(shell pkg-config --libs nlopt gsl)
else
PKG_CPPFLAGS = -I"./code_base" -I"./include" -ftree-vectorize -Os -fopenmp
PKG_CPPFLAGS = -I"./bmdscore" -I"./include" -ftree-vectorize -Os -fopenmp
PKG_CPPFLAGS += -DR_COMPILATION -Wno-ignored-attributes -DNDEBUG $(shell pkg-config --cflags nlopt gsl) #-fopenmp
PKG_LIBS = -lomp $(shell pkg-config --libs nlopt gsl)
endif

MAIN = $(wildcard *.cpp)
MAIN_CODE = $(wildcard code_base/*.cpp)
MAIN_CODE = $(wildcard bmdscore/*.cpp)
OBJECTS = $(MAIN:.cpp=.o) $(MAIN_CODE:.cpp=.o)
2 changes: 1 addition & 1 deletion src/Makevars.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PKG_CXXFLAGS = -I./code_base -I./include @OPENMP@ @NLOPT_CPPFLAGS@ @GSL_CPPFLAGS@ -DR_COMPILATION
PKG_CXXFLAGS = -I./bmdscore -I./include @OPENMP@ @NLOPT_CPPFLAGS@ @GSL_CPPFLAGS@ -DR_COMPILATION
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) @NLOPT_LIBS@ @GSL_LIBS@ @OPENMP@

# Include all C++ files in src/ and its subdirectories
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.
4 changes: 2 additions & 2 deletions src/code_base/Makefile.am → src/bmdscore/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
noinst_LTLIBRARIES = libBMDS.la
noinst_LTLIBRARIES = libBMDS.la

AM_CPPFLAGS= -I$(top_srcdir)/code_base -I$(top_srcdir)/include -I$(EIGEN_INCLUDE)
AM_CPPFLAGS= -I$(top_srcdir)/bmdscore -I$(top_srcdir)/include -I$(EIGEN_INCLUDE)
AM_CPPFLAGS+= -O3 -funroll-loops -std=c++11
AM_CPPFLAGS+= @OPENMP_CFLAGS@ -Wno-ignored-attributes -DEIGEN_NO_DEBUG -march=native

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.
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.
Binary file removed src/code_base/.DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions src/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)

project(test_cpp)

set(CPP_BASE ../)
set(CPP_BASE ../)

IF(DEFINED ENV{EIGEN_DIR})
set(EIGEN_DIR $ENV{EIGEN_DIR})
Expand Down Expand Up @@ -34,7 +34,7 @@ ELSE()
ENDIF()
find_library(NLOPT_LIB NAMES NLopt nlopt libnlopt REQUIRED HINTS ${NLOPT_DIR})

include_directories(${CPP_BASE}/tests/src ${CPP_BASE}/build ${CPP_BASE}/include ${CPP_BASE}/code_base ${EIGEN_DIR} ${NLOPT_DIR}/../include ${GSL_DIR})
include_directories(${CPP_BASE}/tests/src ${CPP_BASE}/build ${CPP_BASE}/include ${CPP_BASE}/bmdscore ${EIGEN_DIR} ${NLOPT_DIR}/../include ${GSL_DIR})

link_directories(${GSL_LIB_DIR} ${NLOPT_LIB_DIR})

Expand Down

0 comments on commit d77f3be

Please sign in to comment.