aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/PySide2
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-11-08 14:37:35 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-11-11 10:33:09 +0000
commitf78cc32299aa34069c64ae8f48163ac4eda560d5 (patch)
tree7cd611c471a7eaebe20536544cb68b6df533f8b5 /sources/pyside2/PySide2
parent5db35b37ac2401697a6238f21979fa1e84f0ff77 (diff)
Clean up pyside2_global.h
Make it possible to prepend or append something to the global module header by providing a .pre/.post.h file. This removes the need to have global includes and defines in pyside2_global.h and reduces module dependencies. Change-Id: I517c5765212813732b5694dcfcc86d2492e71a57 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/pyside2/PySide2')
-rw-r--r--sources/pyside2/PySide2/CMakeLists.txt14
-rw-r--r--sources/pyside2/PySide2/QtGui/CMakeLists.txt3
-rw-r--r--sources/pyside2/PySide2/QtGui/QtGui_global.post.h.in1
-rw-r--r--sources/pyside2/PySide2/QtSql/CMakeLists.txt3
-rw-r--r--sources/pyside2/PySide2/QtSql/QtSql_global.pre.h.in5
-rw-r--r--sources/pyside2/PySide2/QtTest/CMakeLists.txt6
-rw-r--r--sources/pyside2/PySide2/QtTest/QtTest_global.post.h.in1
-rw-r--r--sources/pyside2/PySide2/QtTest/QtTest_global.pre.h.in5
-rw-r--r--sources/pyside2/PySide2/QtX11Extras/CMakeLists.txt3
-rw-r--r--sources/pyside2/PySide2/QtX11Extras/QtX11Extras_global.post.h.in1
-rw-r--r--sources/pyside2/PySide2/global.h.in16
11 files changed, 41 insertions, 17 deletions
diff --git a/sources/pyside2/PySide2/CMakeLists.txt b/sources/pyside2/PySide2/CMakeLists.txt
index 0b8210359..3406bd458 100644
--- a/sources/pyside2/PySide2/CMakeLists.txt
+++ b/sources/pyside2/PySide2/CMakeLists.txt
@@ -43,7 +43,19 @@ foreach(shortname IN LISTS all_module_shortnames)
# #include <pyside2_global.h> for the the type entries originating from it
# (cf AbstractMetaBuilderPrivate::setInclude()).
set(module_header "${CMAKE_CURRENT_BINARY_DIR}/Qt${shortname}_global.h")
- file(WRITE ${module_header} "${pyside2_global_contents}\n#include <Qt${shortname}/Qt${shortname}>\n")
+ set(module_header_content "")
+ set(pre_header "${CMAKE_CURRENT_BINARY_DIR}/Qt${shortname}/Qt${shortname}_global.pre.h")
+ if(EXISTS "${pre_header}")
+ file(READ "${pre_header}" pre_header_content)
+ set(module_header_content "${pre_header_content}")
+ endif()
+ set(module_header_content "${module_header_content}\n${pyside2_global_contents}\n#include <Qt${shortname}/Qt${shortname}>\n")
+ set(post_header "${CMAKE_CURRENT_BINARY_DIR}/Qt${shortname}/Qt${shortname}_global.post.h")
+ if(EXISTS "${post_header}")
+ file(READ "${post_header}" post_header_content)
+ set(module_header_content "${module_header_content}\n${post_header_content}")
+ endif()
+ file(WRITE ${module_header} "${module_header_content}")
endforeach()
# install
diff --git a/sources/pyside2/PySide2/QtGui/CMakeLists.txt b/sources/pyside2/PySide2/QtGui/CMakeLists.txt
index b21120115..784280ca6 100644
--- a/sources/pyside2/PySide2/QtGui/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtGui/CMakeLists.txt
@@ -192,6 +192,9 @@ ${QtGui_GEN_DIR}/qtgui_module_wrapper.cpp
configure_file("${QtGui_SOURCE_DIR}/typesystem_gui.xml.in"
"${QtGui_BINARY_DIR}/typesystem_gui.xml" @ONLY)
+configure_file("${QtGui_SOURCE_DIR}/QtGui_global.post.h.in"
+ "${QtGui_BINARY_DIR}/QtGui_global.post.h" @ONLY)
+
set(QtGui_include_dirs ${QtGui_SOURCE_DIR}
${QtGui_BINARY_DIR}
${pyside2_SOURCE_DIR}
diff --git a/sources/pyside2/PySide2/QtGui/QtGui_global.post.h.in b/sources/pyside2/PySide2/QtGui/QtGui_global.post.h.in
new file mode 100644
index 000000000..6d3a3eeac
--- /dev/null
+++ b/sources/pyside2/PySide2/QtGui/QtGui_global.post.h.in
@@ -0,0 +1 @@
+#include "qpytextobject.h" // PySide class
diff --git a/sources/pyside2/PySide2/QtSql/CMakeLists.txt b/sources/pyside2/PySide2/QtSql/CMakeLists.txt
index dd78c2388..0573ab5cd 100644
--- a/sources/pyside2/PySide2/QtSql/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtSql/CMakeLists.txt
@@ -20,6 +20,9 @@ ${QtSql_GEN_DIR}/qsqltablemodel_wrapper.cpp
${QtSql_GEN_DIR}/qtsql_module_wrapper.cpp
)
+configure_file("${QtSql_SOURCE_DIR}/QtSql_global.pre.h.in"
+ "${QtSql_BINARY_DIR}/QtSql_global.pre.h" @ONLY)
+
set(QtSql_include_dirs ${QtSql_SOURCE_DIR}
${QtSql_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
diff --git a/sources/pyside2/PySide2/QtSql/QtSql_global.pre.h.in b/sources/pyside2/PySide2/QtSql/QtSql_global.pre.h.in
new file mode 100644
index 000000000..0c20c1888
--- /dev/null
+++ b/sources/pyside2/PySide2/QtSql/QtSql_global.pre.h.in
@@ -0,0 +1,5 @@
+// QT_WIDGETS_LIB must be defined for QSqlRelationalDelegate to become visible.
+
+#if @Qt5Widgets_FOUND@
+# define QT_WIDGETS_LIB
+#endif
diff --git a/sources/pyside2/PySide2/QtTest/CMakeLists.txt b/sources/pyside2/PySide2/QtTest/CMakeLists.txt
index 5893de7ba..6d2630f10 100644
--- a/sources/pyside2/PySide2/QtTest/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtTest/CMakeLists.txt
@@ -7,6 +7,12 @@ ${QtTest_GEN_DIR}/qtest_wrapper.cpp
${QtTest_GEN_DIR}/qttest_module_wrapper.cpp
)
+configure_file("${QtTest_SOURCE_DIR}/QtTest_global.pre.h.in"
+ "${QtTest_BINARY_DIR}/QtTest_global.pre.h" @ONLY)
+
+configure_file("${QtTest_SOURCE_DIR}/QtTest_global.post.h.in"
+ "${QtTest_BINARY_DIR}/QtTest_global.post.h" @ONLY)
+
set(QtTest_include_dirs ${QtTest_SOURCE_DIR}
${QtTest_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
diff --git a/sources/pyside2/PySide2/QtTest/QtTest_global.post.h.in b/sources/pyside2/PySide2/QtTest/QtTest_global.post.h.in
new file mode 100644
index 000000000..ccd18153c
--- /dev/null
+++ b/sources/pyside2/PySide2/QtTest/QtTest_global.post.h.in
@@ -0,0 +1 @@
+#include "pysideqtesttouch.h"
diff --git a/sources/pyside2/PySide2/QtTest/QtTest_global.pre.h.in b/sources/pyside2/PySide2/QtTest/QtTest_global.pre.h.in
new file mode 100644
index 000000000..65daf1b84
--- /dev/null
+++ b/sources/pyside2/PySide2/QtTest/QtTest_global.pre.h.in
@@ -0,0 +1,5 @@
+// QT_WIDGETS_LIB changes code generation in pysideqtesttouch.h
+
+#if @Qt5Widgets_FOUND@
+# define QT_WIDGETS_LIB
+#endif
diff --git a/sources/pyside2/PySide2/QtX11Extras/CMakeLists.txt b/sources/pyside2/PySide2/QtX11Extras/CMakeLists.txt
index f15f77375..4f0111905 100644
--- a/sources/pyside2/PySide2/QtX11Extras/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtX11Extras/CMakeLists.txt
@@ -6,6 +6,9 @@ ${QtX11Extras_GEN_DIR}/qx11info_wrapper.cpp
${QtX11Extras_GEN_DIR}/qtx11extras_module_wrapper.cpp
)
+configure_file("${QtX11Extras_SOURCE_DIR}/QtX11Extras_global.post.h.in"
+ "${QtX11Extras_BINARY_DIR}/QtX11Extras_global.post.h" @ONLY)
+
set(QtX11Extras_include_dirs ${QtX11Extras_SOURCE_DIR}
${QtX11Extras_BINARY_DIR}
${Qt5X11Extras_INCLUDE_DIRS}
diff --git a/sources/pyside2/PySide2/QtX11Extras/QtX11Extras_global.post.h.in b/sources/pyside2/PySide2/QtX11Extras/QtX11Extras_global.post.h.in
new file mode 100644
index 000000000..abdaf3d5f
--- /dev/null
+++ b/sources/pyside2/PySide2/QtX11Extras/QtX11Extras_global.post.h.in
@@ -0,0 +1 @@
+#include <QtX11Extras/QX11Info>
diff --git a/sources/pyside2/PySide2/global.h.in b/sources/pyside2/PySide2/global.h.in
index 1d04efe9c..60afc1744 100644
--- a/sources/pyside2/PySide2/global.h.in
+++ b/sources/pyside2/PySide2/global.h.in
@@ -54,20 +54,4 @@
// Make "signals:", "slots:" visible as access specifiers
#define QT_ANNOTATE_ACCESS_SPECIFIER(a) __attribute__((annotate(#a)))
-#include "qpytextobject.h" // PySide class
-
-#if @ENABLE_X11@
-# if @Qt5X11Extras_FOUND@
-# include <QtX11Extras/QX11Info>
-# endif
-#endif
-
-// QT_WIDGETS_LIB must be defined to QSqlRelationalDelegate become visible.
-// It also changes code generation in pysideqtesttouch.h
-#define QT_WIDGETS_LIB
-
-#if @Qt5Test_FOUND@
-# include "pysideqtesttouch.h"
-#endif
-
// Here are now all configured modules appended: