Merge branch 'master' of github.com:elmindreda/glfw

This commit is contained in:
Camilla Berglund 2012-03-05 16:29:37 +01:00
commit cc15dff98c
12 changed files with 66 additions and 53 deletions

View File

@ -1,10 +1,19 @@
This folder contains a collection of toolchains definition in order to This directory contains a collection of toolchain definitions for cross
support cross compilation. The naming scheme is the following: compilation, currently limited to compiling Win32 binaries on Linux.
The toolchain file naming scheme is as follows:
host-system-compiler.cmake host-system-compiler.cmake
to use this at the time you run the initial cmake command use the To use these files you add a special parameter when configuring the source tree:
following parameter
-DCMAKE_TOOLCHAIN_FILE=./toolchains/XXX-XXX-XXX.cmake cmake -DCMAKE_TOOLCHAIN_FILE=<toolchain-file> .
which maps to file in this folder.
For example, to use the Debian GNU/Linux MinGW package, run CMake like this:
cmake -DCMAKE_TOOLCHAIN_FILE=CMake/linux-i586-mingw32msvc.cmake .
For more details see this article:
http://www.paraview.org/Wiki/CMake_Cross_Compiling
For more details see: http://www.paraview.org/Wiki/CMake_Cross_Compiling

View File

@ -1,7 +1,6 @@
project(GLFW C) project(GLFW C)
cmake_minimum_required(VERSION 2.4) cmake_minimum_required(VERSION 2.8)
cmake_policy(VERSION 2.4)
set(GLFW_VERSION_MAJOR "3") set(GLFW_VERSION_MAJOR "3")
set(GLFW_VERSION_MINOR "0") set(GLFW_VERSION_MINOR "0")
@ -27,7 +26,7 @@ if (WIN32)
# Set up library and include paths # Set up library and include paths
list(APPEND GLFW_INCLUDE_DIR ${OPENGL_INCLUDE_DIR}) list(APPEND GLFW_INCLUDE_DIR ${OPENGL_INCLUDE_DIR})
list(APPEND GLFW_LIBRARIES ${OPENGL_gl_LIBRARY}) list(APPEND GLFW_LIBRARIES ${OPENGL_gl_LIBRARY})
endif (WIN32) endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Set up GLFW for Xlib and GLX on Unix-like systems with X Windows # Set up GLFW for Xlib and GLX on Unix-like systems with X Windows
@ -47,12 +46,12 @@ if (UNIX AND NOT APPLE)
find_library(MATH_LIBRARY m) find_library(MATH_LIBRARY m)
if (MATH_LIBRARY) if (MATH_LIBRARY)
list(APPEND GLFW_LIBRARIES ${MATH_LIBRARY}) list(APPEND GLFW_LIBRARIES ${MATH_LIBRARY})
endif(MATH_LIBRARY) endif()
find_library(RT_LIBRARY rt) find_library(RT_LIBRARY rt)
if (RT_LIBRARY) if (RT_LIBRARY)
list(APPEND GLFW_LIBRARIES ${RT_LIBRARY}) list(APPEND GLFW_LIBRARIES ${RT_LIBRARY})
endif(RT_LIBRARY) endif()
include(CheckFunctionExists) include(CheckFunctionExists)
include(CheckSymbolExists) include(CheckSymbolExists)
@ -83,24 +82,22 @@ if (UNIX AND NOT APPLE)
if (NOT _GLFW_HAS_GLXGETPROCADDRESS) if (NOT _GLFW_HAS_GLXGETPROCADDRESS)
check_function_exists(glXGetProcAddressARB _GLFW_HAS_GLXGETPROCADDRESSARB) check_function_exists(glXGetProcAddressARB _GLFW_HAS_GLXGETPROCADDRESSARB)
endif (NOT _GLFW_HAS_GLXGETPROCADDRESS) endif()
if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND NOT _GLFW_HAS_GLXGETPROCADDRESSARB) if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND NOT _GLFW_HAS_GLXGETPROCADDRESSARB)
check_function_exists(glXGetProcAddressEXT _GLFW_HAS_GLXGETPROCADDRESSEXT) check_function_exists(glXGetProcAddressEXT _GLFW_HAS_GLXGETPROCADDRESSEXT)
endif (NOT _GLFW_HAS_GLXGETPROCADDRESS AND NOT _GLFW_HAS_GLXGETPROCADDRESSARB) endif()
if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND
NOT _GLFW_HAS_GLXGETPROCADDRESSARB AND NOT _GLFW_HAS_GLXGETPROCADDRESSARB AND
NOT _GLFW_HAS_GLXGETPROCADDRESSEXT) NOT _GLFW_HAS_GLXGETPROCADDRESSEXT)
message(WARNING "No glXGetProcAddressXXX variant found") message(WARNING "No glXGetProcAddressXXX variant found")
endif (NOT _GLFW_HAS_GLXGETPROCADDRESS AND endif()
NOT _GLFW_HAS_GLXGETPROCADDRESSARB AND
NOT _GLFW_HAS_GLXGETPROCADDRESSEXT)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(_GLFW_USE_LINUX_JOYSTICKS 1) set(_GLFW_USE_LINUX_JOYSTICKS 1)
endif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") endif()
endif(UNIX AND NOT APPLE) endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Set up GLFW for Cocoa and NSOpenGL on Mac OS X # Set up GLFW for Cocoa and NSOpenGL on Mac OS X
@ -121,7 +118,7 @@ if (UNIX AND APPLE)
set(CMAKE_C_FLAGS "-mmacosx-version-min=10.5") set(CMAKE_C_FLAGS "-mmacosx-version-min=10.5")
else(GLFW_BUILD_UNIVERSAL) else(GLFW_BUILD_UNIVERSAL)
message(STATUS "Building GLFW only for the native architecture") message(STATUS "Building GLFW only for the native architecture")
endif(GLFW_BUILD_UNIVERSAL) endif()
# Set up library and include paths # Set up library and include paths
find_library(COCOA_FRAMEWORK Cocoa) find_library(COCOA_FRAMEWORK Cocoa)
@ -131,7 +128,7 @@ if (UNIX AND APPLE)
list(APPEND GLFW_LIBRARIES ${OPENGL_gl_LIBRARY}) list(APPEND GLFW_LIBRARIES ${OPENGL_gl_LIBRARY})
list(APPEND GLFW_LIBRARIES ${IOKIT_FRAMEWORK}) list(APPEND GLFW_LIBRARIES ${IOKIT_FRAMEWORK})
list(APPEND GLFW_LIBRARIES ${CORE_FOUNDATION_FRAMEWORK}) list(APPEND GLFW_LIBRARIES ${CORE_FOUNDATION_FRAMEWORK})
endif(UNIX AND APPLE) endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Add subdirectories # Add subdirectories
@ -140,11 +137,11 @@ add_subdirectory(src)
if (GLFW_BUILD_EXAMPLES) if (GLFW_BUILD_EXAMPLES)
add_subdirectory(examples) add_subdirectory(examples)
endif(GLFW_BUILD_EXAMPLES) endif()
if (GLFW_BUILD_TESTS) if (GLFW_BUILD_TESTS)
add_subdirectory(tests) add_subdirectory(tests)
endif(GLFW_BUILD_TESTS) endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Create shared configuration header # Create shared configuration header
@ -162,7 +159,7 @@ install(DIRECTORY include/GL DESTINATION include
install(FILES COPYING.txt readme.html install(FILES COPYING.txt readme.html
DESTINATION share/doc/glfw-${GLFW_VERSION_FULL}/) DESTINATION share/doc/glfw-${GLFW_VERSION_FULL}/)
# The respective port's CMakeLists.txt file installs the library # The src directory's CMakeLists.txt file installs the library
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# -- Documentation generation # -- Documentation generation

View File

@ -14,7 +14,7 @@ if(APPLE)
add_executable("Split View" MACOSX_BUNDLE splitview.c) add_executable("Split View" MACOSX_BUNDLE splitview.c)
add_executable(Triangle MACOSX_BUNDLE triangle.c) add_executable(Triangle MACOSX_BUNDLE triangle.c)
add_executable(Wave MACOSX_BUNDLE wave.c) add_executable(Wave MACOSX_BUNDLE wave.c)
else(APPLE) else()
# Set boring names for executables # Set boring names for executables
add_executable(boing WIN32 boing.c) add_executable(boing WIN32 boing.c)
add_executable(gears WIN32 gears.c) add_executable(gears WIN32 gears.c)
@ -22,7 +22,7 @@ else(APPLE)
add_executable(splitview WIN32 splitview.c) add_executable(splitview WIN32 splitview.c)
add_executable(triangle WIN32 triangle.c) add_executable(triangle WIN32 triangle.c)
add_executable(wave WIN32 wave.c) add_executable(wave WIN32 wave.c)
endif(APPLE) endif()
set(WINDOWS_BINARIES boing gears heightmap splitview triangle wave) set(WINDOWS_BINARIES boing gears heightmap splitview triangle wave)
@ -30,5 +30,5 @@ if(MSVC)
# Tell MSVC to use main instead of WinMain for Windows subsystem executables # Tell MSVC to use main instead of WinMain for Windows subsystem executables
set_target_properties(${WINDOWS_BINARIES} PROPERTIES set_target_properties(${WINDOWS_BINARIES} PROPERTIES
LINK_FLAGS "/ENTRY:mainCRTStartup") LINK_FLAGS "/ENTRY:mainCRTStartup")
endif(MSVC) endif()

View File

@ -136,10 +136,6 @@ extern "C" {
/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
/* Include the declaration of the size_t type used below.
*/
#include <stddef.h>
/* Include standard OpenGL headers: GLFW uses GL_FALSE/GL_TRUE, and it is /* Include standard OpenGL headers: GLFW uses GL_FALSE/GL_TRUE, and it is
* convenient for the user to only have to include <GL/glfw.h>. This also * convenient for the user to only have to include <GL/glfw.h>. This also
* solves the problem with Windows <GL/gl.h> and <GL/glu.h> needing some * solves the problem with Windows <GL/gl.h> and <GL/glu.h> needing some

View File

@ -316,6 +316,7 @@ version of GLFW.</p>
<li>[Cocoa] Bugfix: The loop condition for saving video modes used the wrong index variable</li> <li>[Cocoa] Bugfix: The loop condition for saving video modes used the wrong index variable</li>
<li>[Cocoa] Bugfix: The OpenGL framework was not retrieved, making glfwGetProcAddress crash</li> <li>[Cocoa] Bugfix: The OpenGL framework was not retrieved, making glfwGetProcAddress crash</li>
<li>[Cocoa] Bugfix: <code>glfwInit</code> changed the current directory for unbundled executables</li> <li>[Cocoa] Bugfix: <code>glfwInit</code> changed the current directory for unbundled executables</li>
<li>[Cocoa] Bugfix: The <code>GLFW_WINDOW_NO_RESIZE</code> window parameter was always zero</li>
<li>[X11] Added support for the <code>GLX_EXT_swap_control</code> extension as an alternative to <code>GLX_SGI_swap_control</code></li> <li>[X11] Added support for the <code>GLX_EXT_swap_control</code> extension as an alternative to <code>GLX_SGI_swap_control</code></li>
<li>[X11] Added the POSIX <code>CLOCK_MONOTONIC</code> time source as the preferred method</li> <li>[X11] Added the POSIX <code>CLOCK_MONOTONIC</code> time source as the preferred method</li>
<li>[X11] Added dependency on libm, where present</li> <li>[X11] Added dependency on libm, where present</li>
@ -329,6 +330,7 @@ version of GLFW.</p>
<li>[Win32] Bugfix: Software rasterizer pixel formats were not discarded by the WGL_ARB_pixel_format code path</li> <li>[Win32] Bugfix: Software rasterizer pixel formats were not discarded by the WGL_ARB_pixel_format code path</li>
<li>[Win32] Bugfix: The array for WGL context attributes was too small and could overflow</li> <li>[Win32] Bugfix: The array for WGL context attributes was too small and could overflow</li>
<li>[Win32] Bugfix: Alt+F4 hot key was not translated into <code>WM_CLOSE</code></li> <li>[Win32] Bugfix: Alt+F4 hot key was not translated into <code>WM_CLOSE</code></li>
<li>[Win32] Bugfix: The <code>GLFW_WINDOW_NO_RESIZE</code> window parameter was always zero</li>
</ul> </ul>
<h3>v2.7</h3> <h3>v2.7</h3>
@ -870,7 +872,8 @@ their skills. Special thanks go out to:</p>
<li>Tristam MacDonald, for his bug reports and feedback on the Cocoa port</li> <li>Tristam MacDonald, for his bug reports and feedback on the Cocoa port</li>
<li>Hans 'Hanmac' Mackowiak, for adding UTF-8 window title support on X11</li> <li>Hans 'Hanmac' Mackowiak, for adding UTF-8 window title support on X11 and
a fix for the Xkb support</li>
<li>David Medlock, for doing the initial Lua port</li> <li>David Medlock, for doing the initial Lua port</li>

View File

@ -2,14 +2,14 @@
if(UNIX) if(UNIX)
if (_GLFW_HAS_XRANDR) if (_GLFW_HAS_XRANDR)
set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xrandr") set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xrandr")
endif(_GLFW_HAS_XRANDR) endif()
if (_GLFW_HAS_XF86VIDMODE) if (_GLFW_HAS_XF86VIDMODE)
set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xxf86vm") set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xxf86vm")
endif(_GLFW_HAS_XF86VIDMODE) endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libglfw.pc.cmake configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libglfw.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc @ONLY) ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc DESTINATION lib/pkgconfig) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc DESTINATION lib/pkgconfig)
endif(UNIX) endif()
include_directories(${GLFW_SOURCE_DIR}/src include_directories(${GLFW_SOURCE_DIR}/src
${GLFW_BINARY_DIR}/src ${GLFW_BINARY_DIR}/src
@ -37,7 +37,7 @@ elseif(_GLFW_X11_GLX)
x11_window.c) x11_window.c)
else() else()
message(FATAL_ERROR "No supported platform was selected") message(FATAL_ERROR "No supported platform was selected")
endif(_GLFW_COCOA_NSGL) endif()
add_library(libglfwStatic STATIC ${libglfw_SOURCES}) add_library(libglfwStatic STATIC ${libglfw_SOURCES})
add_library(libglfwShared SHARED ${libglfw_SOURCES}) add_library(libglfwShared SHARED ${libglfw_SOURCES})
@ -47,22 +47,23 @@ set_target_properties(libglfwStatic libglfwShared PROPERTIES
OUTPUT_NAME glfw) OUTPUT_NAME glfw)
if(WIN32) if(WIN32)
target_link_libraries(libglfwShared winmm)
# The GLFW DLL needs a special compile-time macro and import library name # The GLFW DLL needs a special compile-time macro and import library name
set_target_properties(libglfwShared PROPERTIES set_target_properties(libglfwShared PROPERTIES
DEFINE_SYMBOL GLFW_BUILD_DLL COMPILE_DEFINITIONS "GLFW_BUILD_DLL;_GLFW_NO_DLOAD_GDI32;_GLFW_NO_DLOAD_WINMM"
PREFIX "" PREFIX ""
IMPORT_PREFIX "" IMPORT_PREFIX ""
IMPORT_SUFFIX "dll.lib") IMPORT_SUFFIX "dll.lib")
endif(WIN32) endif()
if(APPLE) if(APPLE)
# Append -fno-common to the compile flags to work around a bug in the Apple GCC # Append -fno-common to the compile flags to work around a bug in the Apple GCC
get_target_property(CFLAGS libglfwShared COMPILE_FLAGS) get_target_property(CFLAGS libglfwShared COMPILE_FLAGS)
if (NOT CFLAGS) if (NOT CFLAGS)
set(CFLAGS "") set(CFLAGS "")
endif(NOT CFLAGS) endif()
set_target_properties(libglfwShared PROPERTIES COMPILE_FLAGS "${CFLAGS} -fno-common") set_target_properties(libglfwShared PROPERTIES COMPILE_FLAGS "${CFLAGS} -fno-common")
endif(APPLE) endif()
install(TARGETS libglfwStatic libglfwShared DESTINATION lib) install(TARGETS libglfwStatic libglfwShared DESTINATION lib)

View File

@ -814,6 +814,8 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
if (!initializeAppKit()) if (!initializeAppKit())
return GL_FALSE; return GL_FALSE;
window->resizable = wndconfig->resizable;
// We can only have one application delegate, but we only allocate it the // We can only have one application delegate, but we only allocate it the
// first time we create a window to keep all window code in this file // first time we create a window to keep all window code in this file
if (_glfwLibrary.NS.delegate == nil) if (_glfwLibrary.NS.delegate == nil)

View File

@ -60,11 +60,6 @@
// Define this to 1 if the Linux joystick API is available // Define this to 1 if the Linux joystick API is available
#cmakedefine _GLFW_USE_LINUX_JOYSTICKS 1 #cmakedefine _GLFW_USE_LINUX_JOYSTICKS 1
// Define this to 1 to not load gdi32.dll dynamically
#cmakedefine _GLFW_NO_DLOAD_GDI32 1
// Define this to 1 to not load winmm.dll dynamically
#cmakedefine _GLFW_NO_DLOAD_WINMM 1
// The GLFW version as used by glfwGetVersionString // The GLFW version as used by glfwGetVersionString
#define _GLFW_VERSION_FULL "@GLFW_VERSION_FULL@" #define _GLFW_VERSION_FULL "@GLFW_VERSION_FULL@"

View File

@ -1441,6 +1441,7 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
GLboolean recreateContext = GL_FALSE; GLboolean recreateContext = GL_FALSE;
window->Win32.desiredRefreshRate = wndconfig->refreshRate; window->Win32.desiredRefreshRate = wndconfig->refreshRate;
window->resizable = wndconfig->resizable;
if (!_glfwLibrary.Win32.classAtom) if (!_glfwLibrary.Win32.classAtom)
{ {

View File

@ -79,7 +79,11 @@ static int keyCodeToGLFWKeyCode(int keyCode)
// Note: This way we always force "NumLock = ON", which is intentional // Note: This way we always force "NumLock = ON", which is intentional
// since the returned key code should correspond to a physical // since the returned key code should correspond to a physical
// location. // location.
#if defined(_GLFW_HAS_XKB)
keySym = XkbKeycodeToKeysym(_glfwLibrary.X11.display, keyCode, 1, 0);
#else
keySym = XKeycodeToKeysym(_glfwLibrary.X11.display, keyCode, 1); keySym = XKeycodeToKeysym(_glfwLibrary.X11.display, keyCode, 1);
#endif
switch (keySym) switch (keySym)
{ {
case XK_KP_0: return GLFW_KEY_KP_0; case XK_KP_0: return GLFW_KEY_KP_0;
@ -102,7 +106,12 @@ static int keyCodeToGLFWKeyCode(int keyCode)
// Now try pimary keysym for function keys (non-printable keys). These // Now try pimary keysym for function keys (non-printable keys). These
// should not be layout dependent (i.e. US layout and international // should not be layout dependent (i.e. US layout and international
// layouts should give the same result). // layouts should give the same result).
#if defined(_GLFW_HAS_XKB)
keySym = XkbKeycodeToKeysym(_glfwLibrary.X11.display, keyCode, 0, 0);
#else
keySym = XKeycodeToKeysym(_glfwLibrary.X11.display, keyCode, 0); keySym = XKeycodeToKeysym(_glfwLibrary.X11.display, keyCode, 0);
#endif
switch (keySym) switch (keySym)
{ {
case XK_Escape: return GLFW_KEY_ESCAPE; case XK_Escape: return GLFW_KEY_ESCAPE;

View File

@ -65,5 +65,5 @@ if(MSVC)
# Tell MSVC to use main instead of WinMain for Windows subsystem executables # Tell MSVC to use main instead of WinMain for Windows subsystem executables
set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
LINK_FLAGS "/ENTRY:mainCRTStartup") LINK_FLAGS "/ENTRY:mainCRTStartup")
endif(MSVC) endif()