2 Commits

2 changed files with 18 additions and 5 deletions

View File

@@ -22,8 +22,10 @@ else(ENABLE_TESTING)
MESSAGE("Release mode") MESSAGE("Release mode")
endif(ENABLE_TESTING) endif(ENABLE_TESTING)
if (ENABLE_SAMPLE)
add_subdirectory(sample) message("Building sample")
add_subdirectory(sample)
endif(ENABLE_SAMPLE)
include_directories( include_directories(
${TORCH_INCLUDE_DIRS} ${TORCH_INCLUDE_DIRS}
@@ -31,4 +33,12 @@ include_directories(
) )
add_library(fimdlp src/CPPFImdlp.cpp src/Metrics.cpp src/BinDisc.cpp src/Discretizer.cpp) add_library(fimdlp src/CPPFImdlp.cpp src/Metrics.cpp src/BinDisc.cpp src/Discretizer.cpp)
target_link_libraries(fimdlp "${TORCH_LIBRARIES}") target_link_libraries(fimdlp "${TORCH_LIBRARIES}")
# Installation
# ------------
install(TARGETS fimdlp
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
CONFIGURATIONS Release)
install(DIRECTORY src/ DESTINATION include/fimdlp FILES_MATCHING CONFIGURATIONS Release PATTERN "*.h")

View File

@@ -6,13 +6,16 @@ lcov := lcov
build: build:
@if [ -d build_release ]; then rm -fr build_release; fi @if [ -d build_release ]; then rm -fr build_release; fi
@mkdir build_release @mkdir build_release
@cmake -B build_release -S . -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=OFF @cmake -B build_release -S . -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=OFF -DENABLE_SAMPLE=ON
@cmake --build build_release -j 8 @cmake --build build_release -j 8
install:
@cmake --build build_release --target install -j 8
test: test:
@if [ -d build_debug ]; then rm -fr build_debug; fi @if [ -d build_debug ]; then rm -fr build_debug; fi
@mkdir build_debug @mkdir build_debug
@cmake -B build_debug -S . -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTING=ON @cmake -B build_debug -S . -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTING=ON -DENABLE_SAMPLE=ON
@cmake --build build_debug -j 8 @cmake --build build_debug -j 8
@cd build_debug/tests && ctest --output-on-failure -j 8 @cd build_debug/tests && ctest --output-on-failure -j 8
@cd build_debug/tests && $(lcov) --capture --directory ../ --demangle-cpp --ignore-errors source,source --ignore-errors mismatch --output-file coverage.info >/dev/null 2>&1; \ @cd build_debug/tests && $(lcov) --capture --directory ../ --demangle-cpp --ignore-errors source,source --ignore-errors mismatch --output-file coverage.info >/dev/null 2>&1; \