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
support cross compilation. The naming scheme is the following:
This directory contains a collection of toolchain definitions for cross
compilation, currently limited to compiling Win32 binaries on Linux.
The toolchain file naming scheme is as follows:
host-system-compiler.cmake
to use this at the time you run the initial cmake command use the
following parameter
-DCMAKE_TOOLCHAIN_FILE=./toolchains/XXX-XXX-XXX.cmake
which maps to file in this folder.
To use these files you add a special parameter when configuring the source tree:
cmake -DCMAKE_TOOLCHAIN_FILE=<toolchain-file> .
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)
cmake_minimum_required(VERSION 2.4)
cmake_policy(VERSION 2.4)
cmake_minimum_required(VERSION 2.8)
set(GLFW_VERSION_MAJOR "3")
set(GLFW_VERSION_MINOR "0")
@ -27,7 +26,7 @@ if (WIN32)
# Set up library and include paths
list(APPEND GLFW_INCLUDE_DIR ${OPENGL_INCLUDE_DIR})
list(APPEND GLFW_LIBRARIES ${OPENGL_gl_LIBRARY})
endif (WIN32)
endif()
#--------------------------------------------------------------------
# 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)
if (MATH_LIBRARY)
list(APPEND GLFW_LIBRARIES ${MATH_LIBRARY})
endif(MATH_LIBRARY)
endif()
find_library(RT_LIBRARY rt)
if (RT_LIBRARY)
list(APPEND GLFW_LIBRARIES ${RT_LIBRARY})
endif(RT_LIBRARY)
endif()
include(CheckFunctionExists)
include(CheckSymbolExists)
@ -83,24 +82,22 @@ if (UNIX AND NOT APPLE)
if (NOT _GLFW_HAS_GLXGETPROCADDRESS)
check_function_exists(glXGetProcAddressARB _GLFW_HAS_GLXGETPROCADDRESSARB)
endif (NOT _GLFW_HAS_GLXGETPROCADDRESS)
endif()
if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND NOT _GLFW_HAS_GLXGETPROCADDRESSARB)
check_function_exists(glXGetProcAddressEXT _GLFW_HAS_GLXGETPROCADDRESSEXT)
endif (NOT _GLFW_HAS_GLXGETPROCADDRESS AND NOT _GLFW_HAS_GLXGETPROCADDRESSARB)
endif()
if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND
NOT _GLFW_HAS_GLXGETPROCADDRESSARB AND
NOT _GLFW_HAS_GLXGETPROCADDRESSEXT)
message(WARNING "No glXGetProcAddressXXX variant found")
endif (NOT _GLFW_HAS_GLXGETPROCADDRESS AND
NOT _GLFW_HAS_GLXGETPROCADDRESSARB AND
NOT _GLFW_HAS_GLXGETPROCADDRESSEXT)
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(_GLFW_USE_LINUX_JOYSTICKS 1)
endif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
endif(UNIX AND NOT APPLE)
endif()
endif()
#--------------------------------------------------------------------
# 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")
else(GLFW_BUILD_UNIVERSAL)
message(STATUS "Building GLFW only for the native architecture")
endif(GLFW_BUILD_UNIVERSAL)
endif()
# Set up library and include paths
find_library(COCOA_FRAMEWORK Cocoa)
@ -131,7 +128,7 @@ if (UNIX AND APPLE)
list(APPEND GLFW_LIBRARIES ${OPENGL_gl_LIBRARY})
list(APPEND GLFW_LIBRARIES ${IOKIT_FRAMEWORK})
list(APPEND GLFW_LIBRARIES ${CORE_FOUNDATION_FRAMEWORK})
endif(UNIX AND APPLE)
endif()
#--------------------------------------------------------------------
# Add subdirectories
@ -140,11 +137,11 @@ add_subdirectory(src)
if (GLFW_BUILD_EXAMPLES)
add_subdirectory(examples)
endif(GLFW_BUILD_EXAMPLES)
endif()
if (GLFW_BUILD_TESTS)
add_subdirectory(tests)
endif(GLFW_BUILD_TESTS)
endif()
#--------------------------------------------------------------------
# Create shared configuration header
@ -162,7 +159,7 @@ install(DIRECTORY include/GL DESTINATION include
install(FILES COPYING.txt readme.html
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

View File

@ -14,7 +14,7 @@ if(APPLE)
add_executable("Split View" MACOSX_BUNDLE splitview.c)
add_executable(Triangle MACOSX_BUNDLE triangle.c)
add_executable(Wave MACOSX_BUNDLE wave.c)
else(APPLE)
else()
# Set boring names for executables
add_executable(boing WIN32 boing.c)
add_executable(gears WIN32 gears.c)
@ -22,7 +22,7 @@ else(APPLE)
add_executable(splitview WIN32 splitview.c)
add_executable(triangle WIN32 triangle.c)
add_executable(wave WIN32 wave.c)
endif(APPLE)
endif()
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
set_target_properties(${WINDOWS_BINARIES} PROPERTIES
LINK_FLAGS "/ENTRY:mainCRTStartup")
endif(MSVC)
endif()

View File

@ -136,10 +136,6 @@ extern "C" {
/* -------------------- 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
* 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

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 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: 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 the POSIX <code>CLOCK_MONOTONIC</code> time source as the preferred method</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: 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: The <code>GLFW_WINDOW_NO_RESIZE</code> window parameter was always zero</li>
</ul>
<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>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>

View File

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

View File

@ -814,6 +814,8 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
if (!initializeAppKit())
return GL_FALSE;
window->resizable = wndconfig->resizable;
// 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
if (_glfwLibrary.NS.delegate == nil)

View File

@ -60,11 +60,6 @@
// Define this to 1 if the Linux joystick API is available
#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
#define _GLFW_VERSION_FULL "@GLFW_VERSION_FULL@"

View File

@ -1441,6 +1441,7 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
GLboolean recreateContext = GL_FALSE;
window->Win32.desiredRefreshRate = wndconfig->refreshRate;
window->resizable = wndconfig->resizable;
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
// since the returned key code should correspond to a physical
// location.
#if defined(_GLFW_HAS_XKB)
keySym = XkbKeycodeToKeysym(_glfwLibrary.X11.display, keyCode, 1, 0);
#else
keySym = XKeycodeToKeysym(_glfwLibrary.X11.display, keyCode, 1);
#endif
switch (keySym)
{
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
// should not be layout dependent (i.e. US layout and international
// 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);
#endif
switch (keySym)
{
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
set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
LINK_FLAGS "/ENTRY:mainCRTStartup")
endif(MSVC)
endif()