diff options
Diffstat (limited to 'vcpkg/ports/ensmallen')
| -rw-r--r-- | vcpkg/ports/ensmallen/dependencies.patch | 43 | ||||
| -rw-r--r-- | vcpkg/ports/ensmallen/portfile.cmake | 27 | ||||
| -rw-r--r-- | vcpkg/ports/ensmallen/vcpkg.json | 30 |
3 files changed, 100 insertions, 0 deletions
diff --git a/vcpkg/ports/ensmallen/dependencies.patch b/vcpkg/ports/ensmallen/dependencies.patch new file mode 100644 index 0000000..acd097b --- /dev/null +++ b/vcpkg/ports/ensmallen/dependencies.patch @@ -0,0 +1,43 @@ +diff --git a/CMake/ensmallen-config.cmake.in b/CMake/ensmallen-config.cmake.in +index 3a9a93c..7bed7fd 100644 +--- a/CMake/ensmallen-config.cmake.in ++++ b/CMake/ensmallen-config.cmake.in +@@ -1,4 +1,9 @@ + @PACKAGE_INIT@ ++include(CMakeFindDependencyMacro) ++if(@USE_OPENMP@) ++find_dependency(OpenMP) ++endif() ++find_dependency(Armadillo CONFIG) + + include(${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake) + check_required_components(ensmallen) +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 551c538..0b20af1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -47,21 +47,13 @@ endif() + + # Find OpenMP and link it. + if(USE_OPENMP) +- if(NOT TARGET OpenMP::OpenMP_CXX) +- find_package(Threads REQUIRED) +- add_library(OpenMP::OpenMP_CXX IMPORTED INTERFACE) +- set_property(TARGET OpenMP::OpenMP_CXX +- PROPERTY INTERFACE_COMPILE_OPTIONS ${OpenMP_CXX_FLAGS}) +- # Only works if the same flag is passed to the linker; use CMake 3.9+ otherwise (Intel, AppleClang). +- set_property(TARGET OpenMP::OpenMP_CXX +- PROPERTY INTERFACE_LINK_LIBRARIES ${OpenMP_CXX_FLAGS} Threads::Threads) +- endif() ++ find_package(OpenMP REQUIRED) + target_link_libraries(ensmallen INTERFACE OpenMP::OpenMP_CXX) + endif() + + # Find Armadillo and link it. +-find_package(Armadillo 9.800.0 REQUIRED) +-target_link_libraries(ensmallen INTERFACE Armadillo::Armadillo) ++find_package(Armadillo CONFIG REQUIRED) ++target_link_libraries(ensmallen INTERFACE armadillo) + + # Set helper variables for creating the version, config and target files. + include(CMakePackageConfigHelpers) diff --git a/vcpkg/ports/ensmallen/portfile.cmake b/vcpkg/ports/ensmallen/portfile.cmake new file mode 100644 index 0000000..b7f18ed --- /dev/null +++ b/vcpkg/ports/ensmallen/portfile.cmake @@ -0,0 +1,27 @@ +set(VCPKG_BUILD_TYPE release) # header-only
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO mlpack/ensmallen
+ REF "${VERSION}"
+ SHA512 1e86fc28a58694057262a8d036af8080be084c889f7b659b77a08fd4e0957d0f03d8866e47b682a1868b5ac2198cca85c591a334b284096659a123196de95a66
+ HEAD_REF master
+ PATCHES
+ dependencies.patch
+)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ openmp USE_OPENMP
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS ${FEATURE_OPTIONS}
+)
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/ensmallen)
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib")
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYRIGHT.txt")
diff --git a/vcpkg/ports/ensmallen/vcpkg.json b/vcpkg/ports/ensmallen/vcpkg.json new file mode 100644 index 0000000..579b0ca --- /dev/null +++ b/vcpkg/ports/ensmallen/vcpkg.json @@ -0,0 +1,30 @@ +{ + "name": "ensmallen", + "version-semver": "2.21.1", + "port-version": 1, + "description": "A header-only C++ library for mathematical optimization", + "homepage": "http://ensmallen.org/", + "license": "BSD-3-Clause", + "dependencies": [ + "armadillo", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + { + "name": "openmp", + "platform": "!osx" + } + ], + "features": { + "openmp": { + "description": "Enable OpenMP support" + } + } +} |