diff options
| author | myd7349 <myd7349@gmail.com> | 2019-08-20 01:43:58 +0800 |
|---|---|---|
| committer | Curtis J Bezault <curtbezault@gmail.com> | 2019-08-19 10:43:58 -0700 |
| commit | 432e357737fc0d0484edda3f114cec11c70d99e9 (patch) | |
| tree | 761115bf31ae514f13a6bad79d24e1d637537e55 | |
| parent | 20a0c30dd8a44a3c876608824f0d7b4f2c2dbb21 (diff) | |
| download | vcpkg-432e357737fc0d0484edda3f114cec11c70d99e9.tar.gz vcpkg-432e357737fc0d0484edda3f114cec11c70d99e9.zip | |
[libsvm] Add new port (#7664)
* [libsvm] Add new port
* [libsvm] Add tools feature
* [libsvm] Fix UWP build
| -rw-r--r-- | ports/libsvm/CMakeLists.txt | 62 | ||||
| -rw-r--r-- | ports/libsvm/CONTROL | 7 | ||||
| -rw-r--r-- | ports/libsvm/portfile.cmake | 64 |
3 files changed, 133 insertions, 0 deletions
diff --git a/ports/libsvm/CMakeLists.txt b/ports/libsvm/CMakeLists.txt new file mode 100644 index 000000000..560b05350 --- /dev/null +++ b/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/ports/libsvm/CONTROL b/ports/libsvm/CONTROL new file mode 100644 index 000000000..342536cce --- /dev/null +++ b/ports/libsvm/CONTROL @@ -0,0 +1,7 @@ +Source: libsvm
+Version: 323
+Description: A library for Support Vector Machines
+Homepage: https://www.csie.ntu.edu.tw/~cjlin/libsvm/
+
+Feature: tools
+Description: Build libsvm tools
diff --git a/ports/libsvm/portfile.cmake b/ports/libsvm/portfile.cmake new file mode 100644 index 000000000..f4f7c6960 --- /dev/null +++ b/ports/libsvm/portfile.cmake @@ -0,0 +1,64 @@ +include(vcpkg_common_functions)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO cjlin1/libsvm
+ REF v323
+ SHA512 c4abd408acf860c76cfc743e6c65d241fcb18443e741fc0f557f7cf7b4d0913c05f3afc5d49de8a42ff88db6fc7b046d08bcb0a3d2a24ba23e297ed1cfbb9131
+ HEAD_REF master
+)
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+
+vcpkg_check_features(
+ OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ tools SVM_BUILD_TOOLS
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS_DEBUG
+ -DSVM_BUILD_TOOLS=OFF
+ OPTIONS_RELEASE
+ ${FEATURE_OPTIONS}
+)
+
+vcpkg_install_cmake()
+
+vcpkg_copy_pdbs()
+
+vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-${PORT} TARGET_PATH share/unofficial-${PORT})
+
+# Install tools
+if ("tools" IN_LIST FEATURES)
+ if(VCPKG_TARGET_IS_WINDOWS)
+ set(EXECUTABLE_SUFFIX ".exe")
+ else()
+ set(EXECUTABLE_SUFFIX "")
+ endif()
+
+ foreach (libsvm_tool svm-predict svm-scale svm-toy svm-train)
+ if (EXISTS ${CURRENT_PACKAGES_DIR}/bin/${libsvm_tool}${EXECUTABLE_SUFFIX})
+ file(
+ COPY ${CURRENT_PACKAGES_DIR}/bin/${libsvm_tool}${EXECUTABLE_SUFFIX}
+ DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT}
+ )
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/${libsvm_tool}${EXECUTABLE_SUFFIX})
+ endif ()
+
+ vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT})
+ endforeach ()
+
+ if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
+ endif ()
+endif ()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Handle copyright
+configure_file(${SOURCE_PATH}/COPYRIGHT ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
+
+# CMake integration test
+vcpkg_test_cmake(PACKAGE_NAME unofficial-${PORT})
|
