From fb9c83a3bab367f4d30d0395f820ecd11d544283 Mon Sep 17 00:00:00 2001 From: myd7349 Date: Tue, 10 Sep 2019 01:51:56 +0800 Subject: [PATCH] [quantlib] Add new port (#7283) * [quantlib] Add new port * [quantlib] Fix x64-windows-static build * [quantlib] Use unique_ptr by default --- ports/quantlib/CONTROL | 5 +++ ports/quantlib/disable-examples-tests.patch | 13 +++++++ ports/quantlib/portfile.cmake | 41 +++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 ports/quantlib/CONTROL create mode 100644 ports/quantlib/disable-examples-tests.patch create mode 100644 ports/quantlib/portfile.cmake diff --git a/ports/quantlib/CONTROL b/ports/quantlib/CONTROL new file mode 100644 index 0000000000..50c006335b --- /dev/null +++ b/ports/quantlib/CONTROL @@ -0,0 +1,5 @@ +Source: quantlib +Version: 2019-09-02 +Description: The QuantLib C++ library +Homepage: https://www.quantlib.org/ +Build-Depends: boost-accumulators, boost-algorithm, boost-any, boost-array, boost-assert, boost-assign, boost-atomic, boost-bind, boost-config, boost-core, boost-date-time, boost-dynamic-bitset, boost-format, boost-function, boost-functional, boost-iterator, boost-lexical-cast, boost-math, boost-multi-array, boost-multiprecision, boost-optional, boost-preprocessor, boost-random, boost-serialization, boost-signals2, boost-smart-ptr, boost-thread, boost-tuple, boost-type-traits, boost-ublas, boost-unordered, boost-utility diff --git a/ports/quantlib/disable-examples-tests.patch b/ports/quantlib/disable-examples-tests.patch new file mode 100644 index 0000000000..b42e0bc255 --- /dev/null +++ b/ports/quantlib/disable-examples-tests.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d046251cc..d8201bf6a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -44,8 +44,6 @@ if (Boost_FOUND) + endif (Boost_FOUND) + + add_subdirectory(ql) +-add_subdirectory(Examples) +-add_subdirectory(test-suite) + + # + # Copy across the ANSI config file into the build directory. Users diff --git a/ports/quantlib/portfile.cmake b/ports/quantlib/portfile.cmake new file mode 100644 index 0000000000..7894bbba75 --- /dev/null +++ b/ports/quantlib/portfile.cmake @@ -0,0 +1,41 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO lballabio/QuantLib + REF f09141b5cce9134c0bcdbaf36e81359e6ba30705 + SHA512 d4b19d33594a7072a0d90b7eac3d74fb27c526269713a9223b84c0451b1e06a58f0c98350305d68a55086d1971260ff249049112aaadea59397ec195a3291490 + HEAD_REF master + PATCHES + disable-examples-tests.patch +) + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" USE_BOOST_DYNAMIC_LIBRARIES) + +set(QL_MSVC_RUNTIME ${VCPKG_LIBRARY_LINKAGE}) + +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +# TODO: Fix it in the upstream +vcpkg_replace_string( + "${SOURCE_PATH}/ql/userconfig.hpp" + "//# define QL_USE_STD_UNIQUE_PTR" + "# define QL_USE_STD_UNIQUE_PTR" +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DUSE_BOOST_DYNAMIC_LIBRARIES=${USE_BOOST_DYNAMIC_LIBRARIES} + -DMSVC_RUNTIME=${QL_MSVC_RUNTIME} +) + +vcpkg_install_cmake() + +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +configure_file(${SOURCE_PATH}/LICENSE.TXT ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)