aboutsummaryrefslogtreecommitdiffstats
path: root/PySide/CMakeLists.txt
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/CMakeLists.txt
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/CMakeLists.txt')
-rw-r--r--PySide/CMakeLists.txt33
1 files changed, 33 insertions, 0 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"