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)