Fix debug conan build target

This commit is contained in:
2025-07-02 11:03:41 +02:00
parent 4e5f39f803
commit fa1b063be0
5 changed files with 32 additions and 137 deletions

View File

@@ -15,7 +15,6 @@ find_package(Torch CONFIG REQUIRED)
# Options
# -------
option(ENABLE_TESTING OFF)
option(ENABLE_SAMPLE OFF)
option(COVERAGE OFF)
add_subdirectory(config)
@@ -26,20 +25,24 @@ if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-default-inline")
endif()
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Debug mode")
else()
message(STATUS "Release mode")
endif()
if (ENABLE_TESTING)
message("Debug mode")
message(STATUS "Testing is enabled")
enable_testing()
set(CODE_COVERAGE ON)
set(GCC_COVERAGE_LINK_FLAGS "${GCC_COVERAGE_LINK_FLAGS} -lgcov --coverage")
add_subdirectory(tests)
else()
message("Release mode")
message(STATUS "Testing is disabled")
endif()
if (ENABLE_SAMPLE)
message("Building sample")
add_subdirectory(sample)
endif()
message(STATUS "Building sample")
add_subdirectory(sample)
include_directories(
${fimdlp_SOURCE_DIR}/src

View File

@@ -1,11 +0,0 @@
{
"version": 4,
"vendor": {
"conan": {}
},
"include": [
"build_release/build/Release/generators/CMakePresets.json",
"build_debug/build/Debug/generators/CMakePresets.json",
"build/Release/generators/CMakePresets.json"
]
}

View File

@@ -1,28 +1,36 @@
SHELL := /bin/bash
.DEFAULT_GOAL := build
.PHONY: build install test
.DEFAULT_GOAL := release
.PHONY: debug release install test conan-create
lcov := lcov
f_debug = build_debug
f_release = build_release
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
@if [ ! -d $(f_debug) ]; then \
$(MAKE) debug; \
else \
echo ">>> Debug build already exists, skipping build."; \
fi
@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; \
@@ -44,7 +52,7 @@ test: ## Build Debug version and run tests
conan-create: ## Create the conan package
@echo ">>> Creating the conan package..."
conan create . --build=missing --pr:b=release -pr:h=release
# conan create . --build=missing -pr:b=debug -pr:h=debug
conan create . --build=missing -pr:b=debug -pr:h=debug

View File

@@ -1,101 +0,0 @@
# This is the CMakeCache file.
# For build in directory: /home/rmontanana/Code/mdlp/build_conan
# It was generated by CMake: /usr/bin/cmake
# You can edit this file to change values found and used by cmake.
# If you do not want to change any of the values, simply exit the editor.
# If you do want to change a value, simply edit, save, and exit the editor.
# The syntax for the file is as follows:
# KEY:TYPE=VALUE
# KEY is the name of a variable in the cache.
# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
# VALUE is the current value for the KEY.
########################
# EXTERNAL cache entries
########################
//No help, variable specified on the command line.
CMAKE_BUILD_TYPE:UNINITIALIZED=Release
//Value Computed by CMake.
CMAKE_FIND_PACKAGE_REDIRECTS_DIR:STATIC=/home/rmontanana/Code/mdlp/build_conan/CMakeFiles/pkgRedirects
//Value Computed by CMake
CMAKE_PROJECT_DESCRIPTION:STATIC=Discretization algorithm based on the paper by Fayyad & Irani Multi-Interval Discretization of Continuous-Valued Attributes for Classification Learning.
//Value Computed by CMake
CMAKE_PROJECT_HOMEPAGE_URL:STATIC=https://github.com/rmontanana/mdlp
//Value Computed by CMake
CMAKE_PROJECT_NAME:STATIC=fimdlp
//Value Computed by CMake
CMAKE_PROJECT_VERSION:STATIC=2.1.0
//Value Computed by CMake
CMAKE_PROJECT_VERSION_MAJOR:STATIC=2
//Value Computed by CMake
CMAKE_PROJECT_VERSION_MINOR:STATIC=1
//Value Computed by CMake
CMAKE_PROJECT_VERSION_PATCH:STATIC=0
//Value Computed by CMake
CMAKE_PROJECT_VERSION_TWEAK:STATIC=
//No help, variable specified on the command line.
CMAKE_TOOLCHAIN_FILE:UNINITIALIZED=conan_toolchain.cmake
//Value Computed by CMake
fimdlp_BINARY_DIR:STATIC=/home/rmontanana/Code/mdlp/build_conan
//Value Computed by CMake
fimdlp_IS_TOP_LEVEL:STATIC=ON
//Value Computed by CMake
fimdlp_SOURCE_DIR:STATIC=/home/rmontanana/Code/mdlp
########################
# INTERNAL cache entries
########################
//This is the directory where this CMakeCache.txt was created
CMAKE_CACHEFILE_DIR:INTERNAL=/home/rmontanana/Code/mdlp/build_conan
//Major version of cmake used to create the current loaded cache
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
//Minor version of cmake used to create the current loaded cache
CMAKE_CACHE_MINOR_VERSION:INTERNAL=30
//Patch version of cmake used to create the current loaded cache
CMAKE_CACHE_PATCH_VERSION:INTERNAL=8
//Path to CMake executable.
CMAKE_COMMAND:INTERNAL=/usr/bin/cmake
//Path to cpack program executable.
CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack
//Path to ctest program executable.
CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest
//Path to cache edit program executable.
CMAKE_EDIT_COMMAND:INTERNAL=/usr/bin/ccmake
//Name of external makefile project generator.
CMAKE_EXTRA_GENERATOR:INTERNAL=
//Name of generator.
CMAKE_GENERATOR:INTERNAL=Unix Makefiles
//Generator instance identifier.
CMAKE_GENERATOR_INSTANCE:INTERNAL=
//Name of generator platform.
CMAKE_GENERATOR_PLATFORM:INTERNAL=
//Name of generator toolset.
CMAKE_GENERATOR_TOOLSET:INTERNAL=
//Source directory with the top level CMakeLists.txt file for this
// project
CMAKE_HOME_DIRECTORY:INTERNAL=/home/rmontanana/Code/mdlp
//number of local generators
CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1
//Platform information initialized
CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1
//Path to CMake installation.
CMAKE_ROOT:INTERNAL=/usr/share/cmake
//uname command
CMAKE_UNAME:INTERNAL=/usr/bin/uname

View File

@@ -1,14 +1,10 @@
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_BUILD_TYPE Debug)
find_package(arff-files REQUIRED)
include_directories(
${fimdlp_SOURCE_DIR}/src
${fimdlp_SOURCE_DIR}/tests/lib/Files
${CMAKE_BINARY_DIR}/configured_files/include
${libtorch_INCLUDE_DIRS_RELEASE}
${arff-files_INCLUDE_DIRS}
)