From a8a07972dbd6a835329f31133fb83b3f4723cb55 Mon Sep 17 00:00:00 2001 From: David Millard Date: Wed, 20 Jan 2021 15:51:57 -0500 Subject: [PATCH] [pagmo2] Add new port (#15682) * [pagmo2] Add new port * Disable C4701 * Disable /MD override for all static builds * Add pagmo2 port_version info * Find TBB when finding pagmo * Fixup pagmo2 port version * Change /Md patch to if(0) * Fix port_version for pagmo2 * Use vcpkg.json; use version * Reformat vcpkg.json * Fix port_versions for pagmo2 --- port_versions/baseline.json | 4 +++ port_versions/p-/pagmo2.json | 9 +++++++ ports/pagmo2/disable-C4701.patch | 13 ++++++++++ ports/pagmo2/disable-md-override.patch | 20 ++++++++++++++ ports/pagmo2/find-tbb.patch | 12 +++++++++ ports/pagmo2/portfile.cmake | 36 ++++++++++++++++++++++++++ ports/pagmo2/vcpkg.json | 21 +++++++++++++++ 7 files changed, 115 insertions(+) create mode 100644 port_versions/p-/pagmo2.json create mode 100644 ports/pagmo2/disable-C4701.patch create mode 100644 ports/pagmo2/disable-md-override.patch create mode 100644 ports/pagmo2/find-tbb.patch create mode 100644 ports/pagmo2/portfile.cmake create mode 100644 ports/pagmo2/vcpkg.json diff --git a/port_versions/baseline.json b/port_versions/baseline.json index d5126885e6..883f2d5e8c 100644 --- a/port_versions/baseline.json +++ b/port_versions/baseline.json @@ -4376,6 +4376,10 @@ "baseline": "2020-12-14", "port-version": 0 }, + "pagmo2": { + "baseline": "2.16.1", + "port-version": 0 + }, "paho-mqtt": { "baseline": "1.3.8", "port-version": 0 diff --git a/port_versions/p-/pagmo2.json b/port_versions/p-/pagmo2.json new file mode 100644 index 0000000000..c149fd0f0b --- /dev/null +++ b/port_versions/p-/pagmo2.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "ea29ee58051fba73e950597ca2b0109dd6df0dec", + "version": "2.16.1", + "port-version": 0 + } + ] +} diff --git a/ports/pagmo2/disable-C4701.patch b/ports/pagmo2/disable-C4701.patch new file mode 100644 index 0000000000..05ed75bd2d --- /dev/null +++ b/ports/pagmo2/disable-C4701.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 96653ba..1afaafa 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -80,7 +80,7 @@ endif() + if(YACMA_COMPILER_IS_MSVC) + # Disable the idiotic minmax macros on MSVC, some annoying warnings, + # enable the bigobj option and the WIN32_LEAN_AND_MEAN definition. +- list(APPEND PAGMO_CXX_FLAGS_DEBUG "-DNOMINMAX" "/wd4459" "/wd4127" "/wd4702" "/wd4251" "/bigobj" "-DWIN32_LEAN_AND_MEAN") ++ list(APPEND PAGMO_CXX_FLAGS_DEBUG "-DNOMINMAX" "/wd4459" "/wd4127" "/wd4702" "/wd4251" "/wd4701" "/bigobj" "-DWIN32_LEAN_AND_MEAN") + list(APPEND PAGMO_CXX_FLAGS_RELEASE "-DNOMINMAX" "/wd4459" "/wd4127" "/wd4702" "/wd4251" "/bigobj" "-DWIN32_LEAN_AND_MEAN") + # Enable strict conformance mode, if supported. + set(CMAKE_REQUIRED_QUIET TRUE) diff --git a/ports/pagmo2/disable-md-override.patch b/ports/pagmo2/disable-md-override.patch new file mode 100644 index 0000000000..a5e09d3fa3 --- /dev/null +++ b/ports/pagmo2/disable-md-override.patch @@ -0,0 +1,20 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 96653ba..549d9d4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -141,6 +141,7 @@ endif() + # Boost setup. + include(PagmoFindBoost) + ++if(0) + # Explanation: on MSVC, when building static libraries, it is good practice to link + # to the static runtime. CMake, however, is hard-coded to link to the dynamic runtime. + # Hence we hackishly replace the /MD flag with /MT. This is the approach suggested +@@ -161,6 +162,7 @@ if(YACMA_COMPILER_IS_MSVC AND PAGMO_BUILD_STATIC_LIBRARY) + endif() + endforeach() + endif() ++endif() + + # List of source files. + set(PAGMO_SRC_FILES diff --git a/ports/pagmo2/find-tbb.patch b/ports/pagmo2/find-tbb.patch new file mode 100644 index 0000000000..8781910f8a --- /dev/null +++ b/ports/pagmo2/find-tbb.patch @@ -0,0 +1,12 @@ +diff --git a/pagmo-config.cmake.in b/pagmo-config.cmake.in +index 9553fc8..cb5e90b 100644 +--- a/pagmo-config.cmake.in ++++ b/pagmo-config.cmake.in +@@ -8,6 +8,7 @@ set(THREADS_PREFER_PTHREAD_FLAG YES) + find_package(Threads REQUIRED) + unset(THREADS_PREFER_PTHREAD_FLAG) + include(PagmoFindBoost) ++find_package(TBB REQUIRED) + @_PAGMO_CONFIG_OPTIONAL_DEPS@ + # Restore original module path. + set(CMAKE_MODULE_PATH "${_PAGMO_CONFIG_OLD_MODULE_PATH}") diff --git a/ports/pagmo2/portfile.cmake b/ports/pagmo2/portfile.cmake new file mode 100644 index 0000000000..a709a2fb6a --- /dev/null +++ b/ports/pagmo2/portfile.cmake @@ -0,0 +1,36 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO esa/pagmo2 + REF v2.16.1 + SHA512 dac85a8525316e827df809d187d40f14dc20db7119796b7384d7855f83ba37e0bb595f6d8199053aac857460816929dd599c9d43802f2ed920a6f42dd2f16a03 + HEAD_REF master + PATCHES + "disable-C4701.patch" + "disable-md-override.patch" + "find-tbb.patch" +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + nlopt PAGMO_WITH_NLOPT +) +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" PAGMO_BUILD_STATIC_LIBRARY) +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + ${FEATURE_OPTIONS} + -DPAGMO_WITH_EIGEN3=ON + -DPAGMO_BUILD_STATIC_LIBRARY=${PAGMO_BUILD_STATIC_LIBRARY} +) + +vcpkg_install_cmake() + +vcpkg_copy_pdbs() +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/pagmo) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +file(INSTALL ${SOURCE_PATH}/COPYING.lgpl3 DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) + diff --git a/ports/pagmo2/vcpkg.json b/ports/pagmo2/vcpkg.json new file mode 100644 index 0000000000..4e491b4969 --- /dev/null +++ b/ports/pagmo2/vcpkg.json @@ -0,0 +1,21 @@ +{ + "name": "pagmo2", + "version": "2.16.1", + "description": "A C++ platform to perform parallel computations of optimisation tasks (global and local) via the asynchronous generalized island model.", + "homepage": "https://esa.github.io/pagmo2/", + "dependencies": [ + "boost-any", + "boost-graph", + "boost-serialization", + "eigen3", + "tbb" + ], + "features": { + "nlopt": { + "description": "Enable the NLopt wrappers", + "dependencies": [ + "nlopt" + ] + } + } +}