]> vaikene.ee Git - evaf/commitdiff
Changes to build the software with mingw on Windows.
authorEnar Vaikene <enar.vaikene@logica.com>
Fri, 25 May 2012 12:48:57 +0000 (15:48 +0300)
committerEnar Vaikene <enar.vaikene@logica.com>
Fri, 25 May 2012 12:48:57 +0000 (15:48 +0300)
17 files changed:
CMakeWin.txt
src/apps/FileFinder/Engine/CMakeLists.txt
src/apps/FileFinder/GUI/CMakeLists.txt
src/apps/PswGen/CLI/CMakeLists.txt
src/apps/PswGen/GUI/CMakeLists.txt
src/apps/PswGen/Generator/CMakeLists.txt
src/apps/PswGen/Storage/CMakeLists.txt
src/libs/Common/CMakeLists.txt
src/libs/Common/logger.cpp
src/libs/Gui/CMakeLists.txt
src/libs/Plugins/CMakeLists.txt
src/libs/Plugins/pluginmanager.h
src/main/CLI/CMakeLists.txt
src/main/GUI/CMakeLists.txt
src/plugins/LogView/CMakeLists.txt
src/plugins/SdiWindow/CMakeLists.txt
src/plugins/Test/CMakeLists.txt

index 6e43b9a281c7ac6150de2993f117d177095023dd..95a950035199fc4e77238e5991929cc34c0bdc39 100644 (file)
@@ -1,3 +1,18 @@
 # Extra rules for Windows builds
 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:wchar_t-")
+if(MINGW)
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
+
+    # gcc options for release and debug builds
+    IF(CMAKE_BUILD_TYPE STREQUAL Release)
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
+    ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
+    ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
+
+    set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
+
+else(MINGW)
+    # Assume a Microsoft Visual C++ compiler
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:wchar_t-")
+endif(MINGW)
index 4e9e9ba8cdff6d81dd3a30b9c1b8151cba8e72b2..af9c24a7bebc6785f29a30eeb8d59a7d1df17c40 100644 (file)
@@ -26,9 +26,9 @@ set(MOC_HDRS
 )
 
 # Version info resource file for Windows builds
-if(WIN32)
+if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
-endif(WIN32)
+endif(WIN32 AND NOT MINGW)
 
 qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
