mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-28 03:10:57 +08:00
[mlpack] Update to 4.0.0 and become a header-only library (#27707)
* update mlpack * update version * update mlpack * update version * update mlpack * update version * update mlpack * update version * update format * update version * update license * update version * update mlpack * update version * update patch * update version * update patch * update version * update patch * update version Co-authored-by: Monica <v-liumonica@microsoft.com>
This commit is contained in:
parent
61a5041d72
commit
888191cd88
23
ports/mlpack/Fix-build-with-MSVC.patch
Normal file
23
ports/mlpack/Fix-build-with-MSVC.patch
Normal file
@ -0,0 +1,23 @@
|
||||
diff --git a/src/mlpack/base.hpp b/src/mlpack/base.hpp
|
||||
index 4879167814..151a59b589 100644
|
||||
--- a/src/mlpack/base.hpp
|
||||
+++ b/src/mlpack/base.hpp
|
||||
@@ -69,12 +69,14 @@
|
||||
// Backport std::any from C+17 to C++11 to replace boost::any.
|
||||
// Use mnmlstc backport implementation only if compiler does not
|
||||
// support C++17.
|
||||
-#if __cplusplus < 201703L
|
||||
+#if __cplusplus < 201703L && !defined(_MSC_VER)
|
||||
#include <mlpack/core/std_backport/any.hpp>
|
||||
#include <mlpack/core/std_backport/string_view.hpp>
|
||||
#define MLPACK_ANY core::v2::any
|
||||
#define MLPACK_ANY_CAST core::v2::any_cast
|
||||
#define MLPACK_STRING_VIEW core::v2::string_view
|
||||
+#elif __cplusplus < 201703L && defined(_MSC_VER)
|
||||
+ #error "When using Visual Studio, mlpack should be compiled with /Zc:__cplusplus and /std:c++17 or newer."
|
||||
#else
|
||||
#include <any>
|
||||
#include <string_view>
|
||||
--
|
||||
2.38.1
|
||||
|
@ -1,46 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 6fe6d81..b59555c 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -291,7 +291,7 @@ endif()
|
||||
# ENSMALLEN_INCLUDE_DIR - include directory for ensmallen
|
||||
# STB_IMAGE_INCLUDE_DIR - include directory for STB image library
|
||||
# MATHJAX_ROOT - root of MathJax installation
|
||||
-find_package(Armadillo "${ARMADILLO_VERSION}" REQUIRED)
|
||||
+find_package(Armadillo CONFIG "${ARMADILLO_VERSION}" REQUIRED)
|
||||
|
||||
# Include directories for the previous dependencies.
|
||||
set(MLPACK_INCLUDE_DIRS ${MLPACK_INCLUDE_DIRS} ${ARMADILLO_INCLUDE_DIRS})
|
||||
@@ -388,8 +388,8 @@ if (NOT ENSMALLEN_FOUND)
|
||||
"Successfully downloaded ensmallen into ${CMAKE_BINARY_DIR}/deps/${ENSMALLEN_INCLUDE_DIR}/")
|
||||
|
||||
# Now we have to also ensure these header files get installed.
|
||||
- install(DIRECTORY "${CMAKE_BINARY_DIR}/deps/${ENSMALLEN_INCLUDE_DIR}/include/ensmallen_bits/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ensmallen_bits")
|
||||
- install(FILES "${CMAKE_BINARY_DIR}/deps/${ENSMALLEN_INCLUDE_DIR}/include/ensmallen.hpp" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
+ #install(DIRECTORY "${CMAKE_BINARY_DIR}/deps/${ENSMALLEN_INCLUDE_DIR}/include/ensmallen_bits/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ensmallen_bits")
|
||||
+ #install(FILES "${CMAKE_BINARY_DIR}/deps/${ENSMALLEN_INCLUDE_DIR}/include/ensmallen.hpp" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
else ()
|
||||
message(FATAL_ERROR "Problem unpacking ensmallen! Expected only one directory ensmallen-x.y.z/; found ${ENS_DIRECTORIES}. Try removing the directory ${CMAKE_BINARY_DIR}/deps and reconfiguring.")
|
||||
endif ()
|
||||
@@ -446,6 +446,7 @@ find_package(Boost "${BOOST_VERSION}"
|
||||
REQUIRED
|
||||
)
|
||||
|
||||
+if(0)
|
||||
link_directories(${Boost_LIBRARY_DIRS})
|
||||
|
||||
# In Visual Studio, automatic linking is performed, so we don't need to worry
|
||||
@@ -457,10 +458,12 @@ if (MSVC)
|
||||
message("boost lib dirs ${Boost_LIBRARY_DIRS}")
|
||||
set(Boost_LIBRARIES "")
|
||||
endif ()
|
||||
+endif()
|
||||
|
||||
+link_directories(${Boost_LIBRARIES})
|
||||
set(MLPACK_INCLUDE_DIRS ${MLPACK_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
|
||||
set(MLPACK_LIBRARIES ${MLPACK_LIBRARIES} ${Boost_LIBRARIES})
|
||||
-set(MLPACK_LIBRARY_DIRS ${MLPACK_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS})
|
||||
+set(MLPACK_LIBRARY_DIRS ${MLPACK_LIBRARY_DIRS} ${Boost_LIBRARIES})
|
||||
|
||||
# For Boost testing framework (will have no effect on non-testing executables).
|
||||
# This specifies to Boost that we are dynamically linking to the Boost test
|
@ -1,15 +0,0 @@
|
||||
diff --git a/CMake/go/AppendModel.cmake b/CMake/go/AppendModel.cmake
|
||||
index eeb28f7..ec50f15 100644
|
||||
--- a/CMake/go/AppendModel.cmake
|
||||
+++ b/CMake/go/AppendModel.cmake
|
||||
@@ -44,8 +44,8 @@ function(append_model SERIALIZATION_FILE PROGRAM_MAIN_FILE)
|
||||
else ()
|
||||
string(APPEND GOMODEL_SAFE_TYPE ${MODEL_CHAR})
|
||||
endif()
|
||||
- endif()
|
||||
- endforeach()
|
||||
+ endforeach()
|
||||
+ endif()
|
||||
|
||||
# See if the model type already exists.
|
||||
file(READ "${SERIALIZATION_FILE}" SERIALIZATION_FILE_CONTENTS)
|
@ -1,13 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 4dd92f0..bfa697d 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -488,7 +488,7 @@ add_definitions(-DBOOST_TEST_DYN_LINK)
|
||||
# }
|
||||
# #endif
|
||||
if (USE_OPENMP)
|
||||
- find_package(OpenMP)
|
||||
+ find_package(OpenMP REQUIRED)
|
||||
endif ()
|
||||
|
||||
if (OPENMP_FOUND)
|
@ -1,24 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index b59555c..4dd92f0 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -441,11 +441,18 @@ set(Boost_ADDITIONAL_VERSIONS
|
||||
set(Boost_NO_BOOST_CMAKE 1)
|
||||
find_package(Boost "${BOOST_VERSION}"
|
||||
COMPONENTS
|
||||
- unit_test_framework
|
||||
serialization
|
||||
REQUIRED
|
||||
)
|
||||
|
||||
+if (BUILD_TESTS)
|
||||
+ find_package(Boost "${BOOST_VERSION}"
|
||||
+ COMPONENTS
|
||||
+ unit_test_framework
|
||||
+ REQUIRED
|
||||
+ )
|
||||
+endif()
|
||||
+
|
||||
if(0)
|
||||
link_directories(${Boost_LIBRARY_DIRS})
|
||||
|
@ -1,106 +1,19 @@
|
||||
# header-only library
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO mlpack/mlpack
|
||||
REF 7ae9ddda86c1751b6509ceb48b27d182feaae439 # 3.4.1
|
||||
SHA512 db68c16b80af7037ac562f93775b6262f1552fbc89daa0c621075e2ff70a8306523da8eb74e33ac15ba34c9ccef8f2746bd1e4efa7c280a5be77b53c69d3f9a1
|
||||
REF 28eb1858c59e4469da0e9689663a45fc140af9c4 # 4.0.0
|
||||
SHA512 b33aa5df48c9f0e5a5fac7bfb69fd2c64bc01f1ba0ae22990774e1805881c60e4652d2f23b6c95627da1a20e39ee6a90e327fdaa6d1e00bac8986dcecc15a89a
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
cmakelists.patch
|
||||
fix-configure-error.patch
|
||||
fix-test-dependency.patch
|
||||
fix-dependencies.patch
|
||||
Fix-build-with-MSVC.patch #From upstream: https://github.com/mlpack/mlpack/pull/3318
|
||||
)
|
||||
|
||||
file(REMOVE "${SOURCE_PATH}/CMake/ARMA_FindACML.cmake")
|
||||
file(REMOVE "${SOURCE_PATH}/CMake/ARMA_FindACMLMP.cmake")
|
||||
file(REMOVE "${SOURCE_PATH}/CMake/ARMA_FindARPACK.cmake")
|
||||
file(REMOVE "${SOURCE_PATH}/CMake/ARMA_FindBLAS.cmake")
|
||||
file(REMOVE "${SOURCE_PATH}/CMake/ARMA_FindCBLAS.cmake")
|
||||
file(REMOVE "${SOURCE_PATH}/CMake/ARMA_FindCLAPACK.cmake")
|
||||
file(REMOVE "${SOURCE_PATH}/CMake/ARMA_FindLAPACK.cmake")
|
||||
file(REMOVE "${SOURCE_PATH}/CMake/ARMA_FindMKL.cmake")
|
||||
file(REMOVE "${SOURCE_PATH}/CMake/ARMA_FindOpenBLAS.cmake")
|
||||
file(REMOVE "${SOURCE_PATH}/CMake/FindArmadillo.cmake")
|
||||
# Copy the header files
|
||||
file(GLOB HEADERS "${SOURCE_PATH}/src/*.hpp" "${SOURCE_PATH}/src/mlpack/*.hpp")
|
||||
file(COPY ${HEADERS} DESTINATION "${CURRENT_PACKAGES_DIR}/include/mlpack")
|
||||
file(COPY "${SOURCE_PATH}/src/mlpack/methods/" DESTINATION "${CURRENT_PACKAGES_DIR}/include/mlpack/methods")
|
||||
file(COPY "${SOURCE_PATH}/src/mlpack/core/" DESTINATION "${CURRENT_PACKAGES_DIR}/include/mlpack/core")
|
||||
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
FEATURES
|
||||
tools BUILD_CLI_EXECUTABLES
|
||||
openmp USE_OPENMP
|
||||
)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
DISABLE_PARALLEL_CONFIGURE
|
||||
OPTIONS
|
||||
-DBUILD_TESTS=OFF
|
||||
-DDOWNLOAD_STB_IMAGE=OFF
|
||||
-DDOWNLOAD_ENSMALLEN=OFF
|
||||
-DBUILD_PYTHON_BINDINGS=OFF
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_Git=ON
|
||||
${FEATURE_OPTIONS}
|
||||
)
|
||||
vcpkg_cmake_install()
|
||||
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/mlpack)
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
if("tools" IN_LIST FEATURES)
|
||||
vcpkg_copy_tools(AUTO_CLEAN TOOL_NAMES
|
||||
mlpack_adaboost
|
||||
mlpack_approx_kfn
|
||||
mlpack_cf
|
||||
mlpack_dbscan
|
||||
mlpack_decision_stump
|
||||
mlpack_decision_tree
|
||||
mlpack_det
|
||||
mlpack_emst
|
||||
mlpack_fastmks
|
||||
mlpack_gmm_generate
|
||||
mlpack_gmm_probability
|
||||
mlpack_gmm_train
|
||||
mlpack_hmm_generate
|
||||
mlpack_hmm_loglik
|
||||
mlpack_hmm_train
|
||||
mlpack_hmm_viterbi
|
||||
mlpack_hoeffding_tree
|
||||
mlpack_kde
|
||||
mlpack_kernel_pca
|
||||
mlpack_kfn
|
||||
mlpack_kmeans
|
||||
mlpack_knn
|
||||
mlpack_krann
|
||||
mlpack_lars
|
||||
mlpack_linear_regression
|
||||
mlpack_linear_svm
|
||||
mlpack_lmnn
|
||||
mlpack_local_coordinate_coding
|
||||
mlpack_logistic_regression
|
||||
mlpack_lsh
|
||||
mlpack_mean_shift
|
||||
mlpack_nbc
|
||||
mlpack_nca
|
||||
mlpack_nmf
|
||||
mlpack_pca
|
||||
mlpack_perceptron
|
||||
mlpack_preprocess_binarize
|
||||
mlpack_preprocess_describe
|
||||
mlpack_preprocess_imputer
|
||||
mlpack_preprocess_scale
|
||||
mlpack_preprocess_split
|
||||
mlpack_radical
|
||||
mlpack_random_forest
|
||||
mlpack_range_search
|
||||
mlpack_softmax_regression
|
||||
mlpack_sparse_coding
|
||||
mlpack_image_converter
|
||||
mlpack_bayesian_linear_regression
|
||||
mlpack_preprocess_one_hot_encoding
|
||||
)
|
||||
endif()
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
|
||||
file(INSTALL "${SOURCE_PATH}/COPYRIGHT.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYRIGHT.txt")
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" @ONLY)
|
||||
|
4
ports/mlpack/usage
Normal file
4
ports/mlpack/usage
Normal file
@ -0,0 +1,4 @@
|
||||
The package mlpack is header only and can be used from CMake via:
|
||||
|
||||
find_path(MLPACK_INCLUDE_DIRS "mlpack/mlpack.hpp")
|
||||
target_include_directories(main PRIVATE ${MLPACK_INCLUDE_DIRS})
|
@ -1,18 +1,13 @@
|
||||
{
|
||||
"name": "mlpack",
|
||||
"version": "3.4.1",
|
||||
"port-version": 5,
|
||||
"description": "mlpack is a fast, flexible machine learning library, written in C++, that aims to provide fast, extensible implementations of cutting-edge machine learning algorithms.",
|
||||
"version": "4.0.0",
|
||||
"description": "mlpack is an intuitive, fast, and flexible header-only C++ machine learning library with bindings to other languages.",
|
||||
"homepage": "https://github.com/mlpack/mlpack",
|
||||
"license": "BSD-3-Clause",
|
||||
"supports": "!uwp",
|
||||
"dependencies": [
|
||||
"armadillo",
|
||||
"boost-heap",
|
||||
"boost-math",
|
||||
"boost-program-options",
|
||||
"boost-random",
|
||||
"boost-serialization",
|
||||
"boost-serialization",
|
||||
"cereal",
|
||||
"ensmallen",
|
||||
"stb",
|
||||
{
|
||||
|
@ -4901,8 +4901,8 @@
|
||||
"port-version": 1
|
||||
},
|
||||
"mlpack": {
|
||||
"baseline": "3.4.1",
|
||||
"port-version": 5
|
||||
"baseline": "4.0.0",
|
||||
"port-version": 0
|
||||
},
|
||||
"mman": {
|
||||
"baseline": "git-f5ff813",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "715657feab96cbc78eaae9c0279d85e3269eedee",
|
||||
"version": "4.0.0",
|
||||
"port-version": 0
|
||||
},
|
||||
{
|
||||
"git-tree": "1ba342c0a0a5e88c4424207c3296b8db8c7062fc",
|
||||
"version": "3.4.1",
|
||||
|
Loading…
x
Reference in New Issue
Block a user