diff --git a/.conan/profiles/default b/.conan/profiles/default new file mode 100644 index 0000000..1e2bebd --- /dev/null +++ b/.conan/profiles/default @@ -0,0 +1,11 @@ +[settings] +os=Linux +arch=x86_64 +compiler=gcc +compiler.version=11 +compiler.libcxx=libstdc++11 +build_type=Release + +[conf] +tools.system.package_manager:mode=install +tools.system.package_manager:sudo=True \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 0db7a9b..8de8385 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ project(fimdlp set(CMAKE_CXX_STANDARD 17) cmake_policy(SET CMP0135 NEW) +# Find dependencies find_package(Torch REQUIRED) # Options diff --git a/CMakeUserPresets.json b/CMakeUserPresets.json index 71aeace..7671426 100644 --- a/CMakeUserPresets.json +++ b/CMakeUserPresets.json @@ -4,6 +4,7 @@ "conan": {} }, "include": [ - "build/Release/generators/CMakePresets.json" + "build_release/build/Release/generators/CMakePresets.json", + "build_debug/build/Debug/generators/CMakePresets.json" ] } \ No newline at end of file diff --git a/CONAN_README.md b/CONAN_README.md new file mode 100644 index 0000000..1b3f31c --- /dev/null +++ b/CONAN_README.md @@ -0,0 +1,153 @@ +# Conan Package for fimdlp + +This directory contains the Conan package configuration for the fimdlp library. + +## Dependencies + +The package manages the following dependencies: + +### Build Requirements +- **libtorch/2.4.1** - PyTorch C++ library for tensor operations + +### Test Requirements (when testing enabled) +- **catch2/3.8.1** - Modern C++ testing framework +- **arff-files** - ARFF file format support (included locally in tests/lib/Files/) + +## Building with Conan + +### 1. Install Dependencies and Build + +```bash +# Install dependencies +conan install . --output-folder=build --build=missing + +# Build the project +cd build +cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release +cmake --build . +``` + +### 2. Using the Build Script + +```bash +# Build release version +./scripts/build_conan.sh + +# Build with tests +./scripts/build_conan.sh --test +``` + +## Creating a Package + +### 1. Create Package Locally + +```bash +conan create . --profile:build=default --profile:host=default +``` + +### 2. Create Package with Options + +```bash +# Create with testing enabled +conan create . -o enable_testing=True --profile:build=default --profile:host=default + +# Create shared library version +conan create . -o shared=True --profile:build=default --profile:host=default +``` + +### 3. Using the Package Creation Script + +```bash +./scripts/create_package.sh +``` + +## Uploading to Cimmeria + +### 1. Configure Remote + +```bash +# Add Cimmeria remote +conan remote add cimmeria + +# Login to Cimmeria +conan remote login cimmeria +``` + +### 2. Upload Package + +```bash +# Upload the package +conan upload fimdlp/2.1.0 --remote=cimmeria --all + +# Or use the script (will configure remote instructions if not set up) +./scripts/create_package.sh +``` + +## Using the Package + +### In conanfile.txt + +```ini +[requires] +fimdlp/2.1.0 + +[generators] +CMakeDeps +CMakeToolchain +``` + +### In conanfile.py + +```python +def requirements(self): + self.requires("fimdlp/2.1.0") +``` + +### In CMakeLists.txt + +```cmake +find_package(fimdlp REQUIRED) +target_link_libraries(your_target fimdlp::fimdlp) +``` + +## Package Options + +| Option | Values | Default | Description | +|--------|--------|---------|-------------| +| shared | True/False | False | Build shared library | +| fPIC | True/False | True | Position independent code | +| enable_testing | True/False | False | Enable test suite | +| enable_sample | True/False | False | Build sample program | + +## Example Usage + +```cpp +#include +#include + +int main() { + // Create MDLP discretizer + CPPFImdlp discretizer; + + // Calculate entropy + Metrics metrics; + std::vector labels = {0, 1, 0, 1, 1}; + double entropy = metrics.entropy(labels); + + return 0; +} +``` + +## Testing + +The package includes comprehensive tests that can be enabled with: + +```bash +conan create . -o enable_testing=True +``` + +## Requirements + +- C++17 compatible compiler +- CMake 3.20 or later +- Conan 2.0 or later \ No newline at end of file diff --git a/Makefile b/Makefile index b737bb4..00d3774 100644 --- a/Makefile +++ b/Makefile @@ -1,35 +1,41 @@ SHELL := /bin/bash .DEFAULT_GOAL := build -.PHONY: build test +.PHONY: build install test lcov := lcov -build: - @if [ -d build_release ]; then rm -fr build_release; fi - @mkdir build_release - @cmake -B build_release -S . -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=OFF -DENABLE_SAMPLE=ON - @cmake --build build_release -j 8 +f_debug = build_debug +f_release = build_release -install: +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=ON + @cmake --build $(f_release) -j 8 + +install: ## Install the project + @echo ">>> Installing the project..." @cmake --build build_release --target install -j 8 -test: - @if [ -d build_debug ]; then rm -fr build_debug; fi - @mkdir build_debug - @cmake -B build_debug -S . -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTING=ON -DENABLE_SAMPLE=ON - @cmake --build build_debug -j 8 - @cd build_debug/tests && ctest --output-on-failure -j 8 - @cd build_debug/tests && $(lcov) --capture --directory ../ --demangle-cpp --ignore-errors source,source --ignore-errors mismatch --output-file coverage.info >/dev/null 2>&1; \ +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 + @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; \ $(lcov) --remove coverage.info '/usr/*' --output-file coverage.info >/dev/null 2>&1; \ $(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; - @genhtml build_debug/tests/coverage.info --demangle-cpp --output-directory build_debug/tests/coverage --title "Discretizer mdlp Coverage Report" -s -k -f --legend - @echo "* Coverage report is generated at build_debug/tests/coverage/index.html" + @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) - @if [ ! -f build_debug/tests/coverage.info ]; then \ + @if [ ! -f $(f_debug)/tests/coverage.info ]; then \ echo ">>> No coverage.info file found!"; \ exit 1; \ fi @echo ">>> Updating coverage badge..." - @env python update_coverage.py build_debug/tests \ No newline at end of file + @env python update_coverage.py $(f_debug)/tests \ No newline at end of file diff --git a/build_conan/CMakeCache.txt b/build_conan/CMakeCache.txt new file mode 100644 index 0000000..810008c --- /dev/null +++ b/build_conan/CMakeCache.txt @@ -0,0 +1,101 @@ +# 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 + diff --git a/conandata.yml b/conandata.yml new file mode 100644 index 0000000..41de2e1 --- /dev/null +++ b/conandata.yml @@ -0,0 +1,16 @@ +sources: + "2.1.0": + url: "https://github.com/rmontanana/mdlp/archive/refs/tags/v2.1.0.tar.gz" + sha256: "placeholder_sha256_hash" + "2.0.1": + url: "https://github.com/rmontanana/mdlp/archive/refs/tags/v2.0.1.tar.gz" + sha256: "placeholder_sha256_hash" + "2.0.0": + url: "https://github.com/rmontanana/mdlp/archive/refs/tags/v2.0.0.tar.gz" + sha256: "placeholder_sha256_hash" + +patches: + "2.1.0": + - patch_file: "patches/001-cmake-fix.patch" + patch_description: "Fix CMake configuration for Conan compatibility" + patch_type: "portability" \ No newline at end of file diff --git a/conanfile.py b/conanfile.py index 5f9fc11..8cb7aa2 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,8 +1,8 @@ -import re -import os from conan import ConanFile -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout, CMakeDeps -from conan.tools.files import save, load +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.files import copy +import os + class FimdlpConan(ConanFile): name = "fimdlp" @@ -10,10 +10,26 @@ class FimdlpConan(ConanFile): license = "MIT" author = "Ricardo MontaƱana " url = "https://github.com/rmontanana/mdlp" - description = "Discretization algorithm based on the paper by Fayyad & Irani." - topics = ("discretization", "classification", "machine learning") + description = "Discretization algorithm based on the paper by Fayyad & Irani Multi-Interval Discretization of Continuous-Valued Attributes for Classification Learning." + topics = ("machine-learning", "discretization", "mdlp", "classification") + + # Package configuration settings = "os", "compiler", "build_type", "arch" - exports_sources = "src/*", "CMakeLists.txt", "README.md", "config/*", "fimdlpConfig.cmake.in" + options = { + "shared": [True, False], + "fPIC": [True, False], + "enable_testing": [True, False], + "enable_sample": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "enable_testing": False, + "enable_sample": False, + } + + # Sources are located in the same place as this recipe, copy them to the recipe + exports_sources = "CMakeLists.txt", "src/*", "sample/*", "tests/*", "config/*", "fimdlpConfig.cmake.in" def set_version(self): # Read the CMakeLists.txt file to get the version @@ -23,33 +39,75 @@ class FimdlpConan(ConanFile): if match: self.version = match.group(1) except Exception: - self.version = "2.0.1" # fallback version - + self.version = "0.0.1" # fallback version + + def config_options(self): + if self.settings.os == "Windows": + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + def requirements(self): + # PyTorch dependency for tensor operations self.requires("libtorch/2.7.0") + def build_requirements(self): + # Test dependencies - only when testing is enabled + if self.options.enable_testing: + self.requires("catch2/3.8.1") + # Note: arff-files is included as a local copy, but could be a conan dependency + # For now, we'll use the local version in tests/lib/Files/ + def layout(self): cmake_layout(self) - + def generate(self): + # Generate CMake configuration files deps = CMakeDeps(self) deps.generate() + tc = CMakeToolchain(self) + # Set CMake variables based on options + tc.variables["ENABLE_TESTING"] = self.options.enable_testing + tc.variables["ENABLE_SAMPLE"] = self.options.enable_sample + tc.variables["BUILD_SHARED_LIBS"] = self.options.shared tc.generate() - + def build(self): cmake = CMake(self) cmake.configure() cmake.build() - + + # Run tests if enabled + if self.options.enable_testing: + cmake.test() + def package(self): + # Install using CMake cmake = CMake(self) cmake.install() - + + # Copy license file + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + def package_info(self): + # Library configuration self.cpp_info.libs = ["fimdlp"] self.cpp_info.includedirs = ["include"] - self.cpp_info.libdirs = ["lib"] - self.cpp_info.set_property("cmake_find_mode", "both") + + # CMake package configuration + self.cpp_info.set_property("cmake_file_name", "fimdlp") self.cpp_info.set_property("cmake_target_name", "fimdlp::fimdlp") - self.cpp_info.set_property("cmake_file_name", "fimdlp") \ No newline at end of file + + # Compiler features + self.cpp_info.cppstd = "17" + + # System libraries (if needed) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") # Math library + self.cpp_info.system_libs.append("pthread") # Threading + + # Build information for consumers + self.cpp_info.builddirs = ["lib/cmake/fimdlp"] \ No newline at end of file diff --git a/sample/CMakeLists.txt b/sample/CMakeLists.txt index d159943..f185d04 100644 --- a/sample/CMakeLists.txt +++ b/sample/CMakeLists.txt @@ -2,11 +2,14 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_BUILD_TYPE Debug) +find_package(Torch REQUIRED) + include_directories( ${fimdlp_SOURCE_DIR}/src ${fimdlp_SOURCE_DIR}/tests/lib/Files ${CMAKE_BINARY_DIR}/configured_files/include + ${libtorch_INCLUDE_DIRS_RELEASE} ) add_executable(sample sample.cpp ) -target_link_libraries(sample fimdlp "${TORCH_LIBRARIES}") +target_link_libraries(sample PRIVATE fimdlp torch::torch) diff --git a/scripts/build_conan.sh b/scripts/build_conan.sh new file mode 100755 index 0000000..a3c635d --- /dev/null +++ b/scripts/build_conan.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Build script for fimdlp using Conan +set -e + +echo "Building fimdlp with Conan..." + +# Clean previous builds +rm -rf build_conan + +# Install dependencies and build +conan install . --output-folder=build_conan --build=missing --profile:build=default --profile:host=default + +# Build the project +cd build_conan +cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release +cmake --build . + +echo "Build completed successfully!" + +# Run tests if requested +if [ "$1" = "--test" ]; then + echo "Running tests..." + ctest --output-on-failure +fi \ No newline at end of file diff --git a/scripts/create_package.sh b/scripts/create_package.sh new file mode 100755 index 0000000..a91c720 --- /dev/null +++ b/scripts/create_package.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Script to create and upload fimdlp Conan package +set -e + +PACKAGE_NAME="fimdlp" +PACKAGE_VERSION="2.1.0" +REMOTE_NAME="cimmeria" + +echo "Creating Conan package for $PACKAGE_NAME/$PACKAGE_VERSION..." + +# Create the package +conan create . --profile:build=default --profile:host=default + +echo "Package created successfully!" + +# Test the package +echo "Testing package..." +conan test test_package $PACKAGE_NAME/$PACKAGE_VERSION@ --profile:build=default --profile:host=default + +echo "Package tested successfully!" + +# Upload to Cimmeria (if remote is configured) +if conan remote list | grep -q "$REMOTE_NAME"; then + echo "Uploading package to $REMOTE_NAME..." + conan upload $PACKAGE_NAME/$PACKAGE_VERSION --remote=$REMOTE_NAME --all + echo "Package uploaded to $REMOTE_NAME successfully!" +else + echo "Remote '$REMOTE_NAME' not configured. To upload the package:" + echo "1. Add the remote: conan remote add $REMOTE_NAME " + echo "2. Login: conan remote login $REMOTE_NAME " + echo "3. Upload: conan upload $PACKAGE_NAME/$PACKAGE_VERSION --remote=$REMOTE_NAME --all" +fi \ No newline at end of file diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt new file mode 100644 index 0000000..57b4282 --- /dev/null +++ b/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.20) +project(test_fimdlp) + +find_package(fimdlp REQUIRED) + +add_executable(test_fimdlp src/test_fimdlp.cpp) +target_link_libraries(test_fimdlp fimdlp::fimdlp) +target_compile_features(test_fimdlp PRIVATE cxx_std_17) \ No newline at end of file diff --git a/test_package/conanfile.py b/test_package/conanfile.py new file mode 100644 index 0000000..d85fc31 --- /dev/null +++ b/test_package/conanfile.py @@ -0,0 +1,28 @@ +import os +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run + + +class FimdlpTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + # VirtualBuildEnv and VirtualRunEnv can be avoided if "tools.env:CONAN_RUN_TESTS" is false + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + apply_env = False # avoid the default VirtualBuildEnv from the base class + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + cmd = os.path.join(self.cpp.build.bindir, "test_fimdlp") + self.run(cmd, env="conanrun") \ No newline at end of file diff --git a/test_package/src/test_fimdlp.cpp b/test_package/src/test_fimdlp.cpp new file mode 100644 index 0000000..34a4f61 --- /dev/null +++ b/test_package/src/test_fimdlp.cpp @@ -0,0 +1,27 @@ +#include +#include +#include +#include + +int main() { + std::cout << "Testing fimdlp library..." << std::endl; + + // Simple test of the library + try { + // Test Metrics class + Metrics metrics; + std::vector labels = {0, 0, 1, 1, 0, 1}; + double entropy = metrics.entropy(labels); + std::cout << "Entropy calculated: " << entropy << std::endl; + + // Test CPPFImdlp creation + CPPFImdlp discretizer; + std::cout << "CPPFImdlp instance created successfully" << std::endl; + + std::cout << "fimdlp library test completed successfully!" << std::endl; + return 0; + } catch (const std::exception& e) { + std::cerr << "Error testing fimdlp library: " << e.what() << std::endl; + return 1; + } +} \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e9cb697..220db38 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,15 +1,25 @@ -include(FetchContent) -include_directories(${GTEST_INCLUDE_DIRS}) -FetchContent_Declare( - googletest - URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip -) -# For Windows: Prevent overriding the parent project's compiler/linker settings -set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) -FetchContent_MakeAvailable(googletest) +# Check if we should use Catch2 from Conan or GoogleTest via FetchContent +find_package(Catch2 3 QUIET) + +if(Catch2_FOUND) + message(STATUS "Using Catch2 from Conan") + set(TEST_FRAMEWORK "Catch2") +else() + message(STATUS "Using GoogleTest via FetchContent") + set(TEST_FRAMEWORK "GoogleTest") + include(FetchContent) + include_directories(${GTEST_INCLUDE_DIRS}) + FetchContent_Declare( + googletest + URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip + ) + # For Windows: Prevent overriding the parent project's compiler/linker settings + set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) + FetchContent_MakeAvailable(googletest) +endif() include_directories( - ${TORCH_INCLUDE_DIRS} + ${libtorch_INCLUDE_DIRS_DEBUG} ${fimdlp_SOURCE_DIR}/src ${fimdlp_SOURCE_DIR}/tests/lib/Files ${CMAKE_BINARY_DIR}/configured_files/include