diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-08-28 12:51:09 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-10-01 09:11:39 +0000 |
commit | ebaceac469f19c51da390c7028d28e17ef991df4 (patch) | |
tree | 07e2ea02a5e45bae23201d890a8086279207cf41 | |
parent | 2f548c62d50b49e193c9f7575fa6a4601b697609 (diff) |
PySide2: Replace macro check_qt_class by the Qt configure system
Query the feature properties of the configure system to check whether
a class is present instead of running a compile test in QtGui and
QtNetwork.
Remove the macro invocation from QtWigets since the results
(QtWidgets_OPTIONAL_SRC, QtWidgets_DROPPED_ENTRIES) were not used.
Change-Id: I06e03fe1eef85f2340ab4cdb130b8b31b08f7f14
Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r-- | sources/pyside2/PySide2/QtGui/CMakeLists.txt | 18 | ||||
-rw-r--r-- | sources/pyside2/PySide2/QtNetwork/CMakeLists.txt | 66 | ||||
-rw-r--r-- | sources/pyside2/PySide2/QtWidgets/CMakeLists.txt | 7 | ||||
-rw-r--r-- | sources/pyside2/cmake/Macros/PySideModules.cmake | 71 |
4 files changed, 62 insertions, 100 deletions
diff --git a/sources/pyside2/PySide2/QtGui/CMakeLists.txt b/sources/pyside2/PySide2/QtGui/CMakeLists.txt index 1fe743c01..b330a63bf 100644 --- a/sources/pyside2/PySide2/QtGui/CMakeLists.txt +++ b/sources/pyside2/PySide2/QtGui/CMakeLists.txt @@ -2,11 +2,9 @@ project(QtGui) qt5_wrap_cpp(QPYTEXTOBJECT_MOC "${pyside2_SOURCE_DIR}/qpytextobject.h") -set(QtGui_OPTIONAL_SRC) set(QtGui_DROPPED_ENTRIES) -check_qt_class(QtGui QOpenGLTimeMonitor QtGui_OPTIONAL_SRC QtGui_DROPPED_ENTRIES) -check_qt_class(QtGui QOpenGLTimerQuery QtGui_OPTIONAL_SRC QtGui_DROPPED_ENTRIES) +get_property(QtGui_enabled_features TARGET Qt5::Gui PROPERTY INTERFACE_QT_ENABLED_FEATURES) set(QtGui_SRC ${QtGui_GEN_DIR}/qabstractopenglfunctions_wrapper.cpp @@ -207,11 +205,23 @@ ${QtGui_GEN_DIR}/qwhatsthisclickedevent_wrapper.cpp ${QtGui_GEN_DIR}/qwheelevent_wrapper.cpp ${QtGui_GEN_DIR}/qwindow_wrapper.cpp ${QtGui_GEN_DIR}/qwindowstatechangeevent_wrapper.cpp -${QtGui_OPTIONAL_SRC} # module is always needed ${QtGui_GEN_DIR}/qtgui_module_wrapper.cpp ) +# cf qtbase/src/gui/opengl/opengl.pri +list(FIND QtGui_enabled_features "opengles2" _opengles2Index) +# ### fixme: For cmake >= 3.3: if(opengles2 IN_LIST QtGui_enabled_features) +if(_opengles2Index GREATER -1) + list(APPEND QtGui_DROPPED_ENTRIES QOpenGLTimeMonitor QOpenGLTimerQuery) + message(STATUS "Qt5Gui: Dropping Desktop OpenGL classes (GLES2)") +else() + list(APPEND QtGui_SRC + ${QtGui_GEN_DIR}/qopengltimemonitor_wrapper.cpp + ${QtGui_GEN_DIR}/qopengltimerquery_wrapper.cpp) + message(STATUS "Qt5Gui: Adding Desktop OpenGL classes") +endif() + configure_file("${QtGui_SOURCE_DIR}/typesystem_gui.xml.in" "${QtGui_BINARY_DIR}/typesystem_gui.xml" @ONLY) diff --git a/sources/pyside2/PySide2/QtNetwork/CMakeLists.txt b/sources/pyside2/PySide2/QtNetwork/CMakeLists.txt index 0ea57693b..a7c8dd8f6 100644 --- a/sources/pyside2/PySide2/QtNetwork/CMakeLists.txt +++ b/sources/pyside2/PySide2/QtNetwork/CMakeLists.txt @@ -1,24 +1,7 @@ project(QtNetwork) -set(QtNetwork_OPTIONAL_SRC ) set(QtNetwork_DROPPED_ENTRIES ) -check_qt_class(QtNetwork QDtls QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) -check_qt_class(QtNetwork QSslCertificate QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) -check_qt_class(QtNetwork QSslCertificateExtension QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) -check_qt_class(QtNetwork QSslCipher QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) -check_qt_class(QtNetwork QSslConfiguration QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) -check_qt_class(QtNetwork QSslDiffieHellmanParameters QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) -# Problems with operator==(QSslEllipticCurve,QSslEllipticCurve) -# check_qt_class(QtNetwork QSslEllipticCurve QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) -check_qt_class(QtNetwork QSslError QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) -check_qt_class(QtNetwork QSslKey QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) -check_qt_class(QtNetwork QSslPreSharedKeyAuthenticator QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) -check_qt_class(QtNetwork QSslSocket QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) - -check_qt_class(QtNetwork QSctpServer QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) -check_qt_class(QtNetwork QSctpSocket QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) - set(QtNetwork_SRC ${QtNetwork_GEN_DIR}/qabstractnetworkcache_wrapper.cpp ${QtNetwork_GEN_DIR}/qabstractsocket_wrapper.cpp @@ -58,11 +41,58 @@ ${QtNetwork_GEN_DIR}/qssl_wrapper.cpp ${QtNetwork_GEN_DIR}/qtcpserver_wrapper.cpp ${QtNetwork_GEN_DIR}/qtcpsocket_wrapper.cpp ${QtNetwork_GEN_DIR}/qudpsocket_wrapper.cpp -${QtNetwork_OPTIONAL_SRC} # module is always needed ${QtNetwork_GEN_DIR}/qtnetwork_module_wrapper.cpp ) +get_property(QtNetwork_enabled_features TARGET Qt5::Network PROPERTY INTERFACE_QT_ENABLED_FEATURES) +get_property(QtNetwork_disabled_features TARGET Qt5::Network PROPERTY INTERFACE_QT_DISABLED_FEATURES) + +# ### fixme: For cmake >= 3.3, use if( needle IN_LIST list) +list(FIND QtNetwork_enabled_features "ssl" _sslEnabledIndex) +list(FIND QtNetwork_disabled_features "dtls" _dtlsDisabledIndex) +list(FIND QtNetwork_disabled_features "sctp" _sctpDisabledIndex) + +if(_sslEnabledIndex EQUAL -1) + list(APPEND QtNetwork_DROPPED_ENTRIES QSslCertificate QSslCertificateExtension + QSslCipher QSslConfiguration QSslDiffieHellmanParameters QSslError + QSslKey QSslPreSharedKeyAuthenticator QSslSocket) + message(STATUS "Qt5Network: Dropping SSL classes") +else() + # Problems with operator==(QSslEllipticCurve,QSslEllipticCurve) + # check_qt_class(QtNetwork QSslEllipticCurve QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) + list(APPEND QtNetwork_SRC + ${QtNetwork_GEN_DIR}/qsslcertificate_wrapper.cpp + ${QtNetwork_GEN_DIR}/qsslcertificateextension_wrapper.cpp + ${QtNetwork_GEN_DIR}/qsslcipher_wrapper.cpp + ${QtNetwork_GEN_DIR}/qsslconfiguration_wrapper.cpp + ${QtNetwork_GEN_DIR}/qssldiffiehellmanparameters_wrapper.cpp + ${QtNetwork_GEN_DIR}/qsslerror_wrapper.cpp + ${QtNetwork_GEN_DIR}/qsslkey_wrapper.cpp + ${QtNetwork_GEN_DIR}/qsslpresharedkeyauthenticator_wrapper.cpp + ${QtNetwork_GEN_DIR}/qsslsocket_wrapper.cpp) + message(STATUS "Qt5Network: Adding SSL classes") +endif() + +if(_dtlsDisabledIndex GREATER -1) + list(APPEND QtNetwork_DROPPED_ENTRIES QDtls) + message(STATUS "Qt5Network: Dropping DTLS classes") +else() + list(APPEND QtNetwork_SRC + ${QtNetwork_GEN_DIR}/qdtls_wrapper.cpp) + message(STATUS "Qt5Network: Adding DTLS classes") +endif() + +if(_sctpDisabledIndex GREATER -1) + list(APPEND QtNetwork_DROPPED_ENTRIES QSctpServer QSctpSocket) + message(STATUS "Qt5Network: Dropping SCTP classes") +else() + list(APPEND QtNetwork_SRC + ${QtNetwork_GEN_DIR}/qsctpserver_wrapper.cpp + ${QtNetwork_GEN_DIR}/qsctpsocket_wrapper.cpp) + message(STATUS "Qt5Network: Adding SCTP classes") +endif() + set(QtNetwork_include_dirs ${QtNetwork_SOURCE_DIR} ${QtNetwork_BINARY_DIR} ${Qt5Core_INCLUDE_DIRS} diff --git a/sources/pyside2/PySide2/QtWidgets/CMakeLists.txt b/sources/pyside2/PySide2/QtWidgets/CMakeLists.txt index dee79744f..6b8830a41 100644 --- a/sources/pyside2/PySide2/QtWidgets/CMakeLists.txt +++ b/sources/pyside2/PySide2/QtWidgets/CMakeLists.txt @@ -1,12 +1,5 @@ project(QtWidgets) - -set(QtWidgets_OPTIONAL_SRC ) -set(QtWidgets_DROPPED_ENTRIES ) -## XXX check if these conditionals need to be done elsewhere -check_qt_class(QtWidgets QGtkStyle QtWidgets_OPTIONAL_SRC QtWidgets_DROPPED_ENTRIES) -check_qt_class(QtWidgets QMacStyle QtWidgets_OPTIONAL_SRC QtWidgets_DROPPED_ENTRIES) - set(QtWidgets_SRC ${QtWidgets_GEN_DIR}/qaccessiblewidget_wrapper.cpp ${QtWidgets_GEN_DIR}/qabstractbutton_wrapper.cpp diff --git a/sources/pyside2/cmake/Macros/PySideModules.cmake b/sources/pyside2/cmake/Macros/PySideModules.cmake index 36488912d..816190612 100644 --- a/sources/pyside2/cmake/Macros/PySideModules.cmake +++ b/sources/pyside2/cmake/Macros/PySideModules.cmake @@ -134,77 +134,6 @@ macro(create_pyside_module endforeach() endmacro() -#macro(check_qt_class_with_namespace module namespace class optional_source_files dropped_entries [namespace] [module]) -macro(check_qt_class module class optional_source_files dropped_entries) - if (${ARGC} GREATER 4) - set (namespace ${ARGV4}) - string(TOLOWER ${namespace} _namespace) - else () - set (namespace "") - endif () - if (${ARGC} GREATER 5) - set (include_file ${ARGV5}) - else () - set (include_file ${class}) - endif () - string(TOLOWER ${class} _class) - # Remove the "Qt" prefix. - string(SUBSTRING ${module} 2 -1 _module_no_qt_prefix) - if (_namespace) - set(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/PySide2/${module}/${_namespace}_${_class}_wrapper.cpp) - else () - set(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/PySide2/${module}/${_class}_wrapper.cpp) - endif () - if (DEFINED PYSIDE_${class}) - if (PYSIDE_${class}) - list(APPEND ${optional_source_files} ${_cppfile}) - else() - list(APPEND ${dropped_entries} PySide2.${module}.${class}) - endif() - else() - if (NOT ${namespace} STREQUAL "" ) - set (NAMESPACE_USE "using namespace ${namespace};") - else () - set (NAMESPACE_USE "") - endif () - set(SRC_FILE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test${class}.cxx) - file(WRITE ${SRC_FILE} - "#include <${include_file}>\n" - "${NAMESPACE_USE}\n" - "int main() { sizeof(${class}); }\n" - ) - - # Because Qt is built with -fPIC (by default), the compile tests also have to have that. - get_property(ADDITIONAL_FLAGS TARGET Qt5::Core PROPERTY INTERFACE_COMPILE_OPTIONS) - - # Don't add version tagging, because for some reason linker fails with: - # (.qtversion[qt_version_tag]+0x0): undefined reference to `qt_version_tag' - # Force usage of the C++11 standard. CMAKE_CXX_STANDARD does not work with try_compile - # but the issue has a fix in CMake 3.9. Thus we use a terrible workaround, we pass the C++ - # standard flag the way CheckCXXSourceCompiles.cmake does it. - - set(ADDITIONAL_FLAGS "${ADDITIONAL_FLAGS} -DQT_NO_VERSION_TAGGING ${CMAKE_CXX11_EXTENSION_COMPILE_OPTION}") - - try_compile(Q_WORKS ${CMAKE_BINARY_DIR} - ${SRC_FILE} - CMAKE_FLAGS - "-DINCLUDE_DIRECTORIES=${QT_INCLUDE_DIR};${Qt5${_module_no_qt_prefix}_INCLUDE_DIRS}" - "-DCOMPILE_DEFINITIONS:STRING=${ADDITIONAL_FLAGS}" - OUTPUT_VARIABLE OUTPUT) - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCheckQtClassTest.log ${OUTPUT}) - - set("PYSIDE_${class}" ${Q_WORKS} CACHE STRING "Has ${class} class been found?") - if(Q_WORKS) - message(STATUS "Checking for ${class} in ${module} -- found") - list(APPEND ${optional_source_files} ${_cppfile}) - else() - message(STATUS "Checking for ${class} in ${module} -- not found") - list(APPEND ${dropped_entries} PySide2.${module}.${class}) - endif() - endif() -endmacro() - - # Only add subdirectory if the associated Qt module is found. # As a side effect, this macro now also defines the variable ${name}_GEN_DIR # and must be called for every subproject. |