Skip to content

Commit 2695b71

Browse files
committed
Update to OT 1.24
1 parent 8d94fa6 commit 2695b71

File tree

4 files changed

+39
-38
lines changed

4 files changed

+39
-38
lines changed

.ci_support/run_docker_linux.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mkdir build && cd build
77
cmake -DCMAKE_INSTALL_PREFIX=~/.local \
88
-DCMAKE_UNITY_BUILD=ON \
99
-DCMAKE_CXX_FLAGS="-Wall -Wextra -Werror -Wno-unused-parameter -D_GLIBCXX_ASSERTIONS" \
10-
-DSPHINX_FLAGS="-W -T -j4" \
10+
-DUSE_SPHINX=ON -DSPHINX_FLAGS="-W -T -j4" \
1111
/io
1212
make install
1313
make tests

CMakeLists.txt

+26-35
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.13)
22

33
option(BUILD_PYTHON "Build the python module for the library" ON)
4-
option(USE_SPHINX "Use sphinx for documentation" ON)
4+
option(USE_SPHINX "Use sphinx for documentation" OFF)
55
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
66

77
# By default, build in Release mode. Must appear before project() command
@@ -32,9 +32,6 @@ message(STATUS "Found aGrUM: ${AGRUM_ROOTDIR} (found version \"${AGRUM_VERSION_S
3232

3333
find_package(OpenTURNS 1.23 CONFIG REQUIRED)
3434
message(STATUS "Found OpenTURNS: ${OPENTURNS_ROOT_DIR} (found version \"${OPENTURNS_VERSION_STRING}\")")
35-
if (NOT DEFINED OPENTURNS_PYTHON_MODULE_PATH)
36-
set (OPENTURNS_PYTHON_MODULE_PATH ${OPENTURNS_PYTHON3_MODULE_PATH})
37-
endif ()
3835

3936
set(OTAGRUM_DEFINITIONS ${OPENTURNS_DEFINITIONS})
4037
if (NOT BUILD_SHARED_LIBS)
@@ -75,7 +72,8 @@ if (BUILD_PYTHON)
7572
if (USE_SPHINX)
7673
find_program (SPHINX_EXECUTABLE NAMES sphinx-build DOC "Sphinx Documentation Builder (sphinx-doc.org)")
7774
find_python_module (numpydoc)
78-
if (SPHINX_EXECUTABLE AND NUMPYDOC_FOUND AND MATPLOTLIB_FOUND)
75+
find_python_module (sphinx_copybutton)
76+
if (SPHINX_EXECUTABLE AND NUMPYDOC_FOUND AND SPHINX_COPYBUTTON_FOUND AND MATPLOTLIB_FOUND)
7977
find_python_module (sphinx 1.1)
8078
endif ()
8179
if (NOT SPHINX_FOUND)
@@ -92,7 +90,11 @@ if (BUILD_PYTHON)
9290
endif ()
9391

9492
# Guess agrum python module path
95-
set(AGRUM_PYTHON_MODULE_PATH ${AGRUM_ROOTDIR}/${OTAGRUM_PYTHON_MODULE_PATH})
93+
if (EXISTS ${AGRUM_ROOTDIR}/${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages)
94+
set(AGRUM_PYTHON_MODULE_PATH ${AGRUM_ROOTDIR}/${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages)
95+
elseif (EXISTS ${AGRUM_ROOTDIR}/${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/dist-packages)
96+
set(AGRUM_PYTHON_MODULE_PATH ${AGRUM_ROOTDIR}/${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/dist-packages)
97+
endif ()
9698

9799
# Define variables without OTAGRUM_ prefix with absolute paths
98100
foreach (_var PYTHON_MODULE_PATH LIBRARY_PATH INCLUDE_PATH CONFIG_CMAKE_PATH)
@@ -107,19 +109,8 @@ foreach (_var PYTHON_MODULE_PATH LIBRARY_PATH INCLUDE_PATH CONFIG_CMAKE_PATH)
107109
endforeach ()
108110

109111
# RPATH settings
110-
set(CMAKE_INSTALL_RPATH ${LIBRARY_PATH})
111-
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
112-
if (POLICY CMP0042)
113-
# Set MACOSX_RPATH to ON
114-
cmake_policy(SET CMP0042 NEW)
115-
endif ()
116-
if (POLICY CMP0078)
117-
# Set MACOSX_RPATH to ON
118-
cmake_policy(SET CMP0078 NEW)
119-
endif()
120-
if (POLICY CMP0086)
121-
cmake_policy (SET CMP0086 NEW)
122-
endif()
112+
set (CMAKE_INSTALL_RPATH ${LIBRARY_PATH})
113+
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
123114

124115
# Some useful macros to ease CMakeLists.txt file writing
125116
set (SOURCEFILES "" CACHE INTERNAL "List of source files to compile")
@@ -162,30 +153,30 @@ set(CPACK_SOURCE_PACKAGE_FILE_NAME ${PACKAGE_NAME}-${PACKAGE_VERSION})
162153

163154

164155
# The tests can't be run if this function is absent
165-
enable_testing()
166-
add_custom_target(tests COMMENT "Build tests")
167-
add_custom_target(check COMMENT "Run pre-installation tests")
168-
add_custom_target(installcheck COMMENT "Run post-installation tests")
156+
enable_testing ()
157+
add_custom_target (tests COMMENT "Build tests")
158+
add_custom_target (check COMMENT "Run pre-installation tests")
159+
add_custom_target (installcheck COMMENT "Run post-installation tests")
169160

170-
add_subdirectory(lib)
171-
add_dependencies(check cppcheck)
161+
add_subdirectory (lib)
162+
add_dependencies (check cppcheck)
172163

173-
if (Python_FOUND)
174-
add_subdirectory(python)
175-
add_dependencies(installcheck pyinstallcheck)
164+
if (Python_FOUND AND SWIG_FOUND)
165+
add_subdirectory (python)
166+
add_dependencies (installcheck pyinstallcheck)
176167
endif ()
177168

178169

179170
# uninstall target
180-
configure_file(
181-
${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
182-
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
183-
IMMEDIATE @ONLY
171+
configure_file (
172+
${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
173+
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
174+
IMMEDIATE @ONLY
184175
)
185176

186-
add_custom_target(uninstall
187-
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
188-
)
177+
add_custom_target ( uninstall
178+
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
179+
)
189180

190181
set ( OTAGRUM_LIBRARY otagrum )
191182
set ( OTAGRUM_LIBRARIES ${OPENTURNS_LIBRARIES} )

lib/src/otagrum/ContinuousBayesianNetwork.hxx

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@
2121
#ifndef OTAGRUM_CONTINUOUSBAYESIANNETWORK_HXX
2222
#define OTAGRUM_CONTINUOUSBAYESIANNETWORK_HXX
2323

24-
#include <openturns/ContinuousDistribution.hxx>
2524
#include <openturns/Distribution.hxx>
2625

26+
#if OPENTURNS_VERSION < 102400
27+
#include <openturns/ContinuousDistribution.hxx>
28+
#else
29+
#define ContinuousDistribution DistributionImplementation
30+
#endif
31+
2732
#include "otagrum/NamedDAG.hxx"
2833
#include "otagrum/otagrumprivate.hxx"
2934

lib/src/otagrum/JunctionTreeBernsteinCopula.hxx

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@
2121
#ifndef OTAGRUM_JUNCTIONTREEBERNSTEINCOPULA_HXX
2222
#define OTAGRUM_JUNCTIONTREEBERNSTEINCOPULA_HXX
2323

24-
#include <openturns/ContinuousDistribution.hxx>
2524
#include <openturns/Distribution.hxx>
2625
#include <openturns/Sample.hxx>
2726

27+
#if OPENTURNS_VERSION < 102400
28+
#include <openturns/ContinuousDistribution.hxx>
29+
#else
30+
#define ContinuousDistribution DistributionImplementation
31+
#endif
32+
2833
#include "NamedJunctionTree.hxx"
2934
#include "otagrum/otagrumprivate.hxx"
3035

0 commit comments

Comments
 (0)