Files
opm-common/python/sunbeam/CMakeLists.txt
Joakim Hove 77795b5005 Add 'python/' from commit '278373703455ea6562a0f8e5278b4db46eb1fc7e'
git-subtree-dir: python
git-subtree-mainline: e8dbf7d8ee
git-subtree-split: 2783737034
2019-05-08 07:20:29 +02:00

52 lines
2.2 KiB
CMake

pybind11_add_module(libsunbeam sunbeam.cpp
eclipse_state.cpp
deck_keyword.cpp
deck.cpp
well.cpp
sunbeam_state.cpp
schedule.cpp
connection.cpp
eclipse_config.cpp
table_manager.cpp
eclipse_grid.cpp
group.cpp
group_tree.cpp
eclipse_3d_properties.cpp
parser.cpp)
set_target_properties( libsunbeam PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/python/sunbeam )
include_directories( ${opm-common_INCLUDE_DIRS} )
# The cmake config files generated by opm-common are generated in a non standard
# way and they are not fully relocatable. This creates problems when we are
# building sunbeam towards a opm-common distribution which has been installed
# using the DESTDIR option in make install.
#
# If we subsequently configure sunbeam as:
#
# bash% cmake .. -DDEST_PREFIX=/path/to/DESTDIR
#
# There is an extreme scotch-tape-and-chewing-gum solution which just barely
# works:
#
# 1. When evaluating opm-common-config.cmake the DEST_PREFIX variable is
# detected and the paths are manually prefixed with DEST_PREFIX.
#
# 2. Here we link explicitly to the dependenencies of opm-common; i.e. ecl and
# three boost libraries insteady linking transitively through the
# ${opm-common_LIBRARIES} variable.
#
# See also the file cmake/Templates/opm-project-config.cmake.in in the
# opm-common distribution which this hack depends on.
if (DEST_PREFIX)
find_package(ecl)
find_package(Boost REQUIRED COMPONENTS filesystem regex)
target_link_libraries(libsunbeam PRIVATE ecl)
target_link_libraries(libsunbeam PRIVATE ${Boost_LIBRARIES})
target_link_libraries(libsunbeam PRIVATE ${opm-common_LIBRARY})
else()
target_link_libraries( libsunbeam PRIVATE ${opm-common_LIBRARIES} )
endif()
install(TARGETS libsunbeam DESTINATION ${PYTHON_INSTALL_PREFIX}/sunbeam)