From 8d2c2791c2566109d91ff3033f7e81d10fdd4346 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 22 Mar 2012 14:58:14 +0100 Subject: [PATCH] Added initial Linux MinGW-w64 support. --- CMake/linux-amd64-mingw32msvc.cmake | 15 +++++++++++++++ include/GL/glfw3.h | 6 ++++++ src/win32_init.c | 4 ++-- src/win32_platform.h | 2 ++ 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 CMake/linux-amd64-mingw32msvc.cmake diff --git a/CMake/linux-amd64-mingw32msvc.cmake b/CMake/linux-amd64-mingw32msvc.cmake new file mode 100644 index 00000000..5b68540e --- /dev/null +++ b/CMake/linux-amd64-mingw32msvc.cmake @@ -0,0 +1,15 @@ +# Define the cross compilation environment for cross compiling from linux +# to Win64 it is to be used when Debian cross compilation toolchain is +# available. +SET(CMAKE_SYSTEM_NAME Windows) # Target system name +SET(CMAKE_SYSTEM_VERSION 1) # Not really used. +SET(CMAKE_C_COMPILER "amd64-mingw32msvc-gcc") +SET(CMAKE_CXX_COMPILER "amd64-mingw32msvc-g++") +SET(CMAKE_RANLIB "amd64-mingw32msvc-ranlib") + + +#Configure the behaviour of the find commands +SET(CMAKE_FIND_ROOT_PATH "/usr/amd64-mingw32msvc") +SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/include/GL/glfw3.h b/include/GL/glfw3.h index cc817521..44e26b62 100644 --- a/include/GL/glfw3.h +++ b/include/GL/glfw3.h @@ -67,6 +67,12 @@ extern "C" { #endif #endif /* APIENTRY */ +/* TEMPORARY MinGW-w64 hacks. + */ +#if __MINGW64__ + #define WINAPI +#include +#endif /* The following three defines are here solely to make some Windows-based * files happy. Theoretically we could include , but diff --git a/src/win32_init.c b/src/win32_init.c index 4e1b7863..4fab9b74 100644 --- a/src/win32_init.c +++ b/src/win32_init.c @@ -200,7 +200,7 @@ int _glfwPlatformInit(void) // as possible in the hope of still being the foreground process) SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, &_glfwLibrary.Win32.foregroundLockTimeout, 0); - SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, (LPVOID) 0, + SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UIntToPtr(0), SPIF_SENDCHANGE); if (!initLibraries()) @@ -246,7 +246,7 @@ int _glfwPlatformTerminate(void) // Restore previous FOREGROUNDLOCKTIMEOUT system setting SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, - (LPVOID) _glfwLibrary.Win32.foregroundLockTimeout, + UIntToPtr(_glfwLibrary.Win32.foregroundLockTimeout), SPIF_SENDCHANGE); return GL_TRUE; diff --git a/src/win32_platform.h b/src/win32_platform.h index 82b8c9ca..0f6362c1 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -51,7 +51,9 @@ #endif // GLFW requires Windows XP +#ifndef WINVER #define WINVER 0x0501 +#endif #include #include