summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-05-19 14:20:18 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-05-19 17:39:56 -0300
commitb830e6696627e1c740e7f93f7978c604a59ee7ac (patch)
tree7d375d14693b6d5b1530d6de9e4fbbc31ef4526f
parent101a3f0e33a747e0627acb2429c01acac9a88798 (diff)
Implemented SO detection support.
Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>, Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r--CMakeLists.txt26
-rw-r--r--PySide/CMakeLists.txt7
-rw-r--r--PySide/QtGui/CMakeLists.txt11
-rw-r--r--PySide/global.h.in (renamed from PySide/global.h)18
4 files changed, 48 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 08f9160e..73846a20 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,6 +40,32 @@ if (${QTVERSION} VERSION_LESS 4.5.0)
message(FATAL_ERROR "You need Qt4.5, found ${QTVERSION}.")
endif()
+# Configure OS support
+if(Q_WS_X11)
+ set(ENABLE_X11 "1")
+ set(ENABLE_MAC "0")
+ set(ENABLE_WIN "0")
+ if(Q_WS_MAEMO_5)
+ set(AUTO_OS "MAEMO 5")
+ else()
+ set(AUTO_OS "X11")
+ endif()
+elseif(Q_WS_MAC)
+ set(ENABLE_X11 "0")
+ set(ENABLE_MAC "1")
+ set(ENABLE_WIN "0")
+ set(AUTO_OS "MAC")
+elseif(Q_WS_WIN)
+ set(ENABLE_X11 "0")
+ set(ENABLE_MAC "0")
+ set(ENABLE_WIN "1")
+ set(AUTO_OS "WIN")
+else()
+ message(FATAL_ERROR "OS not supported")
+endif()
+
+message(STATUS "Detected OS: ${AUTO_OS}")
+
set(BINDING_VERSION ${BINDING_API_VERSION}.${QT_VERSION_MAJOR}.${QT_VERSION_MINOR})
find_program(GENERATOR generatorrunner REQUIRED)
diff --git a/PySide/CMakeLists.txt b/PySide/CMakeLists.txt
index 210c595f..24b6d16d 100644
--- a/PySide/CMakeLists.txt
+++ b/PySide/CMakeLists.txt
@@ -5,7 +5,7 @@ install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/__init__.py"
macro(execute_generator module sources typesystem_path)
add_custom_command(OUTPUT ${${sources}}
COMMAND ${GENERATOR} ${GENERATOR_EXTRA_FLAGS}
- ${pyside_SOURCE_DIR}/global.h
+ ${CMAKE_BINARY_DIR}/PySide/global.h
--include-paths=${pyside_SOURCE_DIR}:${QT_INCLUDE_DIR}
--typesystem-paths=${pyside_SOURCE_DIR}:${typesystem_path}
--output-directory=${CMAKE_CURRENT_BINARY_DIR}
@@ -16,6 +16,11 @@ COMMENT "Running generator for ${module}..."
)
endmacro(execute_generator)
+# Configure include based on platform
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/global.h.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/global.h" @ONLY)
+
+
# Only add subdirectory if the associated Qt module is found.
macro(HAS_QT_MODULE var name)
if (DISABLE_${name})
diff --git a/PySide/QtGui/CMakeLists.txt b/PySide/QtGui/CMakeLists.txt
index 970785a3..f89e1abd 100644
--- a/PySide/QtGui/CMakeLists.txt
+++ b/PySide/QtGui/CMakeLists.txt
@@ -33,8 +33,7 @@ macro(CHECK_QT_GUI_MACRO macro_display_name qt_macro module_sources global_sourc
endif()
endmacro(CHECK_QT_GUI_MACRO)
-if(Q_WS_X11)
- set(AUTO_OS "X11")
+if(ENABLE_X11)
set(MODULE_NAME "x11")
set(SPECIFIC_OS_FILES
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qx11info_wrapper.cpp
@@ -49,16 +48,12 @@ if(Q_WS_X11)
)
endif(Q_WS_MAEMO_5)
-elseif(Q_WS_MAC)
- set(AUTO_OS "MAC")
+elseif(ENABLE_MAC)
set(MODULE_NAME "mac")
set(SPECIFIC_OS_FILES
)
-else()
- message(FATAL_ERROR "OS not supported")
-endif(Q_WS_X11)
+endif(ENABLE_X11)
-message(STATUS "Detected OS: ${AUTO_OS}")
if (${QT_VERSION_MAJOR} EQUAL 4 AND ${QT_VERSION_MINOR} LESS 6)
set (QtGui_46_SRC )
diff --git a/PySide/global.h b/PySide/global.h.in
index 1c88abce..bd7cf0e4 100644
--- a/PySide/global.h
+++ b/PySide/global.h.in
@@ -330,20 +330,28 @@ QT_END_NAMESPACE
QT_END_HEADER
-//#define Q_QDOC
#define qdoc
-//#undef Q_MOC_RUN
-//Export X11 related functions
-#define Q_WS_X11
+#if @ENABLE_X11@
+ #define Q_WS_X11
+#elif @ENABLE_MAC@
+ #define Q_WS_MAC
+#elif @ENABLE_WIN@
+ #define Q_WS_WIN
+#endif
// There are symbols in Qt that exist in Debug but
// not in release
#define QT_NO_DEBUG
#include <QtCore/QtCore>
+#if @ENABLE_MAC@
+ #undef qdoc
+#endif
#include <QtGui/QtGui>
-#include <QtGui/QX11Info>
+#if @ENABLE_X11@
+ #include <QtGui/QX11Info>
+#endif
#include <QtXml/QtXml>
#include <QtUiTools/QtUiTools>
#include <QtNetwork/QtNetwork>