Skip to content

Commit

Permalink
[OpenTURNS] add new port (#29336)
Browse files Browse the repository at this point in the history
* [openturns] add port

* v db

* fix missing boost dep.

* fix static stuff and others.

* v db

* reorder mpc and mpfr for linux

* v db

* add openturns:x64-osx=fail to ci baseline because vm uses old bison.

* move baseline fail above comment

* Add ci.baseline.txt note describing why it doesn't work.

* Add usage text.

* fix version

* v db

---------

Co-authored-by: Billy Robert O'Neal III <[email protected]>
  • Loading branch information
Neumann-A and BillyONeal authored Feb 8, 2023
1 parent 8963164 commit d289dea
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ports/openturns/link-gmp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e13414978..77ecf3e9e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -303,6 +303,10 @@ if (USE_BOOST)
list (APPEND OPENTURNS_PRIVATE_LIBRARIES ${MPC_LIBRARIES})
endif ()
endif ()
+ if((USE_MPC OR USE_MPFR) AND NOT BUILD_SHARED_LIBS)
+ find_library(GMP_LIBRARY NAMES gmp)
+ list (APPEND OPENTURNS_PRIVATE_LIBRARIES ${GMP_LIBRARY})
+ endif()
list (APPEND OPENTURNS_PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
endif ()
endif ()
62 changes: 62 additions & 0 deletions ports/openturns/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO openturns/openturns
REF ad8482ece23d98802edc6258683e8353f9ff8b08
SHA512 b0bc88bcf54945b5e786b480e640ee182926c75f1d871f70690d9609c98745b1907b3d9184c07586591fa45238c837da5a893a00d9c576a9e10232bcc9adc593
HEAD_REF master
PATCHES
link-gmp.patch
reorder-mpc.patch
)

vcpkg_find_acquire_program(FLEX)
get_filename_component(FLEX_DIR "${FLEX}" DIRECTORY)
vcpkg_add_to_path("${FLEX_DIR}")
vcpkg_find_acquire_program(BISON)
get_filename_component(BISON_DIR "${BISON}" DIRECTORY)
vcpkg_add_to_path("${BISON_DIR}")

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DBUILD_PYTHON:BOOL=OFF # Requires additional python modules
-DUSE_BOOST:BOOL=ON # Required to make the distributions cross platform
-DUSE_DOXYGEN:BOOL=OFF
-DUSE_OPENMP:BOOL=OFF
-DCMAKE_REQUIRE_FIND_PACKAGE_Spectra:BOOL=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_Eigen3:BOOL=ON
-DCMAKE_DISABLE_FIND_PACKAGE_primesieve:BOOL=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_BISON:BOOL=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_FLEX:BOOL=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_TBB:BOOL=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_muParser:BOOL=ON
-DCMAKE_DISABLE_FIND_PACKAGE_HMAT:BOOL=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_LibXml2:BOOL=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_HDF5:BOOL=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_MPFR:BOOL=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_MPC:BOOL=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_NLopt:BOOL=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_dlib:BOOL=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_Ceres:BOOL=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_CMinpack:BOOL=ON
-DCMAKE_DISABLE_FIND_PACKAGE_Bonmin:BOOL=ON
-DCMAKE_DISABLE_FIND_PACKAGE_Ipopt:BOOL=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_Pagmo:BOOL=ON
)

vcpkg_cmake_install()

vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/${PORT}/OpenTURNSConfig.cmake" "/lib/cmake/" "/share/")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/${PORT}/OpenTURNSConfig.cmake" "/lib" "$<$<CONFIG:DEBUG>:/debug>/lib")


file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE "${CURRENT_PACKAGES_DIR}/include/pthread.h"
"${CURRENT_PACKAGES_DIR}/include/semaphore.h"
"${CURRENT_PACKAGES_DIR}/include/unistd.h")

file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME "copyright")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
34 changes: 34 additions & 0 deletions ports/openturns/reorder-mpc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 77ecf3e9e..b78ebcbec 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -287,14 +287,6 @@ if (USE_BOOST)
set (Boost_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
endif ()
set (OPENTURNS_HAVE_BOOST TRUE)
- if (USE_MPFR)
- find_package (MPFR)
- if (MPFR_FOUND)
- set (OPENTURNS_HAVE_MPFR TRUE)
- list (APPEND OPENTURNS_PRIVATE_INCLUDE_DIRS ${MPFR_INCLUDE_DIRS})
- list (APPEND OPENTURNS_PRIVATE_LIBRARIES ${MPFR_LIBRARIES})
- endif ()
- endif ()
if (USE_MPC AND NOT Boost_VERSION VERSION_LESS 1.68)
find_package (MPC)
if (MPC_FOUND)
@@ -303,6 +295,14 @@ if (USE_BOOST)
list (APPEND OPENTURNS_PRIVATE_LIBRARIES ${MPC_LIBRARIES})
endif ()
endif ()
+ if (USE_MPFR)
+ find_package (MPFR)
+ if (MPFR_FOUND)
+ set (OPENTURNS_HAVE_MPFR TRUE)
+ list (APPEND OPENTURNS_PRIVATE_INCLUDE_DIRS ${MPFR_INCLUDE_DIRS})
+ list (APPEND OPENTURNS_PRIVATE_LIBRARIES ${MPFR_LIBRARIES})
+ endif ()
+ endif ()
if((USE_MPC OR USE_MPFR) AND NOT BUILD_SHARED_LIBS)
find_library(GMP_LIBRARY NAMES gmp)
list (APPEND OPENTURNS_PRIVATE_LIBRARIES ${GMP_LIBRARY})
4 changes: 4 additions & 0 deletions ports/openturns/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
openturns provides CMake targets:

find_package(OpenTURNS CONFIG REQUIRED)
target_link_libraries(main PRIVATE OT)
46 changes: 46 additions & 0 deletions ports/openturns/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "openturns",
"version": "1.20",
"description": "OpenTURNS is a scientific C++ and Python library featuring an internal data model and algorithms dedicated to the treatment of uncertainties.",
"homepage": "http://www.openturns.org",
"license": null,
"dependencies": [
"blas",
"boost-multiprecision",
"boost-random",
"ceres",
"cminpack",
"dlib",
"exprtk",
{
"name": "hdf5",
"default-features": false,
"features": [
"cpp"
]
},
"lapack",
"libxml2",
"mpc",
"mpfr",
"muparser",
"nlopt",
"pagmo2",
"pthread",
"python3",
{
"name": "python3",
"host": true
},
"spectra",
"tbb",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
2 changes: 2 additions & 0 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,8 @@ openmesh:arm-uwp=fail
openmesh:x64-uwp=fail
openscap:x64-windows-static=fail
openscap:x64-osx=fail
# osx needs bison 3.4 installed
openturns:x64-osx=fail
# https://github.com/AcademySoftwareFoundation/openvdb/issues/1362
# openvdb\openvdb\libopenvdb.lib : fatal error LNK1248: image size (109A36020) exceeds maximum allowable size (FFFFFFFF)
openvdb:x64-windows-static=fail
Expand Down
4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -5732,6 +5732,10 @@
"baseline": "1.6.0",
"port-version": 3
},
"openturns": {
"baseline": "1.20",
"port-version": 0
},
"openvdb": {
"baseline": "10.0.0",
"port-version": 1
Expand Down
9 changes: 9 additions & 0 deletions versions/o-/openturns.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "7df4639f8285df19714604b6df8f55f170c938f4",
"version": "1.20",
"port-version": 0
}
]
}

0 comments on commit d289dea

Please sign in to comment.