diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/libsvm | |
Diffstat (limited to 'vcpkg/ports/libsvm')
| -rw-r--r-- | vcpkg/ports/libsvm/CMakeLists.txt | 62 | ||||
| -rw-r--r-- | vcpkg/ports/libsvm/portfile.cmake | 43 | ||||
| -rw-r--r-- | vcpkg/ports/libsvm/vcpkg.json | 22 |
3 files changed, 127 insertions, 0 deletions
diff --git a/vcpkg/ports/libsvm/CMakeLists.txt b/vcpkg/ports/libsvm/CMakeLists.txt new file mode 100644 index 0000000..560b053 --- /dev/null +++ b/vcpkg/ports/libsvm/CMakeLists.txt @@ -0,0 +1,62 @@ +cmake_minimum_required(VERSION 3.14)
+
+project(libsvm LANGUAGES C CXX)
+
+include(GNUInstallDirs)
+
+option(SVM_BUILD_TOOLS "Build SVM tools" OFF)
+
+set(libsvm_sources svm.cpp)
+if (WIN32)
+ list(APPEND libsvm_sources svm.def)
+endif ()
+
+add_library(libsvm ${libsvm_sources})
+
+target_compile_definitions(
+ libsvm
+ PRIVATE
+ $<$<C_COMPILER_ID:MSVC>:
+ _CRT_SECURE_NO_WARNINGS
+ strdup=_strdup
+ >
+)
+
+target_include_directories(
+ libsvm
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+)
+
+set_target_properties(libsvm PROPERTIES PUBLIC_HEADER svm.h)
+
+install(TARGETS libsvm EXPORT unofficial-libsvm-config)
+
+install(
+ EXPORT unofficial-libsvm-config
+ NAMESPACE unofficial::libsvm::
+ DESTINATION share/unofficial-libsvm
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+)
+
+if (SVM_BUILD_TOOLS)
+ add_executable(svm-predict svm-predict.c)
+ target_link_libraries(svm-predict PRIVATE libsvm)
+
+ add_executable(svm-scale svm-scale.c)
+ target_link_libraries(svm-scale PRIVATE libsvm)
+
+ add_executable(svm-train svm-train.c)
+ target_link_libraries(svm-train PRIVATE libsvm)
+
+ install(TARGETS svm-predict svm-scale svm-train)
+
+ if (WIN32)
+ add_executable(svm-toy svm-toy/windows/svm-toy.cpp)
+ target_link_libraries(svm-toy PRIVATE libsvm)
+ set_target_properties(svm-toy PROPERTIES WIN32_EXECUTABLE ON)
+
+ install(TARGETS svm-toy)
+ endif ()
+endif ()
diff --git a/vcpkg/ports/libsvm/portfile.cmake b/vcpkg/ports/libsvm/portfile.cmake new file mode 100644 index 0000000..347c288 --- /dev/null +++ b/vcpkg/ports/libsvm/portfile.cmake @@ -0,0 +1,43 @@ +
+string(REPLACE "." "" LIBSVM_VERSION "${VERSION}")
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO cjlin1/libsvm
+ REF "v${LIBSVM_VERSION}"
+ SHA512 b05d1153c17bb585495785372810807ff695afbda23dd88ecb67a282d7c752068e2a0f6fa779aca2132c6bf3396bdf10b97665849e4aae4c76de98c2f095beab + HEAD_REF master
+)
+
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
+
+vcpkg_check_features(
+ OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ tools SVM_BUILD_TOOLS
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS_DEBUG
+ -DSVM_BUILD_TOOLS=OFF
+ OPTIONS_RELEASE
+ ${FEATURE_OPTIONS}
+)
+
+vcpkg_cmake_install()
+
+vcpkg_copy_pdbs()
+
+vcpkg_cmake_config_fixup(PACKAGE_NAME "unofficial-${PORT}" CONFIG_PATH "share/unofficial-${PORT}")
+
+if("tools" IN_LIST FEATURES)
+ if(VCPKG_TARGET_IS_WINDOWS)
+ vcpkg_copy_tools(TOOL_NAMES svm-predict svm-scale svm-toy svm-train AUTO_CLEAN)
+ else()
+ vcpkg_copy_tools(TOOL_NAMES svm-predict svm-scale svm-train AUTO_CLEAN)
+ endif()
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+file(INSTALL "${SOURCE_PATH}/COPYRIGHT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
diff --git a/vcpkg/ports/libsvm/vcpkg.json b/vcpkg/ports/libsvm/vcpkg.json new file mode 100644 index 0000000..9914a29 --- /dev/null +++ b/vcpkg/ports/libsvm/vcpkg.json @@ -0,0 +1,22 @@ +{ + "name": "libsvm", + "version": "3.35", + "description": "A library for Support Vector Machines.", + "homepage": "https://www.csie.ntu.edu.tw/~cjlin/libsvm/", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "tools": { + "description": "build libsvm CLI tools.", + "supports": "!uwp" + } + } +} |