diff --git a/ports/shogun/CONTROL b/ports/shogun/CONTROL new file mode 100644 index 0000000000..6a05a331e4 --- /dev/null +++ b/ports/shogun/CONTROL @@ -0,0 +1,4 @@ +Source: shogun +Version: 6.1.3 +Build-Depends: bzip2, eigen3, liblzma, libxml2, openblas, nlopt, rxcpp, snappy, zlib, protobuf, curl, lzo, dirent +Description: Unified and efficient Machine Learning diff --git a/ports/shogun/MSDirent.cmake b/ports/shogun/MSDirent.cmake new file mode 100644 index 0000000000..dd895f9704 --- /dev/null +++ b/ports/shogun/MSDirent.cmake @@ -0,0 +1 @@ +find_path(MSDIRENT_INCLUDE_DIR NAMES dirent.h) diff --git a/ports/shogun/cmake.patch b/ports/shogun/cmake.patch new file mode 100644 index 0000000000..16f1c3ad45 --- /dev/null +++ b/ports/shogun/cmake.patch @@ -0,0 +1,73 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6c48bed..6f97c8b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -60,8 +60,8 @@ SET(SYSTEM_C_FLAGS "${CMAKE_C_FLAGS}") + SET(SYSTEM_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + STRING(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE_UC) + IF(NOT ("${BUILD_TYPE_UC}" STREQUAL "DISTRIBUTION")) +- SET(CMAKE_C_FLAGS "") +- SET(CMAKE_CXX_FLAGS "") ++# SET(CMAKE_C_FLAGS "") ++# SET(CMAKE_CXX_FLAGS "") + ENDIF(NOT ("${BUILD_TYPE_UC}" STREQUAL "DISTRIBUTION")) + + # CCACHE +@@ -184,12 +184,12 @@ SET(SWIG_CXX_COMPILER_FLAGS "-O0 -g") + SET(CMAKE_C_FLAGS "${COMPILER_WARNINGS} ${CMAKE_C_FLAGS}") + SET(CMAKE_CXX_FLAGS "${COMPILER_WARNINGS} ${CMAKE_CXX_FLAGS}") + IF(MSVC) +- SET(CMAKE_C_FLAGS_RELEASE "/O2 ${RELEASE_COMPILER_FLAGS}") +- SET(CMAKE_CXX_FLAGS_RELEASE "/O2 ${RELEASE_COMPILER_FLAGS}") +- SET(CMAKE_C_FLAGS_DISTRIBUTION "/Ot") +- SET(CMAKE_CXX_FLAGS_DISTRIBUTION "/Ot") +- SET(CMAKE_C_FLAGS_DEBUG "/DEBUG /Od /Zi") +- SET(CMAKE_CXX_FLAGS_DEBUG "/DEBUG /Od /Zi") ++ # SET(CMAKE_C_FLAGS_RELEASE "/O2 ${RELEASE_COMPILER_FLAGS}") ++ # SET(CMAKE_CXX_FLAGS_RELEASE "/O2 ${RELEASE_COMPILER_FLAGS}") ++ # SET(CMAKE_C_FLAGS_DISTRIBUTION "/Ot") ++ # SET(CMAKE_CXX_FLAGS_DISTRIBUTION "/Ot") ++ # SET(CMAKE_C_FLAGS_DEBUG "/DEBUG /Od /Zi") ++ # SET(CMAKE_CXX_FLAGS_DEBUG "/DEBUG /Od /Zi") + add_compile_options("/bigobj") + ELSE() + SET(CMAKE_C_FLAGS_RELEASE "-O3 ${RELEASE_COMPILER_FLAGS}") +diff --git a/cmake/version.cmake b/cmake/version.cmake +index fbca111..f6847f7 100644 +--- a/cmake/version.cmake ++++ b/cmake/version.cmake +@@ -5,7 +5,7 @@ SET(MAINVERSION ${VERSION}) + + SET(EXTRA "") + +-IF(EXISTS "${ROOT_DIR}/.git/") ++IF(EXISTS "${ROOT_DIR}/.git/" AND FALSE) + FIND_PACKAGE(Git QUIET) + IF (NOT GIT_FOUND) + MESSAGE(FATAL_ERROR "The source is checked out from a git repository, but cannot find git executable!") +diff --git a/src/shogun/CMakeLists.txt b/src/shogun/CMakeLists.txt +index 9e79786..fd76961 100644 +--- a/src/shogun/CMakeLists.txt ++++ b/src/shogun/CMakeLists.txt +@@ -145,7 +145,7 @@ endif() + # add target for static library if enabled + if (LIBSHOGUN_BUILD_STATIC) + add_library(shogun-static STATIC $ ${CMAKE_CURRENT_BINARY_DIR}/lib/config.h) +- set_property(TARGET shogun-static PROPERTY OUTPUT_NAME shogun) ++ set_property(TARGET shogun-static PROPERTY OUTPUT_NAME libshogun) + target_include_directories(shogun-static PUBLIC + $ + $ +@@ -492,10 +492,12 @@ ELSE() + ENDIF() + + # set the desidered targets to be installed ++if(NOT INSTALL_TARGETS) + set(INSTALL_TARGETS shogun) + if (LIBSHOGUN_BUILD_STATIC) + LIST(APPEND INSTALL_TARGETS shogun-static) + endif() ++endif() + + INSTALL( + TARGETS ${INSTALL_TARGETS} diff --git a/ports/shogun/portfile.cmake b/ports/shogun/portfile.cmake new file mode 100644 index 0000000000..24e258539f --- /dev/null +++ b/ports/shogun/portfile.cmake @@ -0,0 +1,67 @@ +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + message("shogun only supports static library linkage") + set(VCPKG_LIBRARY_LINKAGE "static") +endif() + +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO shogun-toolbox/shogun + REF shogun_6.1.3 + SHA512 11aeed456b13720099ca820ab9742c90ce4af2dc049602a425f8c44d2fa155327c7f1d3af2ec840666f600a91e75902d914ffe784d76ed35810da4f3a5815673 + HEAD_REF master +) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/cmake.patch +) + +file(REMOVE_RECURSE ${SOURCE_PATH}/cmake/external) +file(MAKE_DIRECTORY ${SOURCE_PATH}/cmake/external) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/MSDirent.cmake DESTINATION ${SOURCE_PATH}/cmake/external) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DBUILD_META_EXAMPLES=OFF + -DBUILD_EXAMPLES=OFF + -DUSE_SVMLIGHT=OFF + -DENABLE_TESTING=OFF + -DLICENSE_GPL_SHOGUN=OFF + # Conflicting definitions in OpenBLAS and Eigen + -DENABLE_EIGEN_LAPACK=OFF + + -DCMAKE_DISABLE_FIND_PACKAGE_JSON=TRUE + -DCMAKE_DISABLE_FIND_PACKAGE_ViennaCL=TRUE + -DCMAKE_DISABLE_FIND_PACKAGE_TFLogger=TRUE + -DCMAKE_DISABLE_FIND_PACKAGE_GLPK=TRUE + -DCMAKE_DISABLE_FIND_PACKAGE_CPLEX=TRUE + -DCMAKE_DISABLE_FIND_PACKAGE_ARPACK=TRUE + -DCMAKE_DISABLE_FIND_PACKAGE_Mosek=TRUE + -DCMAKE_DISABLE_FIND_PACKAGE_LpSolve=TRUE + -DCMAKE_DISABLE_FIND_PACKAGE_ColPack=TRUE + -DCMAKE_DISABLE_FIND_PACKAGE_ARPREC=TRUE + -DCMAKE_DISABLE_FIND_PACKAGE_Ctags=TRUE + -DCMAKE_DISABLE_FIND_PACKAGE_CCache=TRUE + -DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=TRUE + + -DINSTALL_TARGETS=shogun-static +) + +vcpkg_install_cmake() + +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/shogun) + +file(REMOVE_RECURSE + # This directory is empty given the settings above + ${CURRENT_PACKAGES_DIR}/include/shogun/mathematics/linalg/backend + ${CURRENT_PACKAGES_DIR}/debug/include + ${CURRENT_PACKAGES_DIR}/debug/share +) + +# Handle copyright +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/shogun) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/shogun/COPYING ${CURRENT_PACKAGES_DIR}/share/shogun/copyright) diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 50001e97d5..2f3af6598f 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -260,6 +260,11 @@ macro(find_package name) "optimized" "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/nghttp2.lib") endif() endif() + elseif("${name}" STREQUAL "LibXml2") + _find_package(${ARGV}) + if(LibXml2_FOUND AND (CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")) + list(APPEND LIBXML2_LIBRARIES libiconv libcharset ws2_32) + endif() else() _find_package(${ARGV}) endif()