Compare commits

2 Commits

Author SHA1 Message Date
8807cd513c Continue conan integration 2025-06-28 11:06:16 +02:00
91df2f5e02 Begin conan integration 2025-06-28 10:52:13 +02:00
6 changed files with 62 additions and 8 deletions

26
.gitignore vendored
View File

@@ -37,4 +37,28 @@ build_*/**
cmake-build*/**
.idea
puml/**
.vscode/settings.json
.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

View File

@@ -7,6 +7,7 @@ project(Folding
)
find_package(Torch REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
if (POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
@@ -37,9 +38,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)

9
CMakeUserPresets.json Normal file
View File

@@ -0,0 +1,9 @@
{
"version": 4,
"vendor": {
"conan": {}
},
"include": [
"build_Debug/CMakePresets.json"
]
}

View File

@@ -28,7 +28,8 @@ 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);
@cmake -S . -B $(f_debug) -D CMAKE_BUILD_TYPE=Debug -D ENABLE_TESTING=ON
@conan install . --output-folder=$(f_debug) --build=missing --profile:build=default --profile:host=default
@cmake -S . -B $(f_debug) -D CMAKE_BUILD_TYPE=Debug -D ENABLE_TESTING=ON -D CMAKE_TOOLCHAIN_FILE=$(f_debug)/conan_toolchain.cmake
@echo ">>> Done";
opt = ""

View File

@@ -1,6 +1,7 @@
import re
from conan import ConanFile
from conan.tools.files import copy
from conan.tools.cmake import CMakeToolchain
class FoldingConan(ConanFile):
@@ -14,6 +15,21 @@ 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 generate(self):
tc = CMakeToolchain(self)
tc.generate()
def init(self):
# Read the CMakeLists.txt file to get the version

View File

@@ -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)