Fix main cmake and tests cmake
Some checks failed
CI/CD Pipeline / Code Linting (push) Failing after 16s
CI/CD Pipeline / Build and Test (Debug, clang, ubuntu-latest) (push) Failing after 5m10s
CI/CD Pipeline / Build and Test (Debug, gcc, ubuntu-latest) (push) Failing after 5m27s
CI/CD Pipeline / Build and Test (Release, clang, ubuntu-20.04) (push) Failing after 5m38s
CI/CD Pipeline / Build and Test (Release, clang, ubuntu-latest) (push) Failing after 5m19s
CI/CD Pipeline / Build and Test (Release, gcc, ubuntu-20.04) (push) Failing after 5m29s
CI/CD Pipeline / Build and Test (Release, gcc, ubuntu-latest) (push) Failing after 5m33s
CI/CD Pipeline / Docker Build Test (push) Failing after 23s
CI/CD Pipeline / Performance Benchmarks (push) Has been skipped
CI/CD Pipeline / Build Documentation (push) Failing after 12s
CI/CD Pipeline / Create Release Package (push) Has been skipped
Some checks failed
CI/CD Pipeline / Code Linting (push) Failing after 16s
CI/CD Pipeline / Build and Test (Debug, clang, ubuntu-latest) (push) Failing after 5m10s
CI/CD Pipeline / Build and Test (Debug, gcc, ubuntu-latest) (push) Failing after 5m27s
CI/CD Pipeline / Build and Test (Release, clang, ubuntu-20.04) (push) Failing after 5m38s
CI/CD Pipeline / Build and Test (Release, clang, ubuntu-latest) (push) Failing after 5m19s
CI/CD Pipeline / Build and Test (Release, gcc, ubuntu-20.04) (push) Failing after 5m29s
CI/CD Pipeline / Build and Test (Release, gcc, ubuntu-latest) (push) Failing after 5m33s
CI/CD Pipeline / Docker Build Test (push) Failing after 23s
CI/CD Pipeline / Performance Benchmarks (push) Has been skipped
CI/CD Pipeline / Build Documentation (push) Failing after 12s
CI/CD Pipeline / Create Release Package (push) Has been skipped
This commit is contained in:
101
CMakeLists.txt
101
CMakeLists.txt
@@ -74,12 +74,12 @@ set(HEADERS
|
|||||||
# Create library
|
# Create library
|
||||||
add_library(svm_classifier STATIC ${SOURCES} ${HEADERS})
|
add_library(svm_classifier STATIC ${SOURCES} ${HEADERS})
|
||||||
|
|
||||||
# Link libraries
|
# Link libraries with PRIVATE linkage to avoid export issues
|
||||||
target_link_libraries(svm_classifier
|
target_link_libraries(svm_classifier
|
||||||
PUBLIC
|
PUBLIC
|
||||||
${TORCH_LIBRARIES}
|
${TORCH_LIBRARIES}
|
||||||
nlohmann_json::nlohmann_json
|
|
||||||
PRIVATE
|
PRIVATE
|
||||||
|
nlohmann_json::nlohmann_json
|
||||||
libsvm_static
|
libsvm_static
|
||||||
liblinear_static
|
liblinear_static
|
||||||
)
|
)
|
||||||
@@ -100,9 +100,6 @@ target_compile_features(svm_classifier PUBLIC cxx_std_17)
|
|||||||
# Set torch CXX flags
|
# Set torch CXX flags
|
||||||
set_property(TARGET svm_classifier PROPERTY CXX_STANDARD 17)
|
set_property(TARGET svm_classifier PROPERTY CXX_STANDARD 17)
|
||||||
|
|
||||||
# Add examples
|
|
||||||
add_subdirectory(examples)
|
|
||||||
|
|
||||||
# Set default installation paths
|
# Set default installation paths
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
set(CMAKE_INSTALL_DOCDIR ${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME})
|
set(CMAKE_INSTALL_DOCDIR ${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME})
|
||||||
@@ -175,43 +172,93 @@ if(BUILD_DOCUMENTATION OR DOXYGEN_FOUND)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Memory check target (if valgrind is available)
|
||||||
|
find_program(VALGRIND valgrind)
|
||||||
|
if(VALGRIND)
|
||||||
|
add_custom_target(test_memcheck
|
||||||
|
COMMAND ${VALGRIND} --tool=memcheck --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --error-exitcode=1 $<TARGET_FILE:svm_classifier_tests>
|
||||||
|
DEPENDS svm_classifier_tests
|
||||||
|
COMMENT "Running memory check with Valgrind"
|
||||||
|
)
|
||||||
|
message(STATUS "Memory check target 'test_memcheck' available")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Performance profiling target (if perf is available)
|
||||||
|
find_program(PERF perf)
|
||||||
|
if(PERF)
|
||||||
|
add_custom_target(test_profile
|
||||||
|
COMMAND ${PERF} record --call-graph=dwarf $<TARGET_FILE:svm_classifier_tests>
|
||||||
|
DEPENDS svm_classifier_tests
|
||||||
|
COMMENT "Running performance profiling with perf"
|
||||||
|
)
|
||||||
|
message(STATUS "Performance profiling target 'test_profile' available")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Enable testing
|
# Enable testing
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
|
||||||
# Installation
|
# Add examples
|
||||||
|
add_subdirectory(examples)
|
||||||
|
|
||||||
|
# Installation - Fixed version
|
||||||
install(TARGETS svm_classifier
|
install(TARGETS svm_classifier
|
||||||
EXPORT SVMClassifierTargets
|
EXPORT SVMClassifierTargets
|
||||||
LIBRARY DESTINATION lib
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
ARCHIVE DESTINATION lib
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
INCLUDES DESTINATION include
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
install(DIRECTORY include/ DESTINATION include)
|
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
|
|
||||||
install(EXPORT SVMClassifierTargets
|
# Create package configuration files
|
||||||
FILE SVMClassifierTargets.cmake
|
include(CMakePackageConfigHelpers)
|
||||||
NAMESPACE SVMClassifier::
|
|
||||||
DESTINATION lib/cmake/SVMClassifier
|
|
||||||
)
|
|
||||||
|
|
||||||
# Create config file
|
# Create config file
|
||||||
include(CMakePackageConfigHelpers)
|
configure_package_config_file(
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/SVMClassifierConfig.cmake.in"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/SVMClassifierConfig.cmake"
|
||||||
|
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/SVMClassifier
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create version file
|
||||||
write_basic_package_version_file(
|
write_basic_package_version_file(
|
||||||
SVMClassifierConfigVersion.cmake
|
"${CMAKE_CURRENT_BINARY_DIR}/SVMClassifierConfigVersion.cmake"
|
||||||
VERSION ${PACKAGE_VERSION}
|
VERSION ${PROJECT_VERSION}
|
||||||
COMPATIBILITY AnyNewerVersion
|
COMPATIBILITY AnyNewerVersion
|
||||||
)
|
)
|
||||||
|
|
||||||
configure_package_config_file(
|
# Install config files
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/SVMClassifierConfig.cmake.in
|
install(FILES
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/SVMClassifierConfig.cmake
|
"${CMAKE_CURRENT_BINARY_DIR}/SVMClassifierConfig.cmake"
|
||||||
INSTALL_DESTINATION lib/cmake/SVMClassifier
|
"${CMAKE_CURRENT_BINARY_DIR}/SVMClassifierConfigVersion.cmake"
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/SVMClassifier
|
||||||
)
|
)
|
||||||
|
|
||||||
install(FILES
|
# Install export targets
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/SVMClassifierConfig.cmake
|
install(EXPORT SVMClassifierTargets
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/SVMClassifierConfigVersion.cmake
|
FILE SVMClassifierTargets.cmake
|
||||||
DESTINATION lib/cmake/SVMClassifier
|
NAMESPACE SVMClassifier::
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/SVMClassifier
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Package configuration
|
||||||
|
set(CPACK_PACKAGE_NAME "SVMClassifier")
|
||||||
|
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
|
||||||
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "High-performance SVM classifier with scikit-learn compatible API")
|
||||||
|
set(CPACK_PACKAGE_VENDOR "SVMClassifier Development Team")
|
||||||
|
set(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README.md)
|
||||||
|
|
||||||
|
# Platform-specific package settings
|
||||||
|
if(WIN32)
|
||||||
|
set(CPACK_GENERATOR "NSIS;ZIP")
|
||||||
|
elseif(APPLE)
|
||||||
|
set(CPACK_GENERATOR "TGZ;DragNDrop")
|
||||||
|
else()
|
||||||
|
set(CPACK_GENERATOR "TGZ;DEB;RPM")
|
||||||
|
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libstdc++6, libblas3, liblapack3")
|
||||||
|
set(CPACK_RPM_PACKAGE_REQUIRES "glibc, libstdc++, blas, lapack")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(CPack)
|
@@ -98,7 +98,7 @@ endif()
|
|||||||
# Add memory check with valgrind if available
|
# Add memory check with valgrind if available
|
||||||
find_program(VALGRIND_EXECUTABLE valgrind)
|
find_program(VALGRIND_EXECUTABLE valgrind)
|
||||||
if(VALGRIND_EXECUTABLE)
|
if(VALGRIND_EXECUTABLE)
|
||||||
add_custom_target(test_memcheck
|
add_custom_target(tests_memcheck
|
||||||
COMMAND ${VALGRIND_EXECUTABLE} --tool=memcheck --leak-check=full --show-leak-kinds=all
|
COMMAND ${VALGRIND_EXECUTABLE} --tool=memcheck --leak-check=full --show-leak-kinds=all
|
||||||
--track-origins=yes --verbose --error-exitcode=1
|
--track-origins=yes --verbose --error-exitcode=1
|
||||||
$<TARGET_FILE:svm_classifier_tests>
|
$<TARGET_FILE:svm_classifier_tests>
|
||||||
@@ -106,20 +106,20 @@ if(VALGRIND_EXECUTABLE)
|
|||||||
COMMENT "Running tests with valgrind memory check"
|
COMMENT "Running tests with valgrind memory check"
|
||||||
)
|
)
|
||||||
|
|
||||||
message(STATUS "Memory check target 'test_memcheck' available")
|
message(STATUS "Memory check target 'tests_memcheck' available")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Performance profiling with perf if available
|
# Performance profiling with perf if available
|
||||||
find_program(PERF_EXECUTABLE perf)
|
find_program(PERF_EXECUTABLE perf)
|
||||||
if(PERF_EXECUTABLE)
|
if(PERF_EXECUTABLE)
|
||||||
add_custom_target(test_profile
|
add_custom_target(tests_profile
|
||||||
COMMAND ${PERF_EXECUTABLE} record -g $<TARGET_FILE:svm_classifier_tests> [performance]
|
COMMAND ${PERF_EXECUTABLE} record -g $<TARGET_FILE:svm_classifier_tests> [performance]
|
||||||
COMMAND ${PERF_EXECUTABLE} report
|
COMMAND ${PERF_EXECUTABLE} report
|
||||||
DEPENDS svm_classifier_tests
|
DEPENDS svm_classifier_tests
|
||||||
COMMENT "Running performance tests with profiling"
|
COMMENT "Running performance tests with profiling"
|
||||||
)
|
)
|
||||||
|
|
||||||
message(STATUS "Performance profiling target 'test_profile' available")
|
message(STATUS "Performance profiling target 'tests_profile' available")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Set test properties
|
# Set test properties
|
||||||
|
Reference in New Issue
Block a user