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