Salome HOME
merge from master
[tools/sat_salome.git] / products / patches / openturns-1.19.0001.patch
1 diff -Naur openturns-1.19_ref/openturns-1.19/CMakeLists.txt openturns-1.19_new/openturns-1.19/CMakeLists.txt
2 --- openturns-1.19_ref/openturns-1.19/CMakeLists.txt    2022-09-19 20:42:54.651892829 +0200
3 +++ openturns-1.19_new/openturns-1.19/CMakeLists.txt    2022-09-19 20:50:32.780078679 +0200
4 @@ -140,6 +140,10 @@
5  
6  set (CMAKE_CXX_STANDARD 11)
7  
8 +SET(LAPACK_ROOT_DIR $ENV{LAPACK_ROOT_DIR})
9 +IF(LAPACK_ROOT_DIR)
10 +  LIST(APPEND CMAKE_PREFIX_PATH "${LAPACK_ROOT_DIR}")
11 +ENDIF(LAPACK_ROOT_DIR)
12  if (NOT DEFINED LAPACK_LIBRARIES)
13    find_package (LAPACK REQUIRED)
14    if (LAPACK_FOUND)
15 @@ -148,6 +152,10 @@
16  endif ()
17  list (APPEND OPENTURNS_PRIVATE_LIBRARIES ${LAPACK_LIBRARIES})
18  
19 +IF (DEFINED CBLAS_LIBRARIES)
20 +  MESSAGE(STATUS "CBLAS_LIBRARIES is defined... adding to the list of libraries ${CBLAS_LIBRARIES}")
21 +  LIST (APPEND OPENTURNS_PRIVATE_LIBRARIES ${CBLAS_LIBRARIES})
22 +ENDIF()
23  if (USE_SPECTRA)
24    find_package (Spectra 1.0 CONFIG)
25  endif ()
26 @@ -192,7 +200,11 @@
27  endif ()
28  
29  if (USE_TBB)
30 -  find_package (TBB CONFIG)
31 +  SET(TBB_ROOT_DIR $ENV{TBB_ROOT_DIR})
32 +  if(TBB_ROOT_DIR)
33 +    LIST(APPEND CMAKE_PREFIX_PATH "${TBB_ROOT_DIR}")
34 +  endif(TBB_ROOT_DIR)
35 +  find_package (TBB CONFIG)
36    if (TBB_FOUND)
37      message (STATUS "Found TBB: ${TBB_DIR} (found version ${TBB_VERSION})")
38      set (TBB_LIBRARIES TBB::tbb)
39 @@ -243,6 +255,10 @@
40  endif ()
41  
42  if (USE_LIBXML2)
43 +  SET(LIBXML2_ROOT_DIR $ENV{LIBXLM2_ROOT_DIR})
44 +  if(LIBXML2_ROOT_DIR)
45 +    LIST(APPEND CMAKE_PREFIX_PATH "${LIBXML2_ROOT_DIR}")
46 +  endif(LIBXML2_ROOT_DIR)
47    find_package (LibXml2)
48  endif ()
49  if (LIBXML2_FOUND)
50 @@ -252,7 +268,19 @@
51    list (APPEND OPENTURNS_PRIVATE_LIBRARIES ${LIBXML2_LIBRARIES})
52  endif ()
53  
54 +SET(MPI_ROOT_DIR $ENV{MPI_ROOT_DIR} CACHE PATH "Path to the MPI.")
55 +IF(MPI_ROOT_DIR)
56 + LIST(APPEND CMAKE_PREFIX_PATH "${MPI_ROOT_DIR}")
57 + find_package(MPI)
58 + list (APPEND OPENTURNS_PRIVATE_INCLUDE_DIRS ${MPI_INCLUDE_DIRS})
59 + list (APPEND OPENTURNS_PRIVATE_LIBRARIES ${MPI_LIBRARIES})
60 +ENDIF(MPI_ROOT_DIR)
61 +
62  if (USE_HDF5)
63 +  SET(HDF5_ROOT_DIR $ENV{HDF5_ROOT_DIR} CACHE PATH "Path to the HDF5.")
64 +  IF(HDF5_ROOT_DIR)
65 +    LIST(APPEND CMAKE_PREFIX_PATH "${HDF5_ROOT_DIR}")
66 +  ENDIF(HDF5_ROOT_DIR)
67    find_package(HDF5 COMPONENTS C CXX)
68  endif ()
69  if (HDF5_FOUND)
70 @@ -273,6 +301,10 @@
71  endif ()
72  
73  if (USE_BOOST)
74 +  SET(BOOST_ROOT_DIR $ENV{BOOST_ROOT_DIR} CACHE PATH "Path to the BOOST.")
75 +  IF(BOOST_ROOT_DIR)
76 +    LIST(APPEND CMAKE_PREFIX_PATH "${BOOST_ROOT_DIR}")
77 +  ENDIF(BOOST_ROOT_DIR)
78    find_package (Boost 1.46)
79    if (Boost_FOUND)
80      if (CMAKE_VERSION VERSION_LESS 3.15)
81 @@ -308,7 +340,11 @@
82  endif ()
83  
84  if (USE_NLOPT)
85 -  find_package (NLopt CONFIG QUIET)
86 +  SET(NLOPT_ROOT_DIR $ENV{NLOPT_ROOT_DIR} CACHE PATH "Path to the NLOPT.")
87 +  IF(NLOPT_ROOT_DIR)
88 +    LIST(APPEND CMAKE_PREFIX_PATH "${NLOPT_ROOT_DIR}")
89 +  ENDIF(NLOPT_ROOT_DIR)
90 +  find_package (NLopt)
91    if (NLopt_FOUND)
92      message(STATUS "Found NLopt: ${NLopt_DIR}  (found version \"${NLopt_VERSION}\")")
93    else ()
94 @@ -372,22 +408,22 @@
95  endif ()
96  
97  if (USE_CMINPACK)
98 -  find_package (CMinpack CONFIG QUIET)
99 -  if (CMinpack_FOUND)
100 -    if (TARGET cminpack::cminpack)
101 -      message (STATUS "Found CMinpack: ${CMinpack_DIR}")
102 -      set (CMINPACK_LIBRARIES cminpack::cminpack)
103 -    endif ()
104 -  else ()
105 -    # fallback to our macro if CMinpackConfig is not provided
106 -    find_package (CMinpack)
107 -    set (CMinpack_FOUND ${CMINPACK_FOUND})
108 -  endif ()
109 -  if (CMinpack_FOUND)
110 -    set (OPENTURNS_HAVE_CMINPACK TRUE)
111 -    list (APPEND OPENTURNS_PRIVATE_INCLUDE_DIRS ${CMINPACK_INCLUDE_DIRS})
112 -    list (APPEND OPENTURNS_PRIVATE_LIBRARIES ${CMINPACK_LIBRARIES})
113 -  endif ()
114 +  SET(CMINPACK_ROOT_DIR $ENV{CMINPACK_ROOT_DIR} CACHE PATH "Path to the CMINPACK.")
115 +  IF(CMINPACK_ROOT_DIR)
116 +    LIST(APPEND CMAKE_PREFIX_PATH "${CMINPACK_ROOT_DIR}")
117 +  ENDIF(CMINPACK_ROOT_DIR)
118 +  find_package (CMinpack)
119 +  set (CMinpack_FOUND ${CMINPACK_FOUND})
120 +endif ()
121 +if (CMinpack_FOUND)
122 +  MESSAGE(STATUS "Found CMkinpack ...")
123 +  MESSAGE(STATUS "      CMINPACK_LIBRARIES is set to: ${CMINPACK_LIBRARIES}")
124 +  set (OPENTURNS_HAVE_CMINPACK TRUE)
125 +  list (APPEND OPENTURNS_PRIVATE_INCLUDE_DIRS ${CMINPACK_INCLUDE_DIRS})
126 +  list (APPEND OPENTURNS_PRIVATE_LIBRARIES ${CMINPACK_LIBRARIES})
127 +else()
128 +  MESSAGE(STATUS "Could not find MinPack dependency")
129 +  set (OPENTURNS_HAVE_CMINPACK FALSE)
130  endif ()
131  
132  if (USE_BONMIN)
133 diff -Naur openturns-1.19_ref/openturns-1.19/cmake/FindCMinpack.cmake openturns-1.19_new/openturns-1.19/cmake/FindCMinpack.cmake
134 --- openturns-1.19_ref/openturns-1.19/cmake/FindCMinpack.cmake  2022-09-19 20:42:54.983898861 +0200
135 +++ openturns-1.19_new/openturns-1.19/cmake/FindCMinpack.cmake  2022-09-19 20:53:05.646768854 +0200
136 @@ -22,12 +22,18 @@
137  # (To distributed this file outside of CMake, substitute the full
138  #  License text for the above reference.)
139  
140 +SET(CMINPACK_ROOT_DIR $ENV{CMINPACK_ROOT_DIR})
141 +if(CMINPACK_ROOT_DIR)
142 + LIST(APPEND CMAKE_PREFIX_PATH "${CMINPACK_ROOT_DIR}")
143 +endif(CMINPACK_ROOT_DIR)
144  find_path (CMINPACK_INCLUDE_DIR cminpack.h
145    PATH_SUFFIXES cminpack cminpack-1
146  )
147  
148  find_library (CMINPACK_LIBRARY
149    NAMES cminpack cminpack_s
150 +  HINTS ${CMINPACK_ROOT_DIR}/include
151 +  DOC   "CMINPACK include directory"
152  )
153  
154  set (CMINPACK_LIBRARIES ${CMINPACK_LIBRARY})
155 diff -Naur openturns-1.19_ref/openturns-1.19/cmake/FindNLopt.cmake openturns-1.19_new/openturns-1.19/cmake/FindNLopt.cmake
156 --- openturns-1.19_ref/openturns-1.19/cmake/FindNLopt.cmake     2022-09-19 20:42:54.947898206 +0200
157 +++ openturns-1.19_new/openturns-1.19/cmake/FindNLopt.cmake     2022-09-19 20:58:34.988527189 +0200
158 @@ -11,10 +11,20 @@
159  #  NLOPT_ROOT_DIR - root dir (ex. /usr/local)
160  
161  # set NLOPT_INCLUDE_DIR
162 +SET(NLOPT_ROOT_DIR $ENV{NLOPT_ROOT_DIR})
163 +
164 +IF(NLOPT_ROOT_DIR)
165 +  LIST(APPEND CMAKE_PREFIX_PATH "${NLOPT_ROOT_DIR}")
166 +  LIST(APPEND CMAKE_PREFIX_PATH "${NLOPT_ROOT_DIR}/include")
167 +  LIST(APPEND CMAKE_PREFIX_PATH "${NLOPT_ROOT_DIR}/lib")
168 +ELSE(NLOPT_ROOT_DIR)
169 +  MESSAGE(FATAL_ERROR "PLEASE SET ENVIRONMENT VARIABLE NLOPT_ROOT_DIR")
170 +ENDIF(NLOPT_ROOT_DIR)
171  find_path (NLOPT_INCLUDE_DIR
172    NAMES nlopt.hpp
173    DOC
174      "Nlopt include directory"
175 +  HINTS ${NLOPT_ROOT_DIR}/include
176  )
177  
178  # set NLOPT_INCLUDE_DIRS
179 @@ -22,7 +32,8 @@
180  
181  # set NLOPT_LIBRARY
182  find_library (NLOPT_LIBRARY
183 -  NAMES nlopt_cxx nlopt
184 +  NAMES nlopt
185 +  HINTS ${NLOPT_ROOT_DIR}/lib 
186    DOC
187      "Nlopt library location"
188  )
189 diff -Naur openturns-1.19_ref/openturns-1.19/cmake/FindTBB.cmake openturns-1.19_new/openturns-1.19/cmake/FindTBB.cmake
190 --- openturns-1.19_ref/openturns-1.19/cmake/FindTBB.cmake       2022-09-19 20:42:54.943898134 +0200
191 +++ openturns-1.19_new/openturns-1.19/cmake/FindTBB.cmake       2022-09-19 20:59:43.185715121 +0200
192 @@ -27,6 +27,10 @@
193  # (To distributed this file outside of CMake, substitute the full
194  #  License text for the above reference.)
195  
196 +SET(TBB_ROOT_DIR $ENV{TBB_ROOT_DIR})
197 +IF(TBB_ROOT_DIR)
198 +  LIST(APPEND CMAKE_PREFIX_PATH "${TBB_ROOT_DIR}")
199 +ENDIF(TBB_ROOT_DIR)
200  find_path (TBB_INCLUDE_DIR NAMES tbb/tbb.h DOC "TBB include directory")
201  
202  set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR})
203 diff -Naur openturns-1.19_ref/openturns-1.19/lib/src/CMakeLists.txt  openturns-1.19_new/openturns-1.19/lib/src/CMakeLists.txt 
204 --- openturns-1.19_ref/openturns-1.19/lib/src/CMakeLists.txt    2022-09-19 20:43:02.736039628 +0200
205 +++ openturns-1.19_new/openturns-1.19/lib/src/CMakeLists.txt    2022-09-19 21:14:17.908888927 +0200
206 @@ -127,5 +127,5 @@
207  if (UNIX AND BUILD_SHARED_LIBS)
208    set (OT_GDB_PY ${CMAKE_SHARED_LIBRARY_PREFIX}OT${CMAKE_SHARED_LIBRARY_SUFFIX}.${LIB_VERSION}-gdb.py)
209    execute_process (COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/libOT-gdb.py ${CMAKE_CURRENT_BINARY_DIR}/${OT_GDB_PY})
210 -  install (FILES libOT-gdb.py DESTINATION ${OPENTURNS_DATA_PATH}/gdb/auto-load/${LIBRARY_PATH} RENAME ${OT_GDB_PY})
211 +  install (FILES libOT-gdb.py DESTINATION ${OPENTURNS_DATA_PATH}/gdb/auto-load RENAME ${OT_GDB_PY})
212  endif ()
213 diff -Naur openturns-1.19_ref/openturns-1.19/lib/src/Base/Common/openturns/TBBImplementation.hxx openturns-1.19_new/openturns-1.19/lib/src/Base/Common/openturns/TBBImplementation.hxx
214 --- openturns-1.19_ref/openturns-1.19/lib/src/Base/Common/openturns/TBBImplementation.hxx       2022-09-19 20:43:07.228121152 +0200
215 +++ openturns-1.19_new/openturns-1.19/lib/src/Base/Common/openturns/TBBImplementation.hxx       2022-09-19 21:16:38.747275561 +0200
216 @@ -35,6 +35,7 @@
217  #  define __TBBMALLOC_NO_IMPLICIT_LINKAGE 1
218  # endif
219  #endif
220 +#define TBB_PREVIEW_TASK_ARENA 1
221  #include <tbb/task_arena.h>
222  #include <tbb/parallel_sort.h>
223  #include <tbb/parallel_reduce.h>
224 diff -Naur openturns-1.19_ref/openturns-1.19/lib/src/Base/Algo/openturns/KarhunenLoeveAlgorithmImplementation.hxx openturns-1.19_new/openturns-1.19/lib/src//Base/Algo/openturns/KarhunenLoeveAlgorithmImplementation.hxx
225 --- openturns-1.19_ref/openturns-1.19/lib/src/Base/Algo/openturns/KarhunenLoeveAlgorithmImplementation.hxx      2022-09-19 20:43:04.604073534 +0200
226 +++ openturns-1.19_new/openturns-1.19/lib/src//Base/Algo/openturns/KarhunenLoeveAlgorithmImplementation.hxx     2022-09-19 21:22:20.888944236 +0200
227 @@ -24,6 +24,13 @@
228  #include "openturns/PersistentObject.hxx"
229  #include "openturns/CovarianceModel.hxx"
230  #include "openturns/KarhunenLoeveResult.hxx"
231 +#ifdef __GNUC__
232 +#  include <features.h>
233 +#  if __GNUC_PREREQ(11,0)
234 +#     include <limits>
235 +#  endif
236 +#endif // __GNUC__
237 +
238  
239  BEGIN_NAMESPACE_OPENTURNS
240