Skip to content

Commit

Permalink
[pagmo2] Add new port (#15682)
Browse files Browse the repository at this point in the history
* [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
  • Loading branch information
dmillard authored Jan 20, 2021
1 parent 4d136ef commit a8a0797
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 0 deletions.
4 changes: 4 additions & 0 deletions port_versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions port_versions/p-/pagmo2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "ea29ee58051fba73e950597ca2b0109dd6df0dec",
"version": "2.16.1",
"port-version": 0
}
]
}
13 changes: 13 additions & 0 deletions ports/pagmo2/disable-C4701.patch
Original file line number Diff line number Diff line change
@@ -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)
20 changes: 20 additions & 0 deletions ports/pagmo2/disable-md-override.patch
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions ports/pagmo2/find-tbb.patch
Original file line number Diff line number Diff line change
@@ -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}")
36 changes: 36 additions & 0 deletions ports/pagmo2/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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)

21 changes: 21 additions & 0 deletions ports/pagmo2/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
}

0 comments on commit a8a0797

Please sign in to comment.