mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 18:31:15 +08:00
[mlpack] Add new port (#5409)
* [mlpack] Add new port Add new port for the http://www.mlpack.org/ library * Tools optional and static build * Info fix * [mlpack] Use PATCHES parameter instead of apply_patches()
This commit is contained in:
parent
434b30185d
commit
9ee856b9b8
7
ports/mlpack/CONTROL
Normal file
7
ports/mlpack/CONTROL
Normal file
@ -0,0 +1,7 @@
|
||||
Source: mlpack
|
||||
Version: 3.0.4
|
||||
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.
|
||||
Build-Depends: openblas, clapack, boost, armadillo
|
||||
|
||||
Feature: tools
|
||||
Description: Build command-line executables and tests.
|
52
ports/mlpack/cmakelists.patch
Normal file
52
ports/mlpack/cmakelists.patch
Normal file
@ -0,0 +1,52 @@
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -252,7 +252,7 @@
|
||||
# script Armadillo uses to find these.
|
||||
if (WIN32)
|
||||
find_library(LAPACK_LIBRARY
|
||||
- NAMES lapack liblapack lapack_win32_MT lapack_win32
|
||||
+ NAMES clapack lapack liblapack lapack_win32_MT lapack_win32
|
||||
PATHS "C:/Program Files/Armadillo"
|
||||
PATH_SUFFIXES "examples/lib_win32/")
|
||||
|
||||
@@ -261,7 +261,7 @@
|
||||
endif ()
|
||||
|
||||
find_library(BLAS_LIBRARY
|
||||
- NAMES blas libblas blas_win32_MT blas_win32
|
||||
+ NAMES openblas blas libblas blas_win32_MT blas_win32
|
||||
PATHS "C:/Program Files/Armadillo"
|
||||
PATH_SUFFIXES "examples/lib_win32/")
|
||||
|
||||
@@ -281,6 +281,9 @@
|
||||
# Unfortunately this configuration variable is necessary and will need to be
|
||||
# updated as time goes on and new versions are released.
|
||||
set(Boost_ADDITIONAL_VERSIONS
|
||||
+ "1.69.0" "1.69"
|
||||
+ "1.68.0" "1.68"
|
||||
+ "1.67.0" "1.67"
|
||||
"1.66.0" "1.66"
|
||||
"1.65.1" "1.65.0" "1.65"
|
||||
"1.64.1" "1.64.0" "1.64"
|
||||
@@ -307,19 +310,11 @@
|
||||
REQUIRED
|
||||
)
|
||||
|
||||
-link_directories(${Boost_LIBRARY_DIRS})
|
||||
-
|
||||
-# In Visual Studio, automatic linking is performed, so we don't need to worry
|
||||
-# about it. Clear the list of libraries to link against and let Visual Studio
|
||||
-# handle it.
|
||||
-if (MSVC)
|
||||
- link_directories(${Boost_LIBRARY_DIRS})
|
||||
- set(Boost_LIBRARIES "")
|
||||
-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
|
189
ports/mlpack/meta_info_extractor.patch
Normal file
189
ports/mlpack/meta_info_extractor.patch
Normal file
@ -0,0 +1,189 @@
|
||||
--- a/src/mlpack/core/cv/meta_info_extractor.hpp
|
||||
+++ b/src/mlpack/core/cv/meta_info_extractor.hpp
|
||||
@@ -38,50 +38,142 @@
|
||||
bool NumClasses>
|
||||
struct TrainForm;
|
||||
|
||||
-template<typename PT, typename WT, typename... SignatureParams>
|
||||
-struct TrainFormBase
|
||||
-{
|
||||
- using PredictionsType = PT;
|
||||
- using WeightsType = WT;
|
||||
-
|
||||
- /* A minimum number of parameters that should be inferred */
|
||||
- static const size_t MinNumberOfAdditionalArgs = 1;
|
||||
-
|
||||
- template<typename Class, typename RT, typename... Ts>
|
||||
- using Type = RT(Class::*)(SignatureParams..., Ts...);
|
||||
-};
|
||||
-
|
||||
-template<typename MT, typename PT>
|
||||
-struct TrainForm<MT, PT, void, false, false> : public TrainFormBase<PT, void,
|
||||
- const MT&, const PT&> {};
|
||||
-
|
||||
-template<typename MT, typename PT>
|
||||
-struct TrainForm<MT, PT, void, true, false> : public TrainFormBase<PT, void,
|
||||
- const MT&, const data::DatasetInfo&, const PT&> {};
|
||||
-
|
||||
-template<typename MT, typename PT, typename WT>
|
||||
-struct TrainForm<MT, PT, WT, false, false> : public TrainFormBase<PT, WT,
|
||||
- const MT&, const PT&, const WT&> {};
|
||||
-
|
||||
-template<typename MT, typename PT, typename WT>
|
||||
-struct TrainForm<MT, PT, WT, true, false> : public TrainFormBase<PT, WT,
|
||||
- const MT&, const data::DatasetInfo&, const PT&, const WT&> {};
|
||||
-
|
||||
-template<typename MT, typename PT>
|
||||
-struct TrainForm<MT, PT, void, false, true> : public TrainFormBase<PT, void,
|
||||
- const MT&, const PT&, const size_t> {};
|
||||
-
|
||||
-template<typename MT, typename PT>
|
||||
-struct TrainForm<MT, PT, void, true, true> : public TrainFormBase<PT, void,
|
||||
- const MT&, const data::DatasetInfo&, const PT&, const size_t> {};
|
||||
-
|
||||
-template<typename MT, typename PT, typename WT>
|
||||
-struct TrainForm<MT, PT, WT, false, true> : public TrainFormBase<PT, WT,
|
||||
- const MT&, const PT&, const size_t, const WT&> {};
|
||||
-
|
||||
-template<typename MT, typename PT, typename WT>
|
||||
-struct TrainForm<MT, PT, WT, true, true> : public TrainFormBase<PT, WT,
|
||||
- const MT&, const data::DatasetInfo&, const PT&, const size_t, const WT&> {};
|
||||
+#if _MSC_VER <= 1916 // Visual Studio 2017 version 15.9 or older.
|
||||
+ // Due to an internal MSVC compiler bug (MSVC ) we can't use two parameter
|
||||
+ // packs. So we have to write multiple TrainFormBase forms.
|
||||
+ template<typename PT, typename WT, typename T1, typename T2>
|
||||
+ struct TrainFormBase4
|
||||
+ {
|
||||
+ using PredictionsType = PT;
|
||||
+ using WeightsType = WT;
|
||||
+
|
||||
+ /* A minimum number of parameters that should be inferred */
|
||||
+ static const size_t MinNumberOfAdditionalArgs = 1;
|
||||
+
|
||||
+ template<typename Class, typename RT, typename... Ts>
|
||||
+ using Type = RT(Class::*)(T1, T2, Ts...);
|
||||
+ };
|
||||
+
|
||||
+ template<typename PT, typename WT, typename T1, typename T2, typename T3>
|
||||
+ struct TrainFormBase5
|
||||
+ {
|
||||
+ using PredictionsType = PT;
|
||||
+ using WeightsType = WT;
|
||||
+
|
||||
+ /* A minimum number of parameters that should be inferred */
|
||||
+ static const size_t MinNumberOfAdditionalArgs = 1;
|
||||
+
|
||||
+ template<typename Class, typename RT, typename... Ts>
|
||||
+ using Type = RT(Class::*)(T1, T2, T3, Ts...);
|
||||
+ };
|
||||
+
|
||||
+ template<typename PT, typename WT, typename T1, typename T2, typename T3,
|
||||
+ typename T4>
|
||||
+ struct TrainFormBase6
|
||||
+ {
|
||||
+ using PredictionsType = PT;
|
||||
+ using WeightsType = WT;
|
||||
+
|
||||
+ /* A minimum number of parameters that should be inferred */
|
||||
+ static const size_t MinNumberOfAdditionalArgs = 1;
|
||||
+
|
||||
+ template<typename Class, typename RT, typename... Ts>
|
||||
+ using Type = RT(Class::*)(T1, T2, T3, T4, Ts...);
|
||||
+ };
|
||||
+
|
||||
+ template<typename PT, typename WT, typename T1, typename T2, typename T3,
|
||||
+ typename T4, typename T5>
|
||||
+ struct TrainFormBase7
|
||||
+ {
|
||||
+ using PredictionsType = PT;
|
||||
+ using WeightsType = WT;
|
||||
+
|
||||
+ /* A minimum number of parameters that should be inferred */
|
||||
+ static const size_t MinNumberOfAdditionalArgs = 1;
|
||||
+
|
||||
+ template<typename Class, typename RT, typename... Ts>
|
||||
+ using Type = RT(Class::*)(T1, T2, T3, T4, T5, Ts...);
|
||||
+ };
|
||||
+
|
||||
+ template<typename MT, typename PT>
|
||||
+ struct TrainForm<MT, PT, void, false, false> : public TrainFormBase4<PT, void,
|
||||
+ const MT&, const PT&> {};
|
||||
+
|
||||
+ template<typename MT, typename PT>
|
||||
+ struct TrainForm<MT, PT, void, true, false> : public TrainFormBase5<PT, void,
|
||||
+ const MT&, const data::DatasetInfo&, const PT&> {};
|
||||
+
|
||||
+ template<typename MT, typename PT, typename WT>
|
||||
+ struct TrainForm<MT, PT, WT, false, false> : public TrainFormBase5<PT, WT,
|
||||
+ const MT&, const PT&, const WT&> {};
|
||||
+
|
||||
+ template<typename MT, typename PT, typename WT>
|
||||
+ struct TrainForm<MT, PT, WT, true, false> : public TrainFormBase6<PT, WT,
|
||||
+ const MT&, const data::DatasetInfo&, const PT&, const WT&> {};
|
||||
+
|
||||
+ template<typename MT, typename PT>
|
||||
+ struct TrainForm<MT, PT, void, false, true> : public TrainFormBase5<PT, void,
|
||||
+ const MT&, const PT&, const size_t> {};
|
||||
+
|
||||
+ template<typename MT, typename PT>
|
||||
+ struct TrainForm<MT, PT, void, true, true> : public TrainFormBase6<PT, void,
|
||||
+ const MT&, const data::DatasetInfo&, const PT&, const size_t> {};
|
||||
+
|
||||
+ template<typename MT, typename PT, typename WT>
|
||||
+ struct TrainForm<MT, PT, WT, false, true> : public TrainFormBase6<PT, WT,
|
||||
+ const MT&, const PT&, const size_t, const WT&> {};
|
||||
+
|
||||
+ template<typename MT, typename PT, typename WT>
|
||||
+ struct TrainForm<MT, PT, WT, true, true> : public TrainFormBase7<PT, WT,
|
||||
+ const MT&, const data::DatasetInfo&, const PT&,
|
||||
+ const size_t, const WT&> {};
|
||||
+#else
|
||||
+ template<typename PT, typename WT, typename... SignatureParams>
|
||||
+ struct TrainFormBase
|
||||
+ {
|
||||
+ using PredictionsType = PT;
|
||||
+ using WeightsType = WT;
|
||||
+
|
||||
+ /* A minimum number of parameters that should be inferred */
|
||||
+ static const size_t MinNumberOfAdditionalArgs = 1;
|
||||
+
|
||||
+ template<typename Class, typename RT, typename... Ts>
|
||||
+ using Type = RT(Class::*)(SignatureParams..., Ts...);
|
||||
+ };
|
||||
+
|
||||
+ template<typename MT, typename PT>
|
||||
+ struct TrainForm<MT, PT, void, false, false> : public TrainFormBase<PT, void,
|
||||
+ const MT&, const PT&> {};
|
||||
+
|
||||
+ template<typename MT, typename PT>
|
||||
+ struct TrainForm<MT, PT, void, true, false> : public TrainFormBase<PT, void,
|
||||
+ const MT&, const data::DatasetInfo&, const PT&> {};
|
||||
+
|
||||
+ template<typename MT, typename PT, typename WT>
|
||||
+ struct TrainForm<MT, PT, WT, false, false> : public TrainFormBase<PT, WT,
|
||||
+ const MT&, const PT&, const WT&> {};
|
||||
+
|
||||
+ template<typename MT, typename PT, typename WT>
|
||||
+ struct TrainForm<MT, PT, WT, true, false> : public TrainFormBase<PT, WT,
|
||||
+ const MT&, const data::DatasetInfo&, const PT&, const WT&> {};
|
||||
+
|
||||
+ template<typename MT, typename PT>
|
||||
+ struct TrainForm<MT, PT, void, false, true> : public TrainFormBase<PT, void,
|
||||
+ const MT&, const PT&, const size_t> {};
|
||||
+
|
||||
+ template<typename MT, typename PT>
|
||||
+ struct TrainForm<MT, PT, void, true, true> : public TrainFormBase<PT, void,
|
||||
+ const MT&, const data::DatasetInfo&, const PT&, const size_t> {};
|
||||
+
|
||||
+ template<typename MT, typename PT, typename WT>
|
||||
+ struct TrainForm<MT, PT, WT, false, true> : public TrainFormBase<PT, WT,
|
||||
+ const MT&, const PT&, const size_t, const WT&> {};
|
||||
+
|
||||
+ template<typename MT, typename PT, typename WT>
|
||||
+ struct TrainForm<MT, PT, WT, true, true> : public TrainFormBase<PT, WT,
|
||||
+ const MT&, const data::DatasetInfo&, const PT&,
|
||||
+ const size_t, const WT&> {};
|
||||
+#endif
|
||||
|
||||
/* A struct for indication that a right method form can't be found */
|
||||
struct NotFoundMethodForm
|
43
ports/mlpack/portfile.cmake
Normal file
43
ports/mlpack/portfile.cmake
Normal file
@ -0,0 +1,43 @@
|
||||
include(vcpkg_common_functions)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO mlpack/mlpack
|
||||
REF mlpack-3.0.4
|
||||
SHA512 07730a826efb55a41fce2286de8df15421e7a7189b9cdc4699c6a32e3d4b1964a98e3829a60513994ef747640952229e7a3b744ac0ae324f5e5e57f982a86f66
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
meta_info_extractor.patch
|
||||
cmakelists.patch
|
||||
)
|
||||
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" MLPACK_SHARED_LIBS)
|
||||
|
||||
set(BUILD_TOOLS OFF)
|
||||
if("tools" IN_LIST FEATURES)
|
||||
set(BUILD_TOOLS ON)
|
||||
endif()
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS
|
||||
-DBUILD_TESTS=${BUILD_TOOLS}
|
||||
-DBUILD_CLI_EXECUTABLES=${BUILD_TOOLS}
|
||||
-DBUILD_SHARED_LIBS=${MLPACK_SHARED_LIBS}
|
||||
)
|
||||
vcpkg_install_cmake()
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/COPYRIGHT.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/mlpack RENAME copyright)
|
||||
|
||||
if(BUILD_TOOLS)
|
||||
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools)
|
||||
file(GLOB MLPACK_TOOLS ${CURRENT_PACKAGES_DIR}/bin/*.exe)
|
||||
file(COPY ${MLPACK_TOOLS} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT})
|
||||
file(REMOVE ${MLPACK_TOOLS})
|
||||
file(GLOB MLPACK_TOOLS_DEBUG ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe)
|
||||
file(REMOVE ${MLPACK_TOOLS_DEBUG})
|
||||
endif()
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
Loading…
x
Reference in New Issue
Block a user