Skip to content

Commit

Permalink
TOOLS: Allow compilation with MinGW for all our tools again.
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Schickel committed Apr 8, 2011
1 parent bd253a6 commit 9e6a640
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tools/create_project/create_project.cpp
Expand Up @@ -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"

Expand All @@ -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>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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");
Expand Down
6 changes: 6 additions & 0 deletions tools/create_teenagent/create_teenagent.cpp
Expand Up @@ -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>
Expand Down

0 comments on commit 9e6a640

Please sign in to comment.