From ed5a55ed821d5719df374d9efda420c5c4f11ef8 Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller Date: Tue, 23 Dec 2025 19:30:53 +0100 Subject: [PATCH 1/2] Forward-declare PyObject not to have to include Python.h --- include/podio/detail/Pythonizations.h | 5 +++-- src/CMakeLists.txt | 2 +- src/Pythonizations.cc | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/podio/detail/Pythonizations.h b/include/podio/detail/Pythonizations.h index b8661eace..92d74f469 100644 --- a/include/podio/detail/Pythonizations.h +++ b/include/podio/detail/Pythonizations.h @@ -2,9 +2,10 @@ #define PODIO_DETAIL_PYTHONIZATIONS_H #define PY_SSIZE_T_CLEAN -#include #include +typedef struct _object PyObject; + namespace podio::detail::pythonizations { // Callback function for the subscript pythonization @@ -16,4 +17,4 @@ void pythonize_subscript(PyObject* klass, const std::string& name); } // namespace podio::detail::pythonizations -#endif // PODIO_DETAIL_PYTHONIZATIONS_H \ No newline at end of file +#endif // PODIO_DETAIL_PYTHONIZATIONS_H diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2d2d312c7..2b35373df 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,7 +27,7 @@ FUNCTION(PODIO_ADD_LIB_AND_DICT libname headers sources selection ) $ $ ) - target_include_directories(${libname} SYSTEM PUBLIC + target_include_directories(${libname} SYSTEM PRIVATE ${Python3_INCLUDE_DIRS} ) diff --git a/src/Pythonizations.cc b/src/Pythonizations.cc index 5602dc016..26a361514 100644 --- a/src/Pythonizations.cc +++ b/src/Pythonizations.cc @@ -3,6 +3,8 @@ #include #include +#include + namespace podio::detail::pythonizations { // Callback function for the subscript pythonization @@ -52,4 +54,4 @@ void pythonize_subscript(PyObject* klass, const std::string& name) { Py_DECREF(method); } -} // namespace podio::detail::pythonizations \ No newline at end of file +} // namespace podio::detail::pythonizations From fc9ccf0858e2f8afade1815020b204b1a57db46e Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller Date: Wed, 24 Dec 2025 16:42:37 +0100 Subject: [PATCH 2/2] Remove unnecessary target_include_directories for python --- src/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2b35373df..e5fecaa38 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,9 +27,6 @@ FUNCTION(PODIO_ADD_LIB_AND_DICT libname headers sources selection ) $ $ ) - target_include_directories(${libname} SYSTEM PRIVATE - ${Python3_INCLUDE_DIRS} - ) # dictionary set(dictname ${libname}Dict)