From 248a511972f0e33be19cfe2d7bacf18521332b2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Monta=C3=B1ana=20G=C3=B3mez?= Date: Mon, 22 Jul 2024 19:38:12 +0200 Subject: [PATCH] Add flag to build sample in Makefile --- CMakeLists.txt | 6 ++++-- Makefile | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 43ec5f5..31ce186 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,8 +22,10 @@ else(ENABLE_TESTING) MESSAGE("Release mode") endif(ENABLE_TESTING) - -add_subdirectory(sample) +if (ENABLE_SAMPLE) + message("Building sample") + add_subdirectory(sample) +endif(ENABLE_SAMPLE) include_directories( ${TORCH_INCLUDE_DIRS} diff --git a/Makefile b/Makefile index c0e145b..263c515 100644 --- a/Makefile +++ b/Makefile @@ -6,13 +6,13 @@ lcov := lcov build: @if [ -d build_release ]; then rm -fr build_release; fi @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 test: @if [ -d build_debug ]; then rm -fr build_debug; fi @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 @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; \