diff --git a/cmake/modules/DunePybindxiUtils.cmake b/cmake/modules/DunePybindxiUtils.cmake index 82f31374cec096ed714e36316b851fef3e0a25ae..f37fd344cb64e0d59067c114a67ef415c59cbaf7 100644 --- a/cmake/modules/DunePybindxiUtils.cmake +++ b/cmake/modules/DunePybindxiUtils.cmake @@ -113,6 +113,8 @@ function(dune_pybindxi_add_module target_name) # namespace; also turning it on for a pybind module compilation here avoids # potential warnings or issues from having mixed hidden/non-hidden types. set_target_properties(${target_name} PROPERTIES CXX_VISIBILITY_PRESET "hidden") + set_target_properties(${target_name} PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE) + if(WIN32 OR CYGWIN) # Link against the Python shared library on Windows @@ -179,3 +181,21 @@ function(dune_pybindxi_add_module target_name) endif() endif() endfunction() + +macro(dxt_add_make_dependent_bindings) + add_custom_target(dependent_bindings) + if(TARGET bindings AND NOT DXT_NO_AUTO_BINDINGS_DEPENDS) + add_dependencies(bindings dependent_bindings) + endif() + foreach(_mod ${ARGN} ) + dune_module_path(MODULE ${_mod} + RESULT ${_mod}_binary_dir + BUILD_DIR) + set(tdir ${${_mod}_binary_dir}) + if(IS_DIRECTORY ${tdir}) + add_custom_target( ${_mod}_bindings + COMMAND ${CMAKE_COMMAND} --build ${tdir} --target bindings) + add_dependencies(dependent_bindings ${_mod}_bindings) + endif() + endforeach() +endmacro() diff --git a/dune/pybindxi/interpreter.hh b/dune/pybindxi/interpreter.hh index b6f40fd3440f45effee56f9fb3c3350057ddc3b3..680f569113022031899959865be7eefbf1371948 100644 --- a/dune/pybindxi/interpreter.hh +++ b/dune/pybindxi/interpreter.hh @@ -15,6 +15,8 @@ #include <map> #include <string> +#include <dune/common/visibility.hh> + #include "embed.h" namespace Dune { @@ -33,7 +35,7 @@ private: std::map<std::string, pybind11::module> modules_; }; // class ScopedInterpreter -ScopedInterpreter &GlobalInterpreter(); +DUNE_EXPORT ScopedInterpreter &GlobalInterpreter(); } // namespace PybindXI } // namespace Dune diff --git a/pybind11/tools/FindPythonLibsNew.cmake b/pybind11/tools/FindPythonLibsNew.cmake index 221bb42e1d9e64eea223e03723ad1f8280eec2d9..5f170c0815940a1f02a212d45b9d258a2dbcc378 100644 --- a/pybind11/tools/FindPythonLibsNew.cmake +++ b/pybind11/tools/FindPythonLibsNew.cmake @@ -177,6 +177,7 @@ SET(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}") dune_register_package_flags( INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS} LIBRARIES ${PYTHON_LIBRARIES} + COMPILE_OPTIONS -fvisibility-inlines-hidden -fvisibility=hidden ) find_package_message(PYTHON