diff options
-rw-r--r-- | CMakeLists.txt | 26 | ||||
-rw-r--r-- | PySide2/QtCore/typesystem_core_common.xml | 4 | ||||
-rw-r--r-- | PySide2/QtMacExtras/CMakeLists.txt | 2 | ||||
-rw-r--r-- | PySide2/QtMacExtras/typesystem_macextras.xml | 4 | ||||
-rw-r--r-- | PySide2/global.h.in | 10 | ||||
-rw-r--r-- | cmake/Macros/PySideModules.cmake | 7 | ||||
-rw-r--r-- | tests/pysidetest/CMakeLists.txt | 25 |
7 files changed, 52 insertions, 26 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 89d4dc7c..7c5ec97c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,12 +133,22 @@ if(CMAKE_HOST_APPLE) endif() endif() -if(NOT CMAKE_HOST_APPLE) - # Qt5: QT_INCLUDE_DIR does no longer exist. - # On Windows and Linux, it can be computed from Qt5Core_INCLUDE_DIRS - message("Qt5Core_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS}") - list(GET Qt5Core_INCLUDE_DIRS 0 QT_INCLUDE_DIR) - message(STATUS "*** computed QT_INCLUDE_DIR as ${QT_INCLUDE_DIR}") +# Qt5: QT_INCLUDE_DIR does no longer exist. +# On Windows, macOS, and Linux it can be computed from Qt5Core_INCLUDE_DIRS, which contains +# a list of include directories. We take the first one. +message(STATUS "*** Qt5Core_INCLUDE_DIRS = ${Qt5Core_INCLUDE_DIRS}") +list(GET Qt5Core_INCLUDE_DIRS 0 QT_INCLUDE_DIR) + +# On macOS, check if Qt is a framework build. This affects how include paths should be handled. +get_target_property(QtCore_is_framework Qt5::Core FRAMEWORK) + +if (QtCore_is_framework) + get_filename_component(QT_FRAMEWORK_INCLUDE_DIR "${QT_INCLUDE_DIR}/../" ABSOLUTE) + message(STATUS "*** QT_FRAMEWORK_INCLUDE_DIR is ${QT_FRAMEWORK_INCLUDE_DIR}") + + # QT_INCLUDE_DIR points to the QtCore.framework directory, so need to adjust this to point + # to the actual include directory. + get_filename_component(QT_INCLUDE_DIR "${QT_INCLUDE_DIR}/../../include" ABSOLUTE) endif() if(MSVC) @@ -162,12 +172,14 @@ else() if (NOT QT_INCLUDE_DIR) set(QT_INCLUDE_DIR "/Library/Frameworks") endif() - if(ALTERNATIVE_QT_INCLUDE_DIR) + if(NOT QT_INCLUDE_DIR AND ALTERNATIVE_QT_INCLUDE_DIR) set(QT_INCLUDE_DIR ${ALTERNATIVE_QT_INCLUDE_DIR}) endif() string(REPLACE " " ":" QT_INCLUDE_DIR ${QT_INCLUDE_DIR}) endif() endif() +message(STATUS "*** computed QT_INCLUDE_DIR as ${QT_INCLUDE_DIR}") + if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE ${SHIBOKEN_BUILD_TYPE}) diff --git a/PySide2/QtCore/typesystem_core_common.xml b/PySide2/QtCore/typesystem_core_common.xml index 53cc5faa..13f24838 100644 --- a/PySide2/QtCore/typesystem_core_common.xml +++ b/PySide2/QtCore/typesystem_core_common.xml @@ -937,7 +937,7 @@ <enum-type name="ToolBarArea" flags="ToolBarAreas" /> <enum-type name="ToolBarAreaSizes"/> <enum-type name="ToolButtonStyle"/> - <enum-type name="TouchPointState" since="4.6"/> + <enum-type name="TouchPointState" flags="TouchPointStates" since="4.6"/> <enum-type name="TransformationMode"/> <enum-type name="UIEffect"/> <enum-type name="WhiteSpaceMode" /> @@ -4205,7 +4205,7 @@ s1.addTransition(button.clicked, s1h)</code> <!-- TODO: this need be removed --> <suppress-warning text="skipping function '*', unmatched return type '*'"/> - <suppress-warning text="skipping function '*', unmatched parameter type '*'"/> + <suppress-warning text="skipping function '*', unmatched type '*"/> <suppress-warning text="enum 'q_static_assert_result39' does not have a type entry or is not an enum"/> <suppress-warning text="horribly broken type ''"/> diff --git a/PySide2/QtMacExtras/CMakeLists.txt b/PySide2/QtMacExtras/CMakeLists.txt index 9bb8dd00..a98f18e6 100644 --- a/PySide2/QtMacExtras/CMakeLists.txt +++ b/PySide2/QtMacExtras/CMakeLists.txt @@ -1,7 +1,7 @@ project(QtMacExtras) set(QtMacExtras_SRC -#${QtMacExtras_GEN_DIR}/qmacpasteboardmime_wrapper.cpp +${QtMacExtras_GEN_DIR}/qmacpasteboardmime_wrapper.cpp ${QtMacExtras_GEN_DIR}/qmactoolbar_wrapper.cpp ${QtMacExtras_GEN_DIR}/qmactoolbaritem_wrapper.cpp diff --git a/PySide2/QtMacExtras/typesystem_macextras.xml b/PySide2/QtMacExtras/typesystem_macextras.xml index f52597cd..55c7d016 100644 --- a/PySide2/QtMacExtras/typesystem_macextras.xml +++ b/PySide2/QtMacExtras/typesystem_macextras.xml @@ -43,11 +43,11 @@ <load-typesystem name="typesystem_core.xml" generate="no"/> <load-typesystem name="typesystem_gui.xml" generate="no"/> - <!-- + <function signature="qRegisterDraggedTypes(QStringList)" since="5.2"/> + <object-type name="QMacPasteboardMime" since="5.2"> <enum-type name="QMacPasteboardMimeType"/> </object-type> - --> <object-type name="QMacToolBar" since="5.3"/> <object-type name="QMacToolBarItem" since="5.3"> <enum-type name="StandardItem"/> diff --git a/PySide2/global.h.in b/PySide2/global.h.in index 40b107ee..0c7e2114 100644 --- a/PySide2/global.h.in +++ b/PySide2/global.h.in @@ -54,22 +54,12 @@ // Make "signals:", "slots:" visible as access specifiers #define QT_ANNOTATE_ACCESS_SPECIFIER(a) __attribute__((annotate(#a))) -#include <QtCore/QtCore> -#if @Qt5Gui_FOUND@ -# include <QtGui/QtGui> -#endif -#if @Qt5Widgets_FOUND@ -# include <QtWidgets/QtWidgets> -#endif - #include "qpytextobject.h" // PySide class #if @ENABLE_X11@ # if @Qt5X11Extras_FOUND@ # include <QtX11Extras/QX11Info> # endif -#elif @ENABLE_MAC@ -# include <QtGui/qmacstyle_mac.h> #endif // QT_WIDGETS_LIB must be defined to QSqlRelationalDelegate become visible. diff --git a/cmake/Macros/PySideModules.cmake b/cmake/Macros/PySideModules.cmake index f4bfd885..e2a1bdcd 100644 --- a/cmake/Macros/PySideModules.cmake +++ b/cmake/Macros/PySideModules.cmake @@ -69,9 +69,13 @@ macro(create_pyside_module # Contains include directories to pass to shiboken's preprocessor. set(shiboken_include_dirs ${pyside2_SOURCE_DIR}${PATH_SEP}${QT_INCLUDE_DIR}) + set(shiboken_framework_include_dirs_option "") if(CMAKE_HOST_APPLE) + set(shiboken_framework_include_dirs "${QT_FRAMEWORK_INCLUDE_DIR}") # On macOS, provide the framework paths for OpenGL headers. - set(shiboken_include_dirs ${shiboken_include_dirs} ${CMAKE_SYSTEM_FRAMEWORK_PATH}) + set(shiboken_framework_include_dirs ${shiboken_framework_include_dirs} ${CMAKE_SYSTEM_FRAMEWORK_PATH}) + make_path(shiboken_framework_include_dirs ${shiboken_framework_include_dirs}) + set(shiboken_framework_include_dirs_option "--framework-include-paths=${shiboken_framework_include_dirs}") endif() # Transform the path separators into something shiboken understands. @@ -81,6 +85,7 @@ macro(create_pyside_module COMMAND "${SHIBOKEN_BINARY}" ${GENERATOR_EXTRA_FLAGS} ${pyside2_BINARY_DIR}/pyside2_global.h --include-paths=${shiboken_include_dirs} + ${shiboken_framework_include_dirs_option} --typesystem-paths=${pyside2_SOURCE_DIR}${PATH_SEP}${${module_typesystem_path}} --output-directory=${CMAKE_CURRENT_BINARY_DIR} --license-file=${CMAKE_CURRENT_SOURCE_DIR}/../licensecomment.txt diff --git a/tests/pysidetest/CMakeLists.txt b/tests/pysidetest/CMakeLists.txt index 3a5437e6..05b0b86b 100644 --- a/tests/pysidetest/CMakeLists.txt +++ b/tests/pysidetest/CMakeLists.txt @@ -35,14 +35,32 @@ ${CMAKE_CURRENT_BINARY_DIR}/testbinding/testview_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/testbinding/testbinding_module_wrapper.cpp ) +# Get per module include dirs. +# There are usually 3 paths there: +# ./qt/include/; ./qt/include/QtCore ; ./qt/mkspecs/linux-g++ +# on framework build they are: +# ./qt/lib/QtCore.framework; ./qt/lib/QtCore.framework/Headers ; ./qt/mkspecs/macx-clang +# Thus we use the second direct path, which contains the actual header files. + +list(GET Qt5Core_INCLUDE_DIRS 1 Qt5Core_DIRECT_INCLUDE_DIR) +list(GET Qt5Gui_INCLUDE_DIRS 1 Qt5Gui_DIRECT_INCLUDE_DIR) +list(GET Qt5Widgets_INCLUDE_DIRS 1 Qt5Widgets_DIRECT_INCLUDE_DIR) + +# Adjust include headers paths for frameworks. +set(shiboken_framework_include_dirs_option "") +if(CMAKE_HOST_APPLE AND QtCore_is_framework) + set(shiboken_framework_include_dirs "${QT_FRAMEWORK_INCLUDE_DIR}") + set(shiboken_framework_include_dirs_option "--framework-include-paths=${shiboken_framework_include_dirs}") +endif() + make_path(testbinding_include_dirs ${pyside2_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../../PySide2 ${CMAKE_CURRENT_SOURCE_DIR}/../../libpyside ${QT_INCLUDE_DIR} - ${QT_INCLUDE_DIR}/QtCore - ${QT_INCLUDE_DIR}/QtGui - ${QT_INCLUDE_DIR}/QtWidgets + ${Qt5Core_DIRECT_INCLUDE_DIR} + ${Qt5Gui_DIRECT_INCLUDE_DIR} + ${Qt5Widgets_DIRECT_INCLUDE_DIR} ) make_path(testbinding_typesystem_path ${CMAKE_CURRENT_SOURCE_DIR} @@ -55,6 +73,7 @@ add_custom_command(OUTPUT ${testbinding_SRC} COMMAND ${SHIBOKEN_BINARY} ${GENERATOR_EXTRA_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/pysidetest_global.h --include-paths=${testbinding_include_dirs} + ${shiboken_framework_include_dirs_option} --typesystem-paths=${testbinding_typesystem_path} --output-directory=${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_pysidetest.xml |