index cdc585fab82979f0964e65aace12e639dd50b09f..56b5db42eab939034fef713301928b53200da9bb 100644 (file)
@@ -26,9 +26,9 @@ set(MOC_HDRS
 #)
 
 # Version info resource file for Windows builds
-if(WIN32)
+if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
-endif(WIN32)
+endif(WIN32 AND NOT MINGW)
 
 qt4_add_resources(RCC_SRCS ${RCCS})
 
index 63f57a77e2dfe8ed28f63c31e2a4c6ba34e01ba4..ef8ee227b25460bc7df9638cce94fb5f0f8aaf1e 100644 (file)
@@ -22,9 +22,9 @@ set(MOC_HDRS
 )
 
 # Version info resource file for Windows builds
-if(WIN32)
+if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
-endif(WIN32)
+endif(WIN32 AND NOT MINGW)
 
 qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
index bea3cd6ee1dc939737f84a78cc6b8a716394604c..561060ec6898ac85241e031cd804784a53c9e892 100644 (file)
@@ -21,9 +21,9 @@ set(MOC_HDRS
 )
 
 # Version info resource file for Windows builds
-if(WIN32)
+if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
-endif(WIN32)
+endif(WIN32 AND NOT MINGW)
 
 qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
index 9325fe95dba1965003a34a7d5b9e644fc018b284..3d7c7ebe514aea2d68153a65fddab79a4fbc7c9e 100644 (file)
@@ -25,9 +25,9 @@ set(MOC_HDRS
 )
 
 # Version info resource file for Windows builds
-if(WIN32)
+if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
-endif(WIN32)
+endif(WIN32 AND NOT MINGW)
 
 qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
index 13722c39e4b49c8e1956d270bbf63eb9c3e8d034..2169469e2613cc63b7baf1a8d37a720a62b549c0 100644 (file)
@@ -26,9 +26,9 @@ set(MOC_HDRS
 )
 
 # Version info resource file for Windows builds
-if(WIN32)
+if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
-endif(WIN32)
+endif(WIN32 AND NOT MINGW)
 
 qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
index a9916b4b4dcd9d957632c78045be30d8070ca7ed..83affd4f2c5130191a4136f76a948bd08efeeb64 100644 (file)
@@ -45,9 +45,9 @@ set(MOC_HDRS
 )
 
 # Version info resource file for Windows builds
-if(WIN32)
+if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
-endif(WIN32)
+endif(WIN32 AND NOT MINGW)
 
 qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
index bb8807395aa7c735c07972a9a94110d1fae209df..358b3146b3bb6e789670adc1203d0524956de764 100644 (file)
@@ -421,7 +421,11 @@ QString Logger::printf(char const * const fmt, ...) const
     va_list ap;
 #ifdef Q_OS_WIN32
     va_start(ap, fmt);
+#  ifdef Q_CC_GNU
+    vsnprintf(str, sizeof(str), fmt, ap);
+#  else
     _vsnprintf_s(str, sizeof(str), _TRUNCATE, fmt, ap);
+#  endif
     va_end(ap);
 #else
     ::va_start(ap, fmt);
index 19fd17239bb3c6e0f44bc419d8cb18609efd0f1e..8821dc1cbf40f2af6141de7ebd8e55bf7c16304f 100644 (file)
@@ -24,9 +24,9 @@ set(MOC_HDRS
 )
 
 # Version info resource file for Windows builds
-if(WIN32)
+if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
-endif(WIN32)
+endif(WIN32 AND NOT MINGW)
 
 qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
index 0aadd65e8ecbbe13eb7cc8999582469732a0c187..edcfae664d4f74cec71c1c7afc11c55377d21003 100644 (file)
@@ -29,9 +29,9 @@ set(MOC_HDRS
 )
 
 # Version info resource file for Windows builds
-if(WIN32)
+if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
-endif(WIN32)
+endif(WIN32 AND NOT MINGW)
 
 qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
index f79193c1ab89034575fea35550a4d63456be0884..c9806af14eda1916b3331612eeb1cacdb1997947 100644 (file)
@@ -58,7 +58,11 @@ namespace Internal {
 inline QString expandPluginName(QString const & name)
 {
 #ifdef Q_OS_WIN32
+#  ifdef Q_CC_MINGW
+    return "lib" + name + ".dll";
+#  else
     return name + ".dll";
+#  endif
 #elif defined Q_OS_LINUX
     return "lib" + name + ".so";
 #else
index d6a5b14cb679368029eb45c0326743325f84d3f3..a3983a6fb3e45e982329054a1af202f4ac903ca9 100644 (file)
@@ -23,9 +23,9 @@ set(MOC_HDRS
 )
 
 # Version info resource file for Windows builds
-if(WIN32)
+if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc cli.rc)
-endif(WIN32)
+endif(WIN32 AND NOT MINGW)
 
 qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
index 8483bb57cb6b03f231e485db8ad785ded3b80e78..367e2f53a1c61cb24b865900a735220b9126d261 100644 (file)
@@ -38,9 +38,9 @@ set(MOC_HDRS
 #)
 
 # Version info resource file for Windows builds
-if(WIN32)
+if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc gui.rc)
-endif(WIN32)
+endif(WIN32 AND NOT MINGW)
 
 qt4_add_resources(RCC_SRCS ${RCCS})
 
index 8f68dd18c712bd2b30c94040b7fc0b7021b65b86..ac0d07f98fdf19a7bb111ae4047912b83b25f83e 100644 (file)
@@ -26,9 +26,9 @@ set(MOC_HDRS
 )
 
 # Version info resource file for Windows builds
-if(WIN32)
+if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
-endif(WIN32)
+endif(WIN32 AND NOT MINGW)
 
 qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
index c87eed6d6cd2dfaa75f085ff2887abaac6b53834..cd0a8c01829a59f639edbb3c4c398177bacb4c39 100644 (file)
@@ -26,9 +26,9 @@ set(MOC_HDRS
 )
 
 # Version info resource file for Windows builds
-if(WIN32)
+if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
-endif(WIN32)
+endif(WIN32 AND NOT MINGW)
 
 qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
index 35393d748260a1514c0b6cccb13c31bd647635a2..bbf03ba17fb1bc698fe00e6d82d2f2a10a92e750 100644 (file)
@@ -23,9 +23,9 @@ set(MOC_HDRS
 )
 
 # Version info resource file for Windows builds
-if(WIN32)
+if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
-endif(WIN32)
+endif(WIN32 AND NOT MINGW)
 
 qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})