From 286943b14bc5502b4e6f30e1ee00103c4341d110 Mon Sep 17 00:00:00 2001 From: mcc Date: Sat, 30 Jun 2012 00:39:06 -0700 Subject: [PATCH] Fix new mingw compile issues (except OpenAL) --- CMake/ExternalOggVorbis.cmake | 1 + CMake/ExternalOpenAL.cmake | 2 +- CMake/ExternalPNG.cmake | 1 + CMake/physfs.cmake | 1 + CMakeLists.txt | 2 +- Core/Contents/Include/PolyGLHeaders.h | 1 + Core/Contents/Include/PolyWinCore.h | 7 ++++++- Core/Contents/Source/PolyGLSLShaderModule.cpp | 1 - Core/Contents/Source/PolyWinCore.cpp | 8 ++++++-- Modules/Contents/CMakeLists.txt | 5 ++++- 10 files changed, 22 insertions(+), 7 deletions(-) diff --git a/CMake/ExternalOggVorbis.cmake b/CMake/ExternalOggVorbis.cmake index 8b572b005..80c7593e6 100644 --- a/CMake/ExternalOggVorbis.cmake +++ b/CMake/ExternalOggVorbis.cmake @@ -25,6 +25,7 @@ EXTERNALPROJECT_ADD(libogg ExternalProject_Get_Property(libogg install_dir) +# Kludge: Shouldn't be necessary if FIND_LIBRARY were working on mingw. IF (MINGW) SET(oggvorbis_CMAKE_ARGS ${oggvorbis_CMAKE_ARGS} -DOGG_LIBRARY=libogg diff --git a/CMake/ExternalOpenAL.cmake b/CMake/ExternalOpenAL.cmake index c772db739..44837c412 100644 --- a/CMake/ExternalOpenAL.cmake +++ b/CMake/ExternalOpenAL.cmake @@ -6,7 +6,7 @@ SET(openal_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/openal) SET(openal_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} -DCMAKE_DEBUG_POSTFIX=d ) diff --git a/CMake/ExternalPNG.cmake b/CMake/ExternalPNG.cmake index d2c9ff0f3..2f5343acb 100644 --- a/CMake/ExternalPNG.cmake +++ b/CMake/ExternalPNG.cmake @@ -28,6 +28,7 @@ EXTERNALPROJECT_ADD(zlib ExternalProject_Get_Property(zlib install_dir) +# Kludge: Shouldn't be necessary if FIND_LIBRARY were working on mingw. IF (MINGW) SET(libpng_CMAKE_ARGS ${libpng_CMAKE_ARGS} -DZLIB_LIBRARY=zlib diff --git a/CMake/physfs.cmake b/CMake/physfs.cmake index f68e448bc..83441e52b 100644 --- a/CMake/physfs.cmake +++ b/CMake/physfs.cmake @@ -250,6 +250,7 @@ ENDIF(PHYSFS_ARCHIVE_QPAK) IF(PHYSFS_NEED_ZLIB) FIND_PACKAGE(ZLIB) + # Kludge: Shouldn't be necessary if FIND_LIBRARY were working on mingw. IF(MINGW) SET(ZLIB_FOUND 1) SET(ZLIB_LIBRARY zlib) diff --git a/CMakeLists.txt b/CMakeLists.txt index e58be6500..ab8f7e66b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ SET(CMAKE_PREFIX_PATH MESSAGE(DEBUG " CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}") # If the following large ugly mess is not present, failures can occur with -G "Unix Makefiles". -# FIXME: cmake should be finding ALL of the following things by way of CMAKE_PREFIX_PATH +# FIXME: Shouldn't be necessary if FIND_LIBRARY were working on mingw. IF (MINGW) LINK_DIRECTORIES(${POLYCODE_RELEASE_DIR}/Framework/Core/Dependencies/lib) LINK_DIRECTORIES(${POLYCODE_RELEASE_DIR}/Framework/Modules/Dependencies/lib) diff --git a/Core/Contents/Include/PolyGLHeaders.h b/Core/Contents/Include/PolyGLHeaders.h index e5cb14e4c..01d02eabc 100644 --- a/Core/Contents/Include/PolyGLHeaders.h +++ b/Core/Contents/Include/PolyGLHeaders.h @@ -91,6 +91,7 @@ typedef GLEEPFNGLBINDATTRIBLOCATIONPROC PFNGLBINDATTRIBLOCATIONPROC; typedef GLEEPFNGLVERTEXATTRIBPOINTERPROC PFNGLVERTEXATTRIBPOINTERPROC; typedef GLEEPFNGLENABLEVERTEXATTRIBARRAYARBPROC PFNGLENABLEVERTEXATTRIBARRAYARBPROC; typedef GLEEPFNGLBINDATTRIBLOCATIONPROC PFNGLBINDATTRIBLOCATIONPROC; +typedef GLEEPFNGLUNIFORM2FPROC PFNGLUNIFORM2FPROC; #endif #if defined(__APPLE__) && defined(__MACH__) diff --git a/Core/Contents/Include/PolyWinCore.h b/Core/Contents/Include/PolyWinCore.h index 375648623..ddc4a8245 100644 --- a/Core/Contents/Include/PolyWinCore.h +++ b/Core/Contents/Include/PolyWinCore.h @@ -94,6 +94,10 @@ #define EXTENDED_KEYMASK (1<<24) +#ifdef _MINGW +#define NO_TOUCH_API 1 +#endif + namespace Polycode { class _PolyExport Win32Mutex : public CoreMutex { @@ -256,12 +260,13 @@ class Gamepad_devicePrivate { // Tracks whether the system supports multitouch at runtime bool hasMultiTouch; +#ifndef NO_TOUCH_API // Create generic reference to any multitouch functions we need, so that we // can make them available at runtime if the operating system supports it // while still allowing fallback for older systems // See: http://msdn.microsoft.com/en-us/library/ms683212(v=vs.85).aspx typedef bool (WINAPI *GetTouchInputInfoType)(HTOUCHINPUT,UINT,PTOUCHINPUT,int); GetTouchInputInfoType GetTouchInputInfoFunc; - +#endif }; } diff --git a/Core/Contents/Source/PolyGLSLShaderModule.cpp b/Core/Contents/Source/PolyGLSLShaderModule.cpp index bde15d58d..db3296fe7 100755 --- a/Core/Contents/Source/PolyGLSLShaderModule.cpp +++ b/Core/Contents/Source/PolyGLSLShaderModule.cpp @@ -74,7 +74,6 @@ GLSLShaderModule::GLSLShaderModule() : PolycodeShaderModule() { glUniform1f = (PFNGLUNIFORM1FPROC)wglGetProcAddress("glUniform1f"); glUniform2f = (PFNGLUNIFORM2FPROC)wglGetProcAddress("glUniform2f"); glUniform3f = (PFNGLUNIFORM3FPROC)wglGetProcAddress("glUniform3f"); - glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONARBPROC)wglGetProcAddress("glGetUniformLocation"); glCreateShader = (PFNGLCREATESHADERPROC)wglGetProcAddress("glCreateShader"); glShaderSource = (PFNGLSHADERSOURCEPROC)wglGetProcAddress("glShaderSource"); glCompileShader = (PFNGLCOMPILESHADERPROC)wglGetProcAddress("glCompileShader"); diff --git a/Core/Contents/Source/PolyWinCore.cpp b/Core/Contents/Source/PolyWinCore.cpp index 0bf5f44d6..f611c0085 100644 --- a/Core/Contents/Source/PolyWinCore.cpp +++ b/Core/Contents/Source/PolyWinCore.cpp @@ -432,6 +432,7 @@ void Win32Core::handleKeyUp(LPARAM lParam, WPARAM wParam) { unlockMutex(eventMutex); } +#ifndef NO_TOUCH_API void Win32Core::handleTouchEvent(LPARAM lParam, WPARAM wParam) { // Bail out now if multitouch is not available on this system @@ -490,6 +491,7 @@ void Win32Core::handleTouchEvent(LPARAM lParam, WPARAM wParam) { } unlockMutex(eventMutex); } +#endif void Win32Core::handleMouseMove(LPARAM lParam, WPARAM wParam) { lockMutex(eventMutex); @@ -809,7 +811,9 @@ void Win32Core::shutdownGamepad() { } void Win32Core::initTouch() { - +#ifdef NO_TOUCH_API + hasMultiTouch = false; +#else // Check for windows multitouch support at runtime // This could be done easily during preprocessing but would require building // multiple releases of polycode for both winxp/vista and win7 @@ -818,7 +822,7 @@ void Win32Core::initTouch() { // If the above multitouch functions were found, then set a flag so we don't // have to check again later hasMultiTouch = ( GetTouchInputInfoFunc == NULL ) ? false : true; - +#endif } diff --git a/Modules/Contents/CMakeLists.txt b/Modules/Contents/CMakeLists.txt index b15d0d2b6..1430c2338 100644 --- a/Modules/Contents/CMakeLists.txt +++ b/Modules/Contents/CMakeLists.txt @@ -17,4 +17,7 @@ ENDIF(FREENECT_FOUND) ADD_SUBDIRECTORY(UI) ADD_SUBDIRECTORY(Networking) -ADD_SUBDIRECTORY(TUIO) \ No newline at end of file + +IF (NOT MINGW) +ADD_SUBDIRECTORY(TUIO) +ENDIF (NOT MINGW) \ No newline at end of file