Compile all
Some checks failed
CI/CD Pipeline / Code Linting (push) Failing after 25s
CI/CD Pipeline / Build and Test (Debug, clang, ubuntu-latest) (push) Failing after 5m4s
CI/CD Pipeline / Build and Test (Debug, gcc, ubuntu-latest) (push) Failing after 6m12s
CI/CD Pipeline / Build and Test (Release, clang, ubuntu-20.04) (push) Failing after 6m15s
CI/CD Pipeline / Build and Test (Release, clang, ubuntu-latest) (push) Failing after 5m14s
CI/CD Pipeline / Build and Test (Release, gcc, ubuntu-20.04) (push) Failing after 6m3s
CI/CD Pipeline / Build and Test (Release, gcc, ubuntu-latest) (push) Failing after 6m2s
CI/CD Pipeline / Docker Build Test (push) Failing after 1m13s
CI/CD Pipeline / Performance Benchmarks (push) Has been skipped
CI/CD Pipeline / Build Documentation (push) Failing after 30s
CI/CD Pipeline / Create Release Package (push) Has been skipped
Some checks failed
CI/CD Pipeline / Code Linting (push) Failing after 25s
CI/CD Pipeline / Build and Test (Debug, clang, ubuntu-latest) (push) Failing after 5m4s
CI/CD Pipeline / Build and Test (Debug, gcc, ubuntu-latest) (push) Failing after 6m12s
CI/CD Pipeline / Build and Test (Release, clang, ubuntu-20.04) (push) Failing after 6m15s
CI/CD Pipeline / Build and Test (Release, clang, ubuntu-latest) (push) Failing after 5m14s
CI/CD Pipeline / Build and Test (Release, gcc, ubuntu-20.04) (push) Failing after 6m3s
CI/CD Pipeline / Build and Test (Release, gcc, ubuntu-latest) (push) Failing after 6m2s
CI/CD Pipeline / Docker Build Test (push) Failing after 1m13s
CI/CD Pipeline / Performance Benchmarks (push) Has been skipped
CI/CD Pipeline / Build Documentation (push) Failing after 30s
CI/CD Pipeline / Create Release Package (push) Has been skipped
This commit is contained in:
@@ -49,8 +49,21 @@ FetchContent_Declare(
|
||||
)
|
||||
FetchContent_MakeAvailable(Catch2)
|
||||
|
||||
# Add external libraries
|
||||
add_subdirectory(external)
|
||||
# Fetch libsvm
|
||||
FetchContent_Declare(
|
||||
libsvm
|
||||
GIT_REPOSITORY https://github.com/cjlin1/libsvm.git
|
||||
GIT_TAG v332
|
||||
)
|
||||
FetchContent_MakeAvailable(libsvm)
|
||||
|
||||
# Fetch liblinear
|
||||
FetchContent_Declare(
|
||||
liblinear
|
||||
GIT_REPOSITORY https://github.com/cjlin1/liblinear.git
|
||||
GIT_TAG v249
|
||||
)
|
||||
FetchContent_MakeAvailable(liblinear)
|
||||
|
||||
# Include directories
|
||||
include_directories(${CMAKE_SOURCE_DIR}/include)
|
||||
@@ -71,25 +84,47 @@ set(HEADERS
|
||||
include/svm_classifier/types.hpp
|
||||
)
|
||||
|
||||
# Create library
|
||||
add_library(svm_classifier STATIC ${SOURCES} ${HEADERS})
|
||||
# Add external sources directly to our library
|
||||
set(EXTERNAL_SOURCES)
|
||||
|
||||
# Link libraries - Updated to use object libraries and BLAS if available
|
||||
# target_link_libraries(svm_classifier
|
||||
# PUBLIC
|
||||
# ${TORCH_LIBRARIES}
|
||||
# PRIVATE
|
||||
# nlohmann_json::nlohmann_json
|
||||
# $<TARGET_OBJECTS:libsvm_objects>
|
||||
# $<TARGET_OBJECTS:liblinear_objects>
|
||||
# $<$<TARGET_EXISTS:blas_functions>:blas_functions>
|
||||
# )
|
||||
# Add libsvm sources
|
||||
if(EXISTS "${libsvm_SOURCE_DIR}/svm.cpp")
|
||||
list(APPEND EXTERNAL_SOURCES "${libsvm_SOURCE_DIR}/svm.cpp")
|
||||
endif()
|
||||
|
||||
# Add liblinear sources
|
||||
if(EXISTS "${liblinear_SOURCE_DIR}/linear.cpp")
|
||||
list(APPEND EXTERNAL_SOURCES "${liblinear_SOURCE_DIR}/linear.cpp")
|
||||
endif()
|
||||
|
||||
if(EXISTS "${liblinear_SOURCE_DIR}/newton.cpp")
|
||||
list(APPEND EXTERNAL_SOURCES "${liblinear_SOURCE_DIR}/newton.cpp")
|
||||
elseif(EXISTS "${liblinear_SOURCE_DIR}/tron.cpp")
|
||||
list(APPEND EXTERNAL_SOURCES "${liblinear_SOURCE_DIR}/tron.cpp")
|
||||
endif()
|
||||
|
||||
# Add BLAS sources
|
||||
if(EXISTS "${liblinear_SOURCE_DIR}/blas")
|
||||
file(GLOB BLAS_C_FILES "${liblinear_SOURCE_DIR}/blas/*.c")
|
||||
list(APPEND EXTERNAL_SOURCES ${BLAS_C_FILES})
|
||||
endif()
|
||||
|
||||
# Create library with all sources
|
||||
add_library(svm_classifier STATIC ${SOURCES} ${HEADERS} ${EXTERNAL_SOURCES})
|
||||
|
||||
# Set language properties for different file types
|
||||
foreach(source_file ${EXTERNAL_SOURCES})
|
||||
if(source_file MATCHES "\\.c$")
|
||||
set_source_files_properties(${source_file} PROPERTIES LANGUAGE C)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Link libraries
|
||||
target_link_libraries(svm_classifier
|
||||
PUBLIC
|
||||
${TORCH_LIBRARIES}
|
||||
PRIVATE
|
||||
nlohmann_json::nlohmann_json
|
||||
$<$<TARGET_EXISTS:svm_external_combined>:svm_external_combined>
|
||||
)
|
||||
|
||||
# Set include directories
|
||||
@@ -99,27 +134,11 @@ target_include_directories(svm_classifier
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
${libsvm_SOURCE_DIR}
|
||||
${liblinear_SOURCE_DIR}
|
||||
${liblinear_SOURCE_DIR}/blas
|
||||
)
|
||||
|
||||
# Add include directories from external libraries using variables set by external/CMakeLists.txt
|
||||
if(LIBSVM_INCLUDE_DIR)
|
||||
target_include_directories(svm_classifier
|
||||
PRIVATE ${LIBSVM_INCLUDE_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(LIBLINEAR_INCLUDE_DIR)
|
||||
target_include_directories(svm_classifier
|
||||
PRIVATE ${LIBLINEAR_INCLUDE_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(LIBLINEAR_BLAS_INCLUDE_DIR)
|
||||
target_include_directories(svm_classifier
|
||||
PRIVATE ${LIBLINEAR_BLAS_INCLUDE_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Compiler-specific options
|
||||
target_compile_features(svm_classifier PUBLIC cxx_std_17)
|
||||
|
||||
@@ -227,7 +246,7 @@ add_subdirectory(tests)
|
||||
# Add examples
|
||||
add_subdirectory(examples)
|
||||
|
||||
# Installation - Fixed version
|
||||
# Installation
|
||||
install(TARGETS svm_classifier
|
||||
EXPORT SVMClassifierTargets
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
@@ -287,4 +306,4 @@ else()
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "glibc, libstdc++, blas, lapack")
|
||||
endif()
|
||||
|
||||
include(CPack)
|
||||
include(CPack)
|
||||
|
Reference in New Issue
Block a user