From 16d644032c7c0a58970f655186255f33d5830975 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 18 Nov 2020 09:42:39 +0100 Subject: [PATCH] add cmake option to disable the python tests due to bugs in the openmpi on bionic, this test fails to execute properly in pbuilder environments. instead of rebuilding openmpi without dynamic loading (which is the suggested fix) and potentially break users systems, this is a non-intrusive workaround to be used for packaging. also add explicit option for python support to make it visible in cmake frontends. --- CMakeLists.txt | 2 ++ python/simulators/CMakeLists.txt | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33899f489..6775ae356 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,8 @@ option(BUILD_EBOS "Build the research oriented ebos simulator?" ON) option(BUILD_EBOS_EXTENSIONS "Build the variants for various extensions of ebos by default?" OFF) option(BUILD_EBOS_DEBUG_EXTENSIONS "Build the ebos variants which are purely for debugging by default?" OFF) option(BUILD_FLOW_POLY_GRID "Build flow blackoil with polyhedral grid" OFF) +option(OPM_ENABLE_PYTHON "Enable python bindings?" OFF) +option(OPM_ENABLE_PYTHON_TESTS "Enable tests for the python bindings?" ON) if(SIBLING_SEARCH AND NOT opm-common_DIR) # guess the sibling dir diff --git a/python/simulators/CMakeLists.txt b/python/simulators/CMakeLists.txt index f62e629cb..3c5681453 100644 --- a/python/simulators/CMakeLists.txt +++ b/python/simulators/CMakeLists.txt @@ -25,8 +25,10 @@ file( COPY ${PROJECT_SOURCE_DIR}/python/test file( COPY ${PROJECT_SOURCE_DIR}/python/test_data DESTINATION ${PROJECT_BINARY_DIR}/python) -add_test(NAME python_tests - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/python - COMMAND ${CMAKE_COMMAND} - -E env PYTHONPATH=${PROJECT_BINARY_DIR}/python:$ENV{PYTHONPATH} - ${PYTHON_EXECUTABLE} -m unittest ) +if(OPM_ENABLE_PYTHON_TESTS) + add_test(NAME python_tests + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/python + COMMAND ${CMAKE_COMMAND} + -E env PYTHONPATH=${PROJECT_BINARY_DIR}/python:$ENV{PYTHONPATH} + ${PYTHON_EXECUTABLE} -m unittest ) +endif()