diff --git a/CMake/README.txt b/CMake/README.txt index 9581f832..96ac1905 100644 --- a/CMake/README.txt +++ b/CMake/README.txt @@ -11,7 +11,7 @@ To use these files you add a special parameter when configuring the source tree: For example, to use the Debian GNU/Linux MinGW package, run CMake like this: - cmake -DCMAKE_TOOLCHAIN_FILE=CMake/linux-i586-mingw32msvc.cmake . + cmake -DCMAKE_TOOLCHAIN_FILE=CMake/i586-mingw32msvc.cmake . For more details see this article: diff --git a/CMake/linux-amd64-mingw32msvc.cmake b/CMake/amd64-mingw32msvc.cmake similarity index 100% rename from CMake/linux-amd64-mingw32msvc.cmake rename to CMake/amd64-mingw32msvc.cmake diff --git a/CMake/linux-i586-mingw32msvc.cmake b/CMake/i586-mingw32msvc.cmake similarity index 100% rename from CMake/linux-i586-mingw32msvc.cmake rename to CMake/i586-mingw32msvc.cmake diff --git a/CMake/linux-i686-pc-mingw32.cmake b/CMake/i686-pc-mingw32.cmake similarity index 100% rename from CMake/linux-i686-pc-mingw32.cmake rename to CMake/i686-pc-mingw32.cmake diff --git a/CMake/cygwin-i686-w64-mingw32.cmake b/CMake/i686-w64-mingw32.cmake similarity index 100% rename from CMake/cygwin-i686-w64-mingw32.cmake rename to CMake/i686-w64-mingw32.cmake diff --git a/CMake/cygwin-x86_64-w64-mingw32.cmake b/CMake/x86_64-w64-mingw32.cmake similarity index 100% rename from CMake/cygwin-x86_64-w64-mingw32.cmake rename to CMake/x86_64-w64-mingw32.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 44dcb4d4..b80ac24e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,21 @@ if (_GLFW_WIN32_WGL) list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR}) list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY}) + if (MSVC) + option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON) + + if (NOT USE_MSVC_RUNTIME_LIBRARY_DLL) + foreach (flag CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) + if (${flag} MATCHES "/MD") + string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}") + endif() + if (${flag} MATCHES "/MDd") + string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}") + endif() + endforeach() + endif() + endif() + set(_GLFW_NO_DLOAD_WINMM ${BUILD_SHARED_LIBS}) if (BUILD_SHARED_LIBS) @@ -178,7 +193,7 @@ if (_GLFW_COCOA_NSGL) set(CMAKE_OSX_ARCHITECTURES ppc;i386;ppc64;x86_64) set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk) set(CMAKE_C_FLAGS "-mmacosx-version-min=10.5") - else(GLFW_BUILD_UNIVERSAL) + else() message(STATUS "Building GLFW only for the native architecture") endif() diff --git a/readme.html b/readme.html index 3ef85423..789ac5ff 100644 --- a/readme.html +++ b/readme.html @@ -335,7 +335,7 @@ version of GLFW.

  • [Cocoa] Bugfix: The cursor position incorrectly rounded during conversion
  • [Cocoa] Bugfix: Cursor positioning led to nonsensical results for fullscreen windows
  • [Cocoa] Bugfix: The GLFW window was flagged as restorable
  • -
  • [X11] Added support for the GLX_EXT_swap_control extension as an alternative to GLX_SGI_swap_control
  • +
  • [X11] Added support for the GLX_EXT_swap_control and GLX_MESA_swap_control extensions as alternatives to GLX_SGI_swap_control
  • [X11] Added the POSIX CLOCK_MONOTONIC time source as the preferred method
  • [X11] Added dependency on libm, where present
  • [X11] Added support for the _NET_WM_NAME and _NET_WM_ICON_NAME EWMH window properties
  • diff --git a/src/x11_opengl.c b/src/x11_opengl.c index dc2788c8..edcd69b6 100644 --- a/src/x11_opengl.c +++ b/src/x11_opengl.c @@ -544,6 +544,15 @@ int _glfwInitOpenGL(void) _glfwLibrary.GLX.SGI_swap_control = GL_TRUE; } + if (_glfwPlatformExtensionSupported("GLX_MESA_swap_control")) + { + _glfwLibrary.GLX.SwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC) + _glfwPlatformGetProcAddress("glXSwapIntervalMESA"); + + if (_glfwLibrary.GLX.SwapIntervalMESA) + _glfwLibrary.GLX.MESA_swap_control = GL_TRUE; + } + if (_glfwPlatformExtensionSupported("GLX_SGIX_fbconfig")) { _glfwLibrary.GLX.GetFBConfigAttribSGIX = (PFNGLXGETFBCONFIGATTRIBSGIXPROC) @@ -722,8 +731,13 @@ void _glfwPlatformSwapInterval(int interval) window->X11.handle, interval); } + else if (_glfwLibrary.GLX.MESA_swap_control) + _glfwLibrary.GLX.SwapIntervalMESA(interval); else if (_glfwLibrary.GLX.SGI_swap_control) - _glfwLibrary.GLX.SwapIntervalSGI(interval); + { + if (interval > 0) + _glfwLibrary.GLX.SwapIntervalSGI(interval); + } } diff --git a/src/x11_platform.h b/src/x11_platform.h index e8a4125b..c70c7d57 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -100,6 +100,10 @@ #define _GLFW_CONVERSION_SUCCEEDED 1 #define _GLFW_CONVERSION_FAILED 2 +#ifndef GLX_MESA_swap_control +typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int); +#endif + //======================================================================== // GLFW platform specific types @@ -245,6 +249,7 @@ typedef struct _GLFWlibraryGLX // GLX extensions PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI; PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT; + PFNGLXSWAPINTERVALMESAPROC SwapIntervalMESA; PFNGLXGETFBCONFIGATTRIBSGIXPROC GetFBConfigAttribSGIX; PFNGLXCHOOSEFBCONFIGSGIXPROC ChooseFBConfigSGIX; PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC CreateContextWithConfigSGIX; @@ -253,6 +258,7 @@ typedef struct _GLFWlibraryGLX GLboolean SGIX_fbconfig; GLboolean SGI_swap_control; GLboolean EXT_swap_control; + GLboolean MESA_swap_control; GLboolean ARB_multisample; GLboolean ARB_create_context; GLboolean ARB_create_context_profile;