aboutsummaryrefslogtreecommitdiffstats
path: root/PySide
diff options
context:
space:
mode:
authorAnderson Lizardo <anderson.lizardo@openbossa.org>2010-08-14 10:02:33 -0400
committerAnderson Lizardo <anderson.lizardo@openbossa.org>2010-08-26 11:07:02 -0400
commite5e44b6465e2755c70c8e13060de4c2ca799fd64 (patch)
treedc806580d8f580861082c815198f2bb7202df422 /PySide
parentd53f699751047b18e7c729de3cdcc7eb45b32dd1 (diff)
Replace macro checks with actual symbol checking
This increases a little more the check time, but is also more precise. It is also required for cases where qfeatures.h incorrectly reports support for a feature, but the actual class is not compiled (the case for a couple of classes in Qt Simulator). Additionally, the macro has been made more concise, and is reused for both QtGui and QtNetwork. Reviewed-by: Luciano Wolf <luciano.wolf@openbossa.org> Reviewed-by: Hugo Parente Lima <hugo.lima@openbossa.org>
Diffstat (limited to 'PySide')
-rw-r--r--PySide/CMakeLists.txt33
-rw-r--r--PySide/QtGui/CMakeLists.txt89
-rw-r--r--PySide/QtNetwork/CMakeLists.txt47
3 files changed, 42 insertions, 127 deletions
diff --git a/PySide/CMakeLists.txt b/PySide/CMakeLists.txt
index 01cd0ce36..05dd4ffe1 100644
--- a/PySide/CMakeLists.txt
+++ b/PySide/CMakeLists.txt
@@ -51,6 +51,39 @@ macro(create_pyside_module module_name module_include_dir module_libraries modul
install(FILES ${typesystem_files} DESTINATION share/PySide/typesystems)
endmacro()
+macro(check_qt_class module class global_sources)
+ string(TOLOWER ${class} _class)
+ string(TOUPPER ${module} _module)
+ set(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module}/${_class}_wrapper.cpp)
+ if (DEFINED PYSIDE_${class})
+ if (PYSIDE_${class})
+ list(APPEND ${global_sources} ${_cppfile})
+ endif()
+ else()
+ set(SRC_FILE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test${class}.cxx)
+ file(WRITE ${SRC_FILE}
+ "#include <${module}>\n"
+ "#include <typeinfo>\n"
+ "int main() { return (int) &typeid(${class}); }\n"
+ )
+ try_compile(Q_WORKS ${CMAKE_BINARY_DIR}
+ ${SRC_FILE}
+ CMAKE_FLAGS
+ "-DLINK_LIBRARIES=${QT_${_module}_LIBRARY}"
+ "-DLINK_DIRECTORIES=${QT_LIBRARY_DIR}"
+ "-DINCLUDE_DIRECTORIES=${QT_INCLUDE_DIR};${QT_${_module}_INCLUDE_DIR}"
+ OUTPUT_VARIABLE OUTPUT)
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCheckQtClassTest.log ${OUTPUT})
+
+ set("PYSIDE_${class}" ${Q_WORKS} CACHE STRING "Has this Qt class been found?")
+ if(Q_WORKS)
+ message(STATUS "Checking for ${class} in ${module} -- found")
+ list(APPEND ${global_sources} ${_cppfile})
+ else()
+ message(STATUS "Checking for ${class} in ${module} -- not found")
+ endif()
+ endif()
+endmacro()
# Configure include based on platform
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/global.h.in"
diff --git a/PySide/QtGui/CMakeLists.txt b/PySide/QtGui/CMakeLists.txt
index 88ec19164..a6787cda8 100644
--- a/PySide/QtGui/CMakeLists.txt
+++ b/PySide/QtGui/CMakeLists.txt
@@ -1,38 +1,5 @@
project(QtGui)
-# Check QtGui support
-macro(CHECK_QT_GUI_MACRO macro_display_name qt_macro module_sources global_sources)
- if (DEFINED PYSIDE_${qt_macro})
- if (PYSIDE_${qt_macro})
- list(APPEND ${global_sources} ${${module_sources}})
- endif()
- else()
- set(SRC_FILE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test${qt_macro}.cxx)
- file(WRITE ${SRC_FILE}
- "#include <QtGui>\n"
- "int main() { \n"
- "#ifdef ${qt_macro}\n"
- "#error not supported.\n"
- "#endif\n"
- "}\n")
-
- try_compile(Q_WORKS ${CMAKE_BINARY_DIR}
- ${SRC_FILE}
- CMAKE_FLAGS
- -DINCLUDE_DIRECTORIES:STRING=${QT_QTGUI_INCLUDE_DIR}\;${QT_INCLUDE_DIR}
- -DLINK_LIBRARIES:PATH=${QT_QTGUI_LIBRARY_RELEASE}
- OUTPUT_VARIABLE OUTPUT)
-
- set("PYSIDE_${qt_macro}" ${Q_WORKS} CACHE STRING "Has this Qt module been found by pyside?")
- if(Q_WORKS)
- message(STATUS "Testing support to ${macro_display_name} -- enabled")
- list(APPEND ${global_sources} ${${module_sources}})
- else()
- message(STATUS "Testing support to ${macro_display_name} -- disabled")
- endif()
- endif()
-endmacro()
-
if(ENABLE_X11)
set(SPECIFIC_OS_FILES
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qx11info_wrapper.cpp
@@ -406,58 +373,10 @@ ${SPECIFIC_OS_FILES}
${QtGui_46_SRC}
)
-#Check GtkStyle
-set(QT_GTKSTYLE_SRCS
- ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qgtkstyle_wrapper.cpp
-)
-CHECK_QT_GUI_MACRO("GtkStyle" QT_NO_STYLE_GTK QT_GTKSTYLE_SRCS QtGui_SRC)
-
-#Check SystemTray
-set(QT_SYSTEMTRAY_SRCS
- ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qsystemtrayicon_wrapper.cpp
-)
-CHECK_QT_GUI_MACRO("SystemTray" QT_NO_SYSTEMTRAYICON QT_SYSTEMTRAY_SRCS QtGui_SRC)
-
-#Check QT_PRINTDIALOG support
-set(QT_PRINTDIALOG_SRCS
- ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qabstractpagesetupdialog_wrapper.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qabstractprintdialog_wrapper.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qpagesetupdialog_wrapper.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qprintdialog_wrapper.cpp
-)
-CHECK_QT_GUI_MACRO("PrintDialog Support" QT_NO_PRINTDIALOG QT_PRINTDIALOG_SRCS QtGui_SRC)
-
-#Check QT_PRITPREVIEW support
-set(QT_PRINTPREVIEW_SRCS
- ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qprintpreviewwidget_wrapper.cpp
-)
-CHECK_QT_GUI_MACRO("PrintPreview Support" QT_NO_PRINTPREVIEWWIDGET QT_PRINTPREVIEW_SRCS QtGui_SRC)
-
-#Check QT_PRINTPREVIEWDIALOG support
-set(QT_PRINTPREVIEWDIALOG_SRCS
- ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qprintpreviewdialog_wrapper.cpp
-)
-CHECK_QT_GUI_MACRO("PrintPreviewDialog Support" QT_NO_PRINTPREVIEWDIALOG QT_PRINTPREVIEWDIALOG_SRCS QtGui_SRC)
-
-#Check QT_PRINTER
-set(QT_PRINTER_SRCS
- ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qprinter_wrapper.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qprinterinfo_wrapper.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qprintengine_wrapper.cpp
-)
-CHECK_QT_GUI_MACRO("Printer Support" QT_NO_PRINTER QT_PRINTER_SRCS QtGui_SRC)
-
-#Check QT_SIZEGRIP support
-set(QT_SIZEGRIP_SRCS
- ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qsizegrip_wrapper.cpp
-)
-CHECK_QT_GUI_MACRO("SizeGrip Support" QT_NO_SIZEGRIP QT_SIZEGRIP_SRCS QtGui_SRC)
-
-#Check QT_SESSIONMANAGER support
-set(QT_SESSIONMANAGER_SRCS
- ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qsessionmanager_wrapper.cpp
-)
-CHECK_QT_GUI_MACRO("SessionManager Support" QT_NO_SESSIONMANAGER QT_SESSIONMANAGER_SRCS QtGui_SRC)
+check_qt_class(QtGui QGtkStyle QtGui_SRC)
+check_qt_class(QtGui QSessionManager QtGui_SRC)
+check_qt_class(QtGui QSizeGrip QtGui_SRC)
+check_qt_class(QtGui QSystemTrayIcon QtGui_SRC)
set(QtGui_typesystem_path "${QtCore_SOURCE_DIR}")
set(QtGui_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
diff --git a/PySide/QtNetwork/CMakeLists.txt b/PySide/QtNetwork/CMakeLists.txt
index ca0599314..691cf76a6 100644
--- a/PySide/QtNetwork/CMakeLists.txt
+++ b/PySide/QtNetwork/CMakeLists.txt
@@ -1,38 +1,5 @@
project(QtNetwork)
-# Check QtNetwork support
-macro(CHECK_QT_NETWORK_MACRO macro_display_name qt_macro module_sources global_sources)
- if (DEFINED PYSIDE_${qt_macro})
- if (PYSIDE_${qt_macro})
- list(APPEND ${global_sources} ${${module_sources}})
- endif()
- else()
- set(SRC_FILE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test${qt_macro}.cxx)
- file(WRITE ${SRC_FILE}
- "#include <QtNetwork>\n"
- "int main() { \n"
- "#ifdef ${qt_macro}\n"
- "#error not supported.\n"
- "#endif\n"
- "}\n")
-
- try_compile(Q_WORKS ${CMAKE_BINARY_DIR}
- ${SRC_FILE}
- CMAKE_FLAGS
- -DINCLUDE_DIRECTORIES:STRING=${QT_QTNETWORK_INCLUDE_DIR}\;${QT_INCLUDE_DIR}
- -DLINK_LIBRARIES:PATH=${QT_QTNETWORK_LIBRARY_RELEASE}
- OUTPUT_VARIABLE OUTPUT)
-
- set("PYSIDE_${qt_macro}" ${Q_WORKS} CACHE STRING "Has this Qt module been found by pyside?")
- if(Q_WORKS)
- message(STATUS "Testing support to ${macro_display_name} -- enabled")
- list(APPEND ${global_sources} ${${module_sources}})
- else()
- message(STATUS "Testing support to ${macro_display_name} -- disabled")
- endif()
- endif()
-endmacro()
-
if (${QT_VERSION_MAJOR} EQUAL 4 AND ${QT_VERSION_MINOR} GREATER 6)
set (QtNetwork_47_SRC
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qnetworkconfiguration_wrapper.cpp
@@ -74,15 +41,11 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qurlinfo_wrapper.cpp
${QtNetwork_47_SRC}
)
-set(OPENSSL_SOURCES
- ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qsslcipher_wrapper.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qsslkey_wrapper.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qsslconfiguration_wrapper.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qsslerror_wrapper.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qsslsocket_wrapper.cpp
-)
-
-CHECK_QT_NETWORK_MACRO("Network OPENSSL" QT_NO_OPENSSL OPENSSL_SOURCES QtNetwork_SRC)
+check_qt_class(QtNetwork QSslCipher QtNetwork_SRC)
+check_qt_class(QtNetwork QSslConfiguration QtNetwork_SRC)
+check_qt_class(QtNetwork QSslError QtNetwork_SRC)
+check_qt_class(QtNetwork QSslKey QtNetwork_SRC)
+check_qt_class(QtNetwork QSslSocket QtNetwork_SRC)
set(QtNetwork_typesystem_path "${QtCore_SOURCE_DIR}")
set(QtNetwork_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}