aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJohannes Schickel2011-04-08 16:51:15 +0200
committerJohannes Schickel2011-04-08 16:51:15 +0200
commit9e6a640d8dbfcf94d6213a46a993c01e8813a53a (patch)
tree3eb3c32517a3e1f7499dba134d6eb91257b71c78 /tools
parentbd253a62aca2a0571ad61a3167278d3c5437467a (diff)
downloadscummvm-rg350-9e6a640d8dbfcf94d6213a46a993c01e8813a53a.tar.gz
scummvm-rg350-9e6a640d8dbfcf94d6213a46a993c01e8813a53a.tar.bz2
scummvm-rg350-9e6a640d8dbfcf94d6213a46a993c01e8813a53a.zip
TOOLS: Allow compilation with MinGW for all our tools again.
Diffstat (limited to 'tools')
-rw-r--r--tools/create_project/create_project.cpp18
-rw-r--r--tools/create_teenagent/create_teenagent.cpp6
2 files changed, 20 insertions, 4 deletions
diff --git a/tools/create_project/create_project.cpp b/tools/create_project/create_project.cpp
index 74a048df35..b896e85131 100644
--- a/tools/create_project/create_project.cpp
+++ b/tools/create_project/create_project.cpp
@@ -23,6 +23,12 @@
*
*/
+// HACK to allow building with the SDL backend on MinGW
+// see bug #1800764 "TOOLS: MinGW tools building broken"
+#ifdef main
+#undef main
+#endif // main
+
#include "create_project.h"
#include "codeblocks.h"
@@ -41,7 +47,11 @@
#include <cstdlib>
#include <ctime>
-#if defined(_WIN32) || defined(WIN32)
+#if (defined(_WIN32) || defined(WIN32)) && !defined(__GNUC__)
+#define USE_WIN32_API
+#endif
+
+#ifdef USE_WIN32_API
#include <windows.h>
#else
#include <sstream>
@@ -103,7 +113,7 @@ enum ProjectType {
};
int main(int argc, char *argv[]) {
-#if !(defined(_WIN32) || defined(WIN32))
+#ifndef USE_WIN32_API
// Initialize random number generator for UUID creation
std::srand(std::time(0));
#endif
@@ -860,7 +870,7 @@ bool compareNodes(const FileNode *l, const FileNode *r) {
*/
FileList listDirectory(const std::string &dir) {
FileList result;
-#if defined(_WIN32) || defined(WIN32)
+#ifdef USE_WIN32_API
WIN32_FIND_DATA fileInformation;
HANDLE fileHandle = FindFirstFile((dir + "/*").c_str(), &fileInformation);
@@ -1035,7 +1045,7 @@ ProjectProvider::UUIDMap ProjectProvider::createUUIDMap(const BuildSetup &setup)
}
std::string ProjectProvider::createUUID() const {
-#if defined(_WIN32) || defined(WIN32)
+#ifdef USE_WIN32_API
UUID uuid;
if (UuidCreate(&uuid) != RPC_S_OK)
error("UuidCreate failed");
diff --git a/tools/create_teenagent/create_teenagent.cpp b/tools/create_teenagent/create_teenagent.cpp
index ae88cc5d65..9a9c00d4b4 100644
--- a/tools/create_teenagent/create_teenagent.cpp
+++ b/tools/create_teenagent/create_teenagent.cpp
@@ -26,6 +26,12 @@
// Disable symbol overrides so that we can use system headers.
#define FORBIDDEN_SYMBOL_ALLOW_ALL
+// HACK to allow building with the SDL backend on MinGW
+// see bug #1800764 "TOOLS: MinGW tools building broken"
+#ifdef main
+#undef main
+#endif // main
+
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>