mirror of
https://github.com/rmontanana/mdlp.git
synced 2025-08-15 23:45:57 +00:00
Fix conan (#10)
* Fix debug conan build target * Add viewcoverage and fix coverage generation * Add more tests to cover new integrity checks * Add tests to accomplish 100% * Fix conan-create makefile target
This commit is contained in:
committed by
GitHub
parent
c1759ba1ce
commit
6d8b55a808
58
Makefile
58
Makefile
@@ -1,28 +1,34 @@
|
||||
SHELL := /bin/bash
|
||||
.DEFAULT_GOAL := build
|
||||
.PHONY: build install test
|
||||
.DEFAULT_GOAL := release
|
||||
.PHONY: debug release install test conan-create viewcoverage
|
||||
lcov := lcov
|
||||
|
||||
f_debug = build_debug
|
||||
f_release = build_release
|
||||
genhtml = genhtml
|
||||
docscdir = docs
|
||||
|
||||
build: ## Build the project for Release
|
||||
@echo ">>> Building the project for Release..."
|
||||
@if [ -d $(f_release) ]; then rm -fr $(f_release); fi
|
||||
@conan install . --build=missing -of $(f_release) -s build_type=Release --profile:build=default --profile:host=default
|
||||
cmake -S . -B $(f_release) -DCMAKE_TOOLCHAIN_FILE=$(f_release)/build/Release/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=OFF -DENABLE_SAMPLE=OFF
|
||||
@cmake --build $(f_release) -j 8
|
||||
define build_target
|
||||
@echo ">>> Building the project for $(1)..."
|
||||
@if [ -d $(2) ]; then rm -fr $(2); fi
|
||||
@conan install . --build=missing -of $(2) -s build_type=$(1)
|
||||
@cmake -S . -B $(2) -DCMAKE_TOOLCHAIN_FILE=$(2)/build/$(1)/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(1) -D$(3)
|
||||
@cmake --build $(2) --config $(1) -j 8
|
||||
endef
|
||||
|
||||
debug: ## Build Debug version of the library
|
||||
@$(call build_target,"Debug","$(f_debug)", "ENABLE_TESTING=ON")
|
||||
|
||||
release: ## Build Release version of the library
|
||||
@$(call build_target,"Release","$(f_release)", "ENABLE_TESTING=OFF")
|
||||
|
||||
install: ## Install the project
|
||||
@echo ">>> Installing the project..."
|
||||
@cmake --build build_release --target install -j 8
|
||||
@cmake --build $(f_release) --target install -j 8
|
||||
|
||||
test: ## Build Debug version and run tests
|
||||
@echo ">>> Building Debug version and running tests..."
|
||||
@if [ -d $(f_debug) ]; then rm -fr $(f_debug); fi
|
||||
@conan install . --build=missing -of $(f_debug) -s build_type=Debug
|
||||
@cmake -B $(f_debug) -S . -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=$(f_debug)/build/Debug/generators/conan_toolchain.cmake -DENABLE_TESTING=ON -DENABLE_SAMPLE=ON
|
||||
@cmake --build $(f_debug) -j 8
|
||||
@$(MAKE) debug;
|
||||
@cp -r tests/datasets $(f_debug)/tests/datasets
|
||||
@cd $(f_debug)/tests && ctest --output-on-failure -j 8
|
||||
@cd $(f_debug)/tests && $(lcov) --capture --directory ../ --demangle-cpp --ignore-errors source,source --ignore-errors mismatch --output-file coverage.info >/dev/null 2>&1; \
|
||||
@@ -30,7 +36,8 @@ test: ## Build Debug version and run tests
|
||||
$(lcov) --remove coverage.info 'lib/*' --output-file coverage.info >/dev/null 2>&1; \
|
||||
$(lcov) --remove coverage.info 'libtorch/*' --output-file coverage.info >/dev/null 2>&1; \
|
||||
$(lcov) --remove coverage.info 'tests/*' --output-file coverage.info >/dev/null 2>&1; \
|
||||
$(lcov) --remove coverage.info 'gtest/*' --output-file coverage.info >/dev/null 2>&1;
|
||||
$(lcov) --remove coverage.info 'gtest/*' --output-file coverage.info >/dev/null 2>&1; \
|
||||
$(lcov) --remove coverage.info '*/.conan2/*' --ignore-errors unused --output-file coverage.info >/dev/null 2>&1;
|
||||
@genhtml $(f_debug)/tests/coverage.info --demangle-cpp --output-directory $(f_debug)/tests/coverage --title "Discretizer mdlp Coverage Report" -s -k -f --legend
|
||||
@echo "* Coverage report is generated at $(f_debug)/tests/coverage/index.html"
|
||||
@which python || (echo ">>> Please install python"; exit 1)
|
||||
@@ -39,4 +46,25 @@ test: ## Build Debug version and run tests
|
||||
exit 1; \
|
||||
fi
|
||||
@echo ">>> Updating coverage badge..."
|
||||
@env python update_coverage.py $(f_debug)/tests
|
||||
@env python update_coverage.py $(f_debug)/tests
|
||||
@echo ">>> Done"
|
||||
|
||||
viewcoverage: ## View the html coverage report
|
||||
@which $(genhtml) >/dev/null || (echo ">>> Please install lcov (genhtml not found)"; exit 1)
|
||||
@if [ ! -d $(docscdir)/coverage ]; then mkdir -p $(docscdir)/coverage; fi
|
||||
@if [ ! -f $(f_debug)/tests/coverage.info ]; then \
|
||||
echo ">>> No coverage.info file found. Run make coverage first!"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@$(genhtml) $(f_debug)/tests/coverage.info --demangle-cpp --output-directory $(docscdir)/coverage --title "FImdlp Coverage Report" -s -k -f --legend >/dev/null 2>&1;
|
||||
@xdg-open $(docscdir)/coverage/index.html || open $(docscdir)/coverage/index.html 2>/dev/null
|
||||
@echo ">>> Done";
|
||||
|
||||
conan-create: ## Create the conan package
|
||||
@echo ">>> Creating the conan package..."
|
||||
conan create . --build=missing -tf "" -s:a build_type=Release
|
||||
conan create . --build=missing -tf "" -s:a build_type=Debug -o "&:enable_testing=False"
|
||||
@echo ">>> Done"
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user