diff options
Diffstat (limited to 'cmake/Modules')
-rw-r--r-- | cmake/Modules/GrPybind.cmake | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cmake/Modules/GrPybind.cmake b/cmake/Modules/GrPybind.cmake index 7da4e36a56..a000f8e5e4 100644 --- a/cmake/Modules/GrPybind.cmake +++ b/cmake/Modules/GrPybind.cmake @@ -154,6 +154,22 @@ target_include_directories(${name}_python PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/${updir}/lib ${CMAKE_CURRENT_SOURCE_DIR}/${updir}/include ) + +# Precompile the pybind11 header +# This should speed up building of the python bindings at least in larger modules +# This functionality is only available in CMake >= 3.16 +if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0") + target_precompile_headers( + ${name}_python + PRIVATE + ${pybind11_INCLUDE_DIR}/pybind11/pybind11.h + ${pybind11_INCLUDE_DIR}/pybind11/embed.h + ${pybind11_INCLUDE_DIR}/pybind11/complex.h + ${pybind11_INCLUDE_DIR}/pybind11/operators.h + ${pybind11_INCLUDE_DIR}/pybind11/stl.h +) +endif() + target_link_libraries(${name}_python PRIVATE ${Boost_LIBRARIES} pybind11::pybind11 Python::Module Python::NumPy gnuradio-${MODULE_NAME}) if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU") |