mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-15 22:31:56 -06:00
16d644032c
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.
35 lines
1.4 KiB
CMake
35 lines
1.4 KiB
CMake
# NOTE: we assume that add_subdirectory( pybind11 ) is called from the
|
|
# parent folder's CMakeLists.txt before this CMakeLists.txt is loaded.
|
|
# Therefore, pybind11's CMakeLists.txt has already run
|
|
# find_package(PYTHON) to define variables like
|
|
# ${PYTHON_EXECUTABLE}
|
|
#
|
|
pybind11_add_module(simulators simulators.cpp SYSTEM)
|
|
|
|
set_target_properties( simulators PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/python/opm2 )
|
|
|
|
target_sources(simulators
|
|
PRIVATE
|
|
$<TARGET_OBJECTS:moduleVersion>
|
|
$<TARGET_OBJECTS:flow_libblackoil>)
|
|
|
|
target_link_libraries( simulators PRIVATE opmsimulators )
|
|
|
|
set(PYTHON_PACKAGE_PATH "site-packages")
|
|
set(PYTHON_INSTALL_PREFIX "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/${PYTHON_PACKAGE_PATH}" CACHE STRING "Subdirectory to install Python modules in")
|
|
|
|
install(TARGETS simulators DESTINATION ${DEST_PREFIX}${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX}/opm)
|
|
|
|
file( COPY ${PROJECT_SOURCE_DIR}/python/test
|
|
DESTINATION ${PROJECT_BINARY_DIR}/python)
|
|
file( COPY ${PROJECT_SOURCE_DIR}/python/test_data
|
|
DESTINATION ${PROJECT_BINARY_DIR}/python)
|
|
|
|
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()
|