Begin refactor CMakeLists debug/release paths
This commit is contained in:
59
Makefile
59
Makefile
@@ -14,18 +14,21 @@ setup: ## Install dependencies for tests and coverage
|
||||
dest ?= ${HOME}/bin
|
||||
install: ## Copy binary files to bin folder
|
||||
@echo "Destination folder: $(dest)"
|
||||
make build
|
||||
make buildr
|
||||
@echo ">>> Copying files to $(dest)"
|
||||
@cp build/src/Platform/b_main $(dest)
|
||||
@cp build/src/Platform/b_list $(dest)
|
||||
@cp build/src/Platform/b_manage $(dest)
|
||||
@cp build/src/Platform/b_best $(dest)
|
||||
@cp build_release/src/Platform/b_main $(dest)
|
||||
@cp build_release/src/Platform/b_list $(dest)
|
||||
@cp build_release/src/Platform/b_manage $(dest)
|
||||
@cp build_release/src/Platform/b_best $(dest)
|
||||
|
||||
dependency: ## Create a dependency graph diagram of the project (build/dependency.png)
|
||||
cd build && cmake .. --graphviz=dependency.dot && dot -Tpng dependency.dot -o dependency.png
|
||||
|
||||
build: ## Build the main and BayesNetSample
|
||||
cmake --build build -t b_main -t BayesNetSample -t b_manage -t b_list -t b_best -j 32
|
||||
buildd: ## Build the debug targets
|
||||
cmake --build build_debug -t b_main -t BayesNetSample -t b_manage -t b_list -t b_best -j 32
|
||||
|
||||
buildr: ## Build the release targets
|
||||
cmake --build build_release -t b_main -t BayesNetSample -t b_manage -t b_list -t b_best -j 32
|
||||
|
||||
clean: ## Clean the debug info
|
||||
@echo ">>> Cleaning Debug BayesNet...";
|
||||
@@ -37,36 +40,54 @@ clang-uml: ## Create uml class and sequence diagrams
|
||||
|
||||
debug: ## Build a debug version of the project
|
||||
@echo ">>> Building Debug BayesNet...";
|
||||
@if [ -d ./build ]; then rm -rf ./build; fi
|
||||
@mkdir build;
|
||||
@cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -D ENABLE_TESTING=ON -D CODE_COVERAGE=ON;
|
||||
@if [ -d ./build_debug ]; then rm -rf ./build_debug; fi
|
||||
@mkdir build_debug;
|
||||
@cmake -S . -B build_Debug -D CMAKE_BUILD_TYPE=Debug -D ENABLE_TESTING=ON -D CODE_COVERAGE=ON;
|
||||
@echo ">>> Done";
|
||||
|
||||
release: ## Build a Release version of the project
|
||||
@echo ">>> Building Release BayesNet...";
|
||||
@if [ -d ./build ]; then rm -rf ./build; fi
|
||||
@mkdir build;
|
||||
@cmake -S . -B build -D CMAKE_BUILD_TYPE=Release;
|
||||
@if [ -d ./build_release ]; then rm -rf ./build_release; fi
|
||||
@mkdir build_release;
|
||||
@cmake -S . -B build_release -D CMAKE_BUILD_TYPE=Release;
|
||||
@echo ">>> Done";
|
||||
|
||||
opt = ""
|
||||
test: ## Run tests (opt="-s") to verbose output the tests, (opt="-c='Test Maximum Spanning Tree'") to run only that section
|
||||
@echo ">>> Running tests...";
|
||||
@echo ">>> Running BayesNet & Platform tests...";
|
||||
$(MAKE) clean
|
||||
@cmake --build build --target unit_tests ;
|
||||
@if [ -f build/tests/unit_tests ]; then cd build/tests ; ./unit_tests $(opt) ; fi ;
|
||||
@echo ">>> Done";
|
||||
@cmake --build build_debug --target unit_tests_bayesnet --target unit_tests_platform ;
|
||||
@if [ -f build_debug/tests/unit_tests_bayesnet ]; then cd build_debug/tests ; ./unit_tests_bayesnet $(opt) ; fi ;
|
||||
@if [ -f build_debug/tests/unit_tests_platform ]; then cd build_debug/tests ; ./unit_tests_platform $(opt) ; fi ;
|
||||
@echo ">>> Done";
|
||||
|
||||
opt = ""
|
||||
testp: ## Run platform tests (opt="-s") to verbose output the tests, (opt="-c='Stratified Fold Test'") to run only that section
|
||||
@echo ">>> Running Platform tests...";
|
||||
$(MAKE) clean
|
||||
@cmake --build build_debug --target unit_tests_platform ;
|
||||
@if [ -f build_debug/tests/unit_tests_platform ]; then cd build_debug/tests ; ./unit_tests_platform $(opt) ; fi ;
|
||||
@echo ">>> Done";
|
||||
|
||||
opt = ""
|
||||
testb: ## Run BayesNet tests (opt="-s") to verbose output the tests, (opt="-c='Test Maximum Spanning Tree'") to run only that section
|
||||
@echo ">>> Running BayesNet tests...";
|
||||
$(MAKE) clean
|
||||
@cmake --build build_debug --target unit_tests_bayesnet ;
|
||||
@if [ -f build_debug/tests/unit_tests_bayesnet ]; then cd build_debug/tests ; ./unit_tests_bayesnet $(opt) ; fi ;
|
||||
@echo ">>> Done";
|
||||
|
||||
coverage: ## Run tests and generate coverage report (build/index.html)
|
||||
@echo ">>> Building tests with coverage...";
|
||||
$(MAKE) test
|
||||
@cd build ; \
|
||||
@cd build_debug ; \
|
||||
gcovr --config ../gcovr.cfg
|
||||
@echo ">>> Done";
|
||||
|
||||
define ClearTests =
|
||||
$(eval nfiles=$(find . -name "*.gcda" -print))
|
||||
@if [ -f build/tests/unit_tests ]; then rm -f build/tests/unit_tests ; fi ;
|
||||
@if [ -f build_debug/tests/unit_tests_bayesnet ]; then rm -f build_debug/tests/unit_tests_bayesnet ; fi ;
|
||||
@if [ -f build_debug/tests/unit_tests_platform ]; then rm -f build_debug/tests/unit_tests_platform ; fi ;
|
||||
@if test "${nfiles}" != "" ; then \
|
||||
find . -name "*.gcda" -print0 | xargs -0 rm 2>/dev/null ;\
|
||||
fi ;
|
||||
|
Reference in New Issue
Block a user