Skip to content
Snippets Groups Projects
Commit b5f78dad authored by Simon Praetorius's avatar Simon Praetorius
Browse files

Fix dune_add_pybind11_submodule

parent 89b80dc4
Branches
Tags
2 merge requests!1470Fix wrong variable name to make target hash (2.10),!1461Fix dune_add_pybind11_submodule
Pipeline #74774 waiting for manual action
......@@ -124,9 +124,8 @@ function(dune_add_pybind11_submodule)
target_compile_definitions(${PYBIND11_SUBMODULE_NAME} PRIVATE ${PYBIND11_SUBMODULE_COMPILE_DEFINITIONS})
# add all package flags
dune_target_enable_all_packages(${PYBIND11_SUBMODULE_NAME})
# minimal c++ standard required
target_compile_features(${PYBIND11_SUBMODULE_NAME} PUBLIC cxx_std_17)
# Link against Dune::Common
target_link_libraries(${PYBIND11_SUBMODULE_NAME} PRIVATE Dune::Common)
# link object file to parent module
target_link_libraries(${PYBIND11_SUBMODULE_MODULE} PUBLIC ${PYBIND11_SUBMODULE_NAME})
......
......@@ -15,15 +15,18 @@ add_python_targets(common
)
dune_add_pybind11_module(NAME _common SOURCES _common.cc)
target_link_libraries(_common PUBLIC Dune::Common)
if( DUNE_ENABLE_PYTHONMODULE_PRECOMPILE )
set(FV_NUMS 0 1 2 3 4)
foreach( FV_NUM ${FV_NUMS} )
dune_add_pybind11_submodule(NAME registerfvector_${FV_NUM}
MODULE _common SOURCES registerfvector.cc
COMPILE_DEFINITIONS FV_NUM=${FV_NUM})
foreach(FV_NUM RANGE 0 4)
add_library(registerfvector_${FV_NUM} OBJECT registerfvector.cc)
target_compile_definitions(registerfvector_${FV_NUM} PRIVATE FV_NUM=${FV_NUM})
target_link_libraries(registerfvector_${FV_NUM} PRIVATE Dune::Common)
# Register the object in the pybind11 module _common
target_link_libraries(_common PRIVATE registerfvector_${FV_NUM})
endforeach()
endif()
set_property(TARGET _common PROPERTY LINK_LIBRARIES dunecommon APPEND)
if(SKBUILD)
install(TARGETS _common LIBRARY DESTINATION python/dune/common)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment