From 91df2f5e023fc6aab50a6327fa1cd33ef085c714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Monta=C3=B1ana=20G=C3=B3mez?= Date: Sat, 28 Jun 2025 10:52:13 +0200 Subject: [PATCH] Begin conan integration --- .gitignore | 26 +++++++++++++++++++++++++- CMakeLists.txt | 6 +++--- Makefile | 1 + conanfile.py | 11 +++++++++++ tests/CMakeLists.txt | 9 ++++++--- 5 files changed, 46 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index ee40879..1573607 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,28 @@ build_*/** cmake-build*/** .idea puml/** -.vscode/settings.json \ No newline at end of file +.vscode/settings.json + +# CMake generated files +CMakeFiles/ +CMakeCache.txt +cmake_install.cmake +compile_commands.json +Makefile +CTestTestfile.cmake +DartConfiguration.tcl +Testing/ +CMakePresets.json + +# Conan generated files +conan_toolchain.cmake +conan*.sh +deactivate_*.sh +cmakedeps*.cmake +conandeps*.cmake +*-Target-*.cmake +*-debug-*.cmake +*Config*.cmake +*Targets.cmake +Find*.cmake +module-*.cmake \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index fa57206..0f8fc06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,9 +37,9 @@ include(AddGitSubmodule) # ------- if (ENABLE_TESTING) MESSAGE("Testing enabled") - add_git_submodule("tests/lib/Catch2") - add_git_submodule("tests/lib/Files") - add_git_submodule("tests/lib/mdlp") + find_package(Catch2 REQUIRED) + find_package(arff-files REQUIRED) + find_package(fimdlp REQUIRED) include(CTest) add_subdirectory(tests) endif (ENABLE_TESTING) diff --git a/Makefile b/Makefile index 23fde4e..64ae8fd 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,7 @@ build: ## Build a debug version of the project @echo ">>> Building Debug Folding..."; @if [ -d ./$(f_debug) ]; then rm -rf ./$(f_debug); fi @mkdir $(f_debug); + @conan install . --output-folder=$(f_debug) --build=missing @cmake -S . -B $(f_debug) -D CMAKE_BUILD_TYPE=Debug -D ENABLE_TESTING=ON @echo ">>> Done"; diff --git a/conanfile.py b/conanfile.py index 95f8764..5d3d0a3 100644 --- a/conanfile.py +++ b/conanfile.py @@ -14,6 +14,17 @@ class FoldingConan(ConanFile): no_copy_source = True exports_sources = "folding.hpp" package_type = "header-library" + # build_type = "Debug" + + def requirements(self): + # Build dependency + self.requires("libtorch/2.7.0") + + def build_requirements(self): + # Test dependencies + self.test_requires("catch2/3.8.1") + self.test_requires("arff-files/1.2.0") + self.test_requires("fimdlp/2.0.1") def init(self): # Read the CMakeLists.txt file to get the version diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 25736c2..036c22e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -2,11 +2,14 @@ if(ENABLE_TESTING) include_directories( ${Folding_SOURCE_DIR} ${CMAKE_BINARY_DIR}/configured_files/include - lib/Files - lib/mdlp/src ) set(TEST_FOLDING "unit_tests_folding") add_executable(${TEST_FOLDING} TestFolding.cc TestUtils.cc) - target_link_libraries(${TEST_FOLDING} PUBLIC "${TORCH_LIBRARIES}" ArffFiles fimdlp Catch2::Catch2WithMain) + target_link_libraries(${TEST_FOLDING} PUBLIC + ${TORCH_LIBRARIES} + arff-files::arff-files + fimdlp::fimdlp + Catch2::Catch2WithMain + ) add_test(NAME ${TEST_FOLDING} COMMAND ${TEST_FOLDING}) endif(ENABLE_TESTING)