Compile tests but fail linking

This commit is contained in:
2025-06-23 16:42:03 +02:00
parent 235367da01
commit 417844f19b
10 changed files with 83 additions and 22 deletions

View File

@@ -24,6 +24,7 @@ target_link_libraries(svm_classifier_tests
svm_classifier
Catch2::Catch2WithMain
nlohmann_json::nlohmann_json
$<$<TARGET_EXISTS:blas_functions>:blas_functions>
)
# Set include directories - Handle external libraries dynamically
@@ -32,6 +33,20 @@ target_include_directories(svm_classifier_tests
${CMAKE_SOURCE_DIR}/include
)
# Add Catch2 include directories explicitly
if(TARGET Catch2::Catch2)
get_target_property(CATCH2_INCLUDE_DIRS Catch2::Catch2 INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(svm_classifier_tests PRIVATE ${CATCH2_INCLUDE_DIRS})
endif()
# Also add the source directory of Catch2 if available
if(catch2_SOURCE_DIR)
target_include_directories(svm_classifier_tests
PRIVATE
${catch2_SOURCE_DIR}/src
)
endif()
# Add libsvm include directory if available
if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/../_deps/libsvm-src")
target_include_directories(svm_classifier_tests

View File

@@ -3,7 +3,8 @@
* @brief Unit tests for DataConverter class
*/
#include <catch2/catch_all.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <svm_classifier/data_converter.hpp>
#include <torch/torch.h>

View File

@@ -3,7 +3,8 @@
* @brief Unit tests for KernelParameters class
*/
#include <catch2/catch_all.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <svm_classifier/kernel_parameters.hpp>
#include <nlohmann/json.hpp>

View File

@@ -7,7 +7,7 @@
*/
#define CATCH_CONFIG_MAIN
#include <catch2/catch_all.hpp>
#include <catch2/catch_test_macros.hpp>
#include <torch/torch.h>
#include <iostream>

View File

@@ -3,7 +3,8 @@
* @brief Unit tests for multiclass strategy classes
*/
#include <catch2/catch_all.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <svm_classifier/multiclass_strategy.hpp>
#include <svm_classifier/kernel_parameters.hpp>
#include <svm_classifier/data_converter.hpp>

View File

@@ -3,7 +3,8 @@
* @brief Integration tests for SVMClassifier class
*/
#include <catch2/catch_all.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <svm_classifier/svm_classifier.hpp>
#include <torch/torch.h>
#include <nlohmann/json.hpp>