Salome HOME
merge from master
[tools/sat_salome.git] / products / patches / openturns-1.16.0001.patch
1 diff -Naur openturns_ref openturns_new
2 diff -Naur openturns_ref/cmake/FindNLopt.cmake openturns_new/cmake/FindNLopt.cmake
3 --- openturns_ref/cmake/FindNLopt.cmake 2020-11-09 14:06:44.000000000 +0100
4 +++ openturns_new/cmake/FindNLopt.cmake 2021-06-01 10:23:26.144409150 +0200
5 @@ -11,10 +11,21 @@
6  #  NLOPT_ROOT_DIR - root dir (ex. /usr/local)
7  
8  # set NLOPT_INCLUDE_DIR
9 +SET(NLOPT_ROOT_DIR $ENV{NLOPT_ROOT_DIR})
10 +
11 +IF(NLOPT_ROOT_DIR)
12 +  LIST(APPEND CMAKE_PREFIX_PATH "${NLOPT_ROOT_DIR}")
13 +  LIST(APPEND CMAKE_PREFIX_PATH "${NLOPT_ROOT_DIR}/include")
14 +  LIST(APPEND CMAKE_PREFIX_PATH "${NLOPT_ROOT_DIR}/lib")
15 +ELSE(NLOPT_ROOT_DIR)
16 +  MESSAGE(FATAL_ERROR "PLEASE SET ENVIRONMENT VARIABLE NLOPT_ROOT_DIR")
17 +ENDIF(NLOPT_ROOT_DIR)
18 +
19  find_path (NLOPT_INCLUDE_DIR
20    NAMES nlopt.hpp
21 +  HINTS ${NLOPT_ROOT_DIR}/include
22    DOC
23 -    "Nlopt include directory"
24 +  "Nlopt include directory"
25  )
26  
27  # set NLOPT_INCLUDE_DIRS
28 @@ -22,9 +33,10 @@
29  
30  # set NLOPT_LIBRARY
31  find_library (NLOPT_LIBRARY
32 -  NAMES nlopt_cxx nlopt
33 +  NAMES nlopt
34 +  HINTS ${NLOPT_ROOT_DIR}/lib
35    DOC
36 -    "Nlopt library location"
37 +  "Nlopt library location"
38  )
39  
40  # set NLOPT_LIBRARIES
41 diff -Naur openturns_ref/cmake/FindTBB.cmake openturns_new/cmake/FindTBB.cmake
42 --- openturns_ref/cmake/FindTBB.cmake   2020-11-10 13:21:21.000000000 +0100
43 +++ openturns_new/cmake/FindTBB.cmake   2021-06-01 10:23:26.144409150 +0200
44 @@ -27,6 +27,11 @@
45  # (To distributed this file outside of CMake, substitute the full
46  #  License text for the above reference.)
47  
48 +SET(TBB_ROOT_DIR $ENV{TBB_ROOT_DIR})
49 +IF(TBB_ROOT_DIR)
50 +  LIST(APPEND CMAKE_PREFIX_PATH "${TBB_ROOT_DIR}")
51 +ENDIF(TBB_ROOT_DIR)
52 +
53  find_path (TBB_INCLUDE_DIR NAMES tbb/tbb.h DOC "TBB include directory")
54  
55  set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR})
56 diff -Naur openturns_ref/CMakeLists.txt openturns_new/CMakeLists.txt
57 --- openturns_ref/CMakeLists.txt        2020-11-18 16:33:36.000000000 +0100
58 +++ openturns_new/CMakeLists.txt        2021-06-01 10:26:34.647699757 +0200
59 @@ -125,6 +125,10 @@
60  set (TEMPDIR ${OPENTURNS_TEMPDIR})
61  
62  set (CMAKE_CXX_STANDARD 11)
63 +SET(LAPACK_ROOT_DIR $ENV{LAPACK_ROOT_DIR})
64 +IF(LAPACK_ROOT_DIR)
65 +  LIST(APPEND CMAKE_PREFIX_PATH "${LAPACK_ROOT_DIR}")
66 +ENDIF(LAPACK_ROOT_DIR)
67  
68  if (NOT DEFINED LAPACK_LIBRARIES)
69    find_package (LAPACK REQUIRED)
70 @@ -156,7 +160,11 @@
71    endif ()
72  endif ()
73  
74 -if (USE_TBB)
75 +if (USE_TBB) 
76 +  SET(TBB_ROOT_DIR $ENV{TBB_ROOT_DIR})
77 +  if(TBB_ROOT_DIR)
78 +    LIST(APPEND CMAKE_PREFIX_PATH "${TBB_ROOT_DIR}")
79 +  endif(TBB_ROOT_DIR)
80    find_package (TBB)
81  endif ()
82  if (TBB_FOUND)
83 @@ -200,6 +208,10 @@
84  endif ()
85  
86  if (USE_LIBXML2)
87 +  SET(LIBXML2_ROOT_DIR $ENV{LIBXLM2_ROOT_DIR})
88 +  if(LIBXML2_ROOT_DIR)
89 +    LIST(APPEND CMAKE_PREFIX_PATH "${LIBXML2_ROOT_DIR}")    
90 +  endif(LIBXML2_ROOT_DIR)
91    find_package (LibXml2)
92  endif ()
93  if (LIBXML2_FOUND)
94 @@ -210,15 +222,25 @@
95  endif ()
96  
97  if (USE_HDF5)
98 -  find_package(HDF5 COMPONENTS CXX)
99 -endif ()
100 +  SET(HDF5_ROOT_DIR $ENV{HDF5_ROOT_DIR} CACHE PATH "Path to the HDF5.")
101 +  IF(HDF5_ROOT_DIR)
102 +    LIST(APPEND CMAKE_PREFIX_PATH "${HDF5_ROOT_DIR}")
103 +  ENDIF(HDF5_ROOT_DIR)
104 +  find_package(HDF5 COMPONENTS CXX HL)
105 +endif ()
106 +SET(MPI_ROOT_DIR $ENV{MPI_ROOT_DIR} CACHE PATH "Path to the MPI.")
107 +IF(MPI_ROOT_DIR)
108 + LIST(APPEND CMAKE_PREFIX_PATH "${MPI_ROOT_DIR}")
109 + find_package(MPI)
110 + list (APPEND OPENTURNS_PRIVATE_INCLUDE_DIRS ${MPI_INCLUDE_DIRS})
111 + list (APPEND OPENTURNS_PRIVATE_LIBRARIES ${MPI_LIBRARIES})
112 +ENDIF(MPI_ROOT_DIR)
113  if (HDF5_FOUND)
114    set (OPENTURNS_HAVE_HDF5 TRUE)
115    list (APPEND OPENTURNS_DEFINITIONS ${HDF5_DEFINITIONS})
116    list (APPEND OPENTURNS_PRIVATE_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS})
117    list (APPEND OPENTURNS_PRIVATE_LIBRARIES ${HDF5_LIBRARIES})
118  endif ()
119 -
120  if (MSVC OR WINTEL)
121    set (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/lib/include/pthread_win32 ${CMAKE_CURRENT_SOURCE_DIR}/lib/include)
122    include_directories (${PROJECT_SOURCE_DIR}/lib/include/pthread_win32 ${CMAKE_CURRENT_SOURCE_DIR}/lib/include)
123 @@ -257,7 +279,7 @@
124  endif ()
125  
126  if (USE_NLOPT)
127 -  find_package (NLopt CONFIG QUIET)
128 +#  find_package (NLopt CONFIG QUIET)
129    if (NLopt_FOUND)
130      message(STATUS "Found NLopt: ${NLopt_DIR}")
131    else ()
132 diff -Naur openturns_ref/lib/src/Base/Common/openturns/TBB.hxx openturns_new/lib/src/Base/Common/openturns/TBB.hxx
133 --- openturns_ref/lib/src/Base/Common/openturns/TBB.hxx 2020-11-10 13:21:21.000000000 +0100
134 +++ openturns_new/lib/src/Base/Common/openturns/TBB.hxx 2021-06-01 10:23:26.145409141 +0200
135 @@ -35,6 +35,7 @@
136  #  define __TBBMALLOC_NO_IMPLICIT_LINKAGE 1
137  # endif
138  #endif
139 +#define TBB_PREVIEW_TASK_ARENA 1
140  #include <tbb/task_arena.h>
141  #include <tbb/parallel_sort.h>
142  #include <tbb/parallel_reduce.h>
143 diff -Naur openturns_ref/lib/src/CMakeLists.txt openturns_new/lib/src/CMakeLists.txt
144 --- openturns_ref/lib/src/CMakeLists.txt        2020-11-10 13:21:21.000000000 +0100
145 +++ openturns_new/lib/src/CMakeLists.txt        2021-06-01 10:23:26.144409150 +0200
146 @@ -80,15 +80,15 @@
147    add_dependencies (OT generate_csv_parser)
148  endif ()
149  
150 -target_link_libraries (OT PUBLIC ${OPENTURNS_LIBRARIES})
151 -target_link_libraries (OT PRIVATE ${OPENTURNS_PRIVATE_LIBRARIES})
152 +target_link_libraries (OT PUBLIC ${OPENTURNS_LIBRARIES} ${HDF5_LIBRARIES} ${TBB_LIBRARIES})
153 +target_link_libraries (OT PRIVATE ${OPENTURNS_PRIVATE_LIBRARIES}  ${HDF5_LIBRARIES} ${TBB_LIBRARIES})
154  
155  target_include_directories (OT INTERFACE $<INSTALL_INTERFACE:include>)
156  target_include_directories (OT PUBLIC ${OPENTURNS_INCLUDE_DIRS})
157  
158  # Build an empty executable to check link dependencies and completeness
159  add_executable (linktest main.cxx)
160 -target_link_libraries (linktest OT)
161 +target_link_libraries (linktest OT ${TBB_LIBRARIES} ${HDF5_LIBRARIES})
162  set_target_properties (linktest PROPERTIES
163                                   INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${CMAKE_BINARY_DIR}/lib/src")
164  
165 @@ -109,5 +109,5 @@
166  if (UNIX AND BUILD_SHARED_LIBS)
167    set (OT_GDB_PY ${CMAKE_SHARED_LIBRARY_PREFIX}OT${CMAKE_SHARED_LIBRARY_SUFFIX}.${LIB_VERSION}-gdb.py)
168    execute_process (COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/libOT-gdb.py ${CMAKE_CURRENT_BINARY_DIR}/${OT_GDB_PY})
169 -  install (FILES libOT-gdb.py DESTINATION ${OPENTURNS_DATA_PATH}/gdb/auto-load/${LIBRARY_PATH} RENAME ${OT_GDB_PY})
170 +  install (FILES libOT-gdb.py DESTINATION ${OPENTURNS_DATA_PATH}/gdb/auto-load RENAME ${OT_GDB_PY})
171  endif ()