mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +00:00
Merge branch 'master' into cursor-enter-leave
This commit is contained in:
commit
466246670f
3
.gitignore
vendored
3
.gitignore
vendored
@ -10,6 +10,9 @@ src/libglfw.pc
|
||||
src/libglfw.so
|
||||
src/libglfw.a
|
||||
src/libglfw.dylib
|
||||
src/glfw.lib
|
||||
src/glfw.dll
|
||||
src/glfwdll.lib
|
||||
examples/boing
|
||||
examples/gears
|
||||
examples/heightmap
|
||||
|
15
CMake/linux-amd64-mingw32msvc.cmake
Normal file
15
CMake/linux-amd64-mingw32msvc.cmake
Normal file
@ -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)
|
166
CMakeLists.txt
166
CMakeLists.txt
@ -11,73 +11,109 @@ set(GLFW_VERSION_FULL "${GLFW_VERSION}.${GLFW_VERSION_PATCH}${GLFW_VERSION_EXTRA
|
||||
|
||||
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ON)
|
||||
option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON)
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Set up GLFW for Win32 and WGL on Windows
|
||||
# Enable all warnings on GCC, regardless of OS
|
||||
#--------------------------------------------------------------------
|
||||
if (CMAKE_COMPILER_IS_GNUCC)
|
||||
add_definitions(-Wall)
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Detect and select target platform
|
||||
#--------------------------------------------------------------------
|
||||
if (WIN32)
|
||||
message(STATUS "Building GLFW for WGL on a Win32 system")
|
||||
|
||||
# Define the platform identifier
|
||||
set(_GLFW_WIN32_WGL 1)
|
||||
message(STATUS "Building GLFW for WGL on a Win32 system")
|
||||
elseif (UNIX AND APPLE)
|
||||
set(_GLFW_COCOA_NSGL 1)
|
||||
message(STATUS "Building GLFW for Cocoa and NSOpenGL on Mac OS X")
|
||||
elseif (UNIX AND NOT APPLE)
|
||||
set(_GLFW_X11_GLX 1)
|
||||
message(STATUS "Building GLFW for X11 and GLX on a Unix-like system")
|
||||
else()
|
||||
message(FATAL_ERROR "No supported platform was detected")
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Set up GLFW for Win32 and WGL on Windows
|
||||
#--------------------------------------------------------------------
|
||||
if (_GLFW_WIN32_WGL)
|
||||
|
||||
# Set up library and include paths
|
||||
list(APPEND GLFW_INCLUDE_DIR ${OPENGL_INCLUDE_DIR})
|
||||
list(APPEND GLFW_LIBRARIES ${OPENGL_gl_LIBRARY})
|
||||
list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
|
||||
list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY})
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
list(APPEND glfw_LIBRARIES winmm)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Set up GLFW for Xlib and GLX on Unix-like systems with X Windows
|
||||
#--------------------------------------------------------------------
|
||||
if (UNIX AND NOT APPLE)
|
||||
message(STATUS "Building GLFW for X11 and GLX on a Unix-like system")
|
||||
|
||||
# Define the platform identifier
|
||||
set(_GLFW_X11_GLX 1)
|
||||
if (_GLFW_X11_GLX)
|
||||
|
||||
find_package(X11 REQUIRED)
|
||||
|
||||
# Set up library and include paths
|
||||
list(APPEND GLFW_INCLUDE_DIR ${X11_X11_INCLUDE_PATH} ${OPENGL_INCLUDE_DIR})
|
||||
list(APPEND GLFW_LIBRARIES ${X11_X11_LIB} ${OPENGL_gl_LIBRARY})
|
||||
list(APPEND glfw_INCLUDE_DIRS ${X11_X11_INCLUDE_PATH} ${OPENGL_INCLUDE_DIR})
|
||||
list(APPEND glfw_LIBRARIES ${X11_X11_LIB} ${OPENGL_gl_LIBRARY})
|
||||
|
||||
find_library(MATH_LIBRARY m)
|
||||
if (MATH_LIBRARY)
|
||||
list(APPEND GLFW_LIBRARIES ${MATH_LIBRARY})
|
||||
endif()
|
||||
|
||||
find_library(RT_LIBRARY rt)
|
||||
if (RT_LIBRARY)
|
||||
list(APPEND GLFW_LIBRARIES ${RT_LIBRARY})
|
||||
endif()
|
||||
set(GLFW_PKG_DEPS "gl x11")
|
||||
set(GLFW_PKG_LIBS "")
|
||||
|
||||
include(CheckFunctionExists)
|
||||
include(CheckSymbolExists)
|
||||
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${GLFW_LIBRARIES})
|
||||
|
||||
# Check for XRandR (modern resolution switching extension)
|
||||
if (X11_Xrandr_FOUND)
|
||||
set(_GLFW_HAS_XRANDR 1)
|
||||
list(APPEND GLFW_INCLUDE_DIR ${X11_Xrandr_INCLUDE_PATH})
|
||||
list(APPEND GLFW_LIBRARIES ${X11_Xrandr_LIB})
|
||||
list(APPEND glfw_INCLUDE_DIRS ${X11_Xrandr_INCLUDE_PATH})
|
||||
list(APPEND glfw_LIBRARIES ${X11_Xrandr_LIB})
|
||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xrandr")
|
||||
endif()
|
||||
|
||||
# Check for Xf86VidMode (fallback legacy resolution switching extension)
|
||||
if (X11_xf86vmode_FOUND)
|
||||
set(_GLFW_HAS_XF86VIDMODE 1)
|
||||
list(APPEND GLFW_INCLUDE_DIR ${X11_xf86vmode_INCLUDE_PATH})
|
||||
list(APPEND glfw_INCLUDE_DIRS ${X11_xf86vmode_INCLUDE_PATH})
|
||||
|
||||
# NOTE: This is a workaround for CMake bug 0006976 (missing
|
||||
# X11_xf86vmode_LIB variable)
|
||||
if (X11_xf86vmode_LIB)
|
||||
list(APPEND glfw_LIBRARIES ${X11_xf86vmode_LIB})
|
||||
else()
|
||||
list(APPEND glfw_LIBRARIES Xxf86vm)
|
||||
endif()
|
||||
|
||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xxf86vm")
|
||||
endif()
|
||||
|
||||
# Check for Xkb (X keyboard extension)
|
||||
if (X11_Xkb_FOUND)
|
||||
set(_GLFW_HAS_XKB 1)
|
||||
list(APPEND GLFW_INCLUDE_DIR ${X11_Xkb_INCLUDE_PATH})
|
||||
list(APPEND glfw_INCLUDE_DIR ${X11_Xkb_INCLUDE_PATH})
|
||||
endif()
|
||||
|
||||
# Check for glXGetProcAddress
|
||||
find_library(RT_LIBRARY rt)
|
||||
mark_as_advanced(RT_LIBRARY)
|
||||
if (RT_LIBRARY)
|
||||
list(APPEND glfw_LIBRARIES ${RT_LIBRARY})
|
||||
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -lrt")
|
||||
endif()
|
||||
|
||||
find_library(MATH_LIBRARY m)
|
||||
mark_as_advanced(MATH_LIBRARY)
|
||||
if (MATH_LIBRARY)
|
||||
list(APPEND glfw_LIBRARIES ${MATH_LIBRARY})
|
||||
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -lm")
|
||||
endif()
|
||||
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${OPENGL_gl_LIBRARY})
|
||||
|
||||
check_function_exists(glXGetProcAddress _GLFW_HAS_GLXGETPROCADDRESS)
|
||||
|
||||
if (NOT _GLFW_HAS_GLXGETPROCADDRESS)
|
||||
@ -92,6 +128,27 @@ if (UNIX AND NOT APPLE)
|
||||
NOT _GLFW_HAS_GLXGETPROCADDRESSARB AND
|
||||
NOT _GLFW_HAS_GLXGETPROCADDRESSEXT)
|
||||
message(WARNING "No glXGetProcAddressXXX variant found")
|
||||
|
||||
# Check for dlopen support as a fallback
|
||||
|
||||
find_library(DL_LIBRARY dl)
|
||||
mark_as_advanced(DL_LIBRARY)
|
||||
if (DL_LIBRARY)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${DL_LIBRARY})
|
||||
else()
|
||||
set(CMAKE_REQUIRED_LIBRARIES "")
|
||||
endif()
|
||||
|
||||
check_function_exists(dlopen _GLFW_HAS_DLOPEN)
|
||||
|
||||
if (NOT _GLFW_HAS_DLOPEN)
|
||||
message(FATAL_ERROR "No entry point retrieval mechanism found")
|
||||
endif()
|
||||
|
||||
if (DL_LIBRARY)
|
||||
list(APPEND glfw_LIBRARIES ${DL_LIBRARY})
|
||||
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -ldl")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
@ -102,13 +159,9 @@ endif()
|
||||
#--------------------------------------------------------------------
|
||||
# Set up GLFW for Cocoa and NSOpenGL on Mac OS X
|
||||
#--------------------------------------------------------------------
|
||||
if (UNIX AND APPLE)
|
||||
message(STATUS "Building GLFW for Cocoa and NSOpenGL on Mac OS X")
|
||||
if (_GLFW_COCOA_NSGL)
|
||||
|
||||
# Define the platform identifier
|
||||
set(_GLFW_COCOA_NSGL 1)
|
||||
|
||||
option(GLFW_BUILD_UNIVERSAL "Build the GLFW library and examples as Universal Binaries" FALSE)
|
||||
option(GLFW_BUILD_UNIVERSAL "Build GLFW as a Universal Binary" OFF)
|
||||
|
||||
# Universal build
|
||||
if (GLFW_BUILD_UNIVERSAL)
|
||||
@ -124,12 +177,20 @@ if (UNIX AND APPLE)
|
||||
find_library(COCOA_FRAMEWORK Cocoa)
|
||||
find_library(IOKIT_FRAMEWORK IOKit)
|
||||
find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation)
|
||||
list(APPEND GLFW_LIBRARIES ${COCOA_FRAMEWORK})
|
||||
list(APPEND GLFW_LIBRARIES ${OPENGL_gl_LIBRARY})
|
||||
list(APPEND GLFW_LIBRARIES ${IOKIT_FRAMEWORK})
|
||||
list(APPEND GLFW_LIBRARIES ${CORE_FOUNDATION_FRAMEWORK})
|
||||
list(APPEND glfw_LIBRARIES ${COCOA_FRAMEWORK}
|
||||
${OPENGL_gl_LIBRARY}
|
||||
${IOKIT_FRAMEWORK}
|
||||
${CORE_FOUNDATION_FRAMEWORK})
|
||||
|
||||
set(GLFW_PKG_DEPS "")
|
||||
set(GLFW_PKG_LIBS "-framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation")
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Export GLFW library dependencies
|
||||
#--------------------------------------------------------------------
|
||||
set(GLFW_LIBRARIES ${glfw_LIBRARIES} CACHE STRING "Dependencies of GLFW")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Add subdirectories
|
||||
#--------------------------------------------------------------------
|
||||
@ -144,29 +205,34 @@ if (GLFW_BUILD_TESTS)
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Create shared configuration header
|
||||
# Create generated files
|
||||
#--------------------------------------------------------------------
|
||||
configure_file(${GLFW_SOURCE_DIR}/docs/Doxyfile.in
|
||||
${GLFW_BINARY_DIR}/docs/Doxyfile @ONLY)
|
||||
|
||||
configure_file(${GLFW_SOURCE_DIR}/src/config.h.in
|
||||
${GLFW_BINARY_DIR}/src/config.h @ONLY)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Install standard files
|
||||
# Install header and documentation
|
||||
# The src directory's CMakeLists.txt file installs the library
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
install(DIRECTORY include/GL DESTINATION include
|
||||
FILES_MATCHING PATTERN glfw3.h)
|
||||
|
||||
install(FILES COPYING.txt readme.html
|
||||
DESTINATION share/doc/glfw-${GLFW_VERSION_FULL}/)
|
||||
|
||||
# The src directory's CMakeLists.txt file installs the library
|
||||
DESTINATION share/doc/glfw-${GLFW_VERSION_FULL})
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# -- Documentation generation
|
||||
# Create and install pkg-config file on supported platforms
|
||||
#--------------------------------------------------------------------
|
||||
configure_file("${GLFW_SOURCE_DIR}/docs/Doxyfile.in"
|
||||
"${GLFW_BINARY_DIR}/docs/Doxyfile"
|
||||
@ONLY)
|
||||
if (_GLFW_X11_GLX OR _GLFW_COCOA_NSGL)
|
||||
configure_file(${GLFW_SOURCE_DIR}/src/libglfw.pc.in
|
||||
${GLFW_BINARY_DIR}/src/libglfw.pc @ONLY)
|
||||
|
||||
install(FILES ${GLFW_BINARY_DIR}/src/libglfw.pc
|
||||
DESTINATION lib/pkgconfig)
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Uninstall operation
|
||||
|
@ -1,7 +1,12 @@
|
||||
# This line is used to link with static libraries
|
||||
# Note that the library list should be updated to be obtained from
|
||||
# the main CMakeLists.txt
|
||||
link_libraries(libglfwStatic ${GLFW_LIBRARIES} ${OPENGL_glu_LIBRARY})
|
||||
|
||||
link_libraries(glfw ${OPENGL_glu_LIBRARY})
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
add_definitions(-DGLFW_DLL)
|
||||
link_libraries(${OPENGL_gl_LIBRARY})
|
||||
else()
|
||||
link_libraries(${glfw_LIBRARIES})
|
||||
endif()
|
||||
|
||||
include_directories(${GLFW_SOURCE_DIR}/include
|
||||
${GLFW_SOURCE_DIR}/support
|
||||
|
@ -67,6 +67,12 @@ extern "C" {
|
||||
#endif
|
||||
#endif /* APIENTRY */
|
||||
|
||||
/* TEMPORARY MinGW-w64 hacks.
|
||||
*/
|
||||
#if __MINGW64__
|
||||
#define WINAPI
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
/* The following three defines are here solely to make some Windows-based
|
||||
* <GL/gl.h> files happy. Theoretically we could include <windows.h>, but
|
||||
@ -113,7 +119,11 @@ extern "C" {
|
||||
|
||||
/* ---------------- GLFW related system specific defines ----------------- */
|
||||
|
||||
#if defined(_WIN32) && defined(GLFW_BUILD_DLL)
|
||||
#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
|
||||
#error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
|
||||
|
||||
/* We are building a Win32 DLL */
|
||||
#define GLFWAPI __declspec(dllexport)
|
||||
|
@ -279,7 +279,6 @@ version of GLFW.</p>
|
||||
<li>Added <code>GLFW_INCLUDE_GL3</code> macro for telling the GLFW header to include <code>gl3.h</code> header instead of <code>gl.h</code></li>
|
||||
<li>Added <code>windows</code> simple multi-window test program</li>
|
||||
<li>Added <code>sharing</code> simple OpenGL object sharing test program</li>
|
||||
<li>Added <code>dynamic</code> simple dynamic linking test program</li>
|
||||
<li>Added <code>modes</code> video mode enumeration and setting test program</li>
|
||||
<li>Added a parameter to <code>glfwOpenWindow</code> for specifying a context the new window's context will share objects with</li>
|
||||
<li>Added initial window title parameter to <code>glfwOpenWindow</code></li>
|
||||
@ -289,6 +288,7 @@ version of GLFW.</p>
|
||||
<li>Renamed <code>glfw.h</code> to <code>glfw3.h</code> to avoid conflicts with 2.x series</li>
|
||||
<li>Renamed <code>GLFW_WINDOW</code> token to <code>GLFW_WINDOWED</code></li>
|
||||
<li>Renamed <code>GLFW_WINDOW_NO_RESIZE</code> to <code>GLFW_WINDOW_RESIZABLE</code></li>
|
||||
<li>Renamed <code>GLFW_BUILD_DLL</code> to <code>_GLFW_BUILD_DLL</code></li>
|
||||
<li>Renamed <code>version</code> test to <code>glfwinfo</code></li>
|
||||
<li>Replaced ad hoc build system with CMake</li>
|
||||
<li>Replaced layout-dependent key codes with single, platform-independent set based on US layout</li>
|
||||
|
@ -1,69 +1,54 @@
|
||||
|
||||
if(UNIX)
|
||||
if (_GLFW_HAS_XRANDR)
|
||||
set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xrandr")
|
||||
endif()
|
||||
if (_GLFW_HAS_XF86VIDMODE)
|
||||
set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xxf86vm")
|
||||
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()
|
||||
|
||||
include_directories(${GLFW_SOURCE_DIR}/src
|
||||
${GLFW_BINARY_DIR}/src
|
||||
${GLFW_INCLUDE_DIR})
|
||||
${glfw_INCLUDE_DIRS})
|
||||
|
||||
set(common_SOURCES error.c fullscreen.c gamma.c init.c input.c
|
||||
joystick.c opengl.c time.c window.c)
|
||||
|
||||
if(_GLFW_COCOA_NSGL)
|
||||
set(libglfw_SOURCES ${common_SOURCES} cocoa_fullscreen.m cocoa_gamma.c
|
||||
cocoa_init.m cocoa_input.m cocoa_joystick.m
|
||||
cocoa_opengl.m cocoa_time.c cocoa_window.m)
|
||||
if (_GLFW_COCOA_NSGL)
|
||||
set(glfw_SOURCES ${common_SOURCES} cocoa_fullscreen.m cocoa_gamma.c
|
||||
cocoa_init.m cocoa_input.m cocoa_joystick.m
|
||||
cocoa_opengl.m cocoa_time.c cocoa_window.m)
|
||||
|
||||
# For some reason, CMake doesn't know about .m
|
||||
set_source_files_properties(${libglfw_SOURCES} PROPERTIES LANGUAGE C)
|
||||
elseif(_GLFW_WIN32_WGL)
|
||||
set(libglfw_SOURCES ${common_SOURCES} win32_fullscreen.c win32_gamma.c
|
||||
win32_init.c win32_input.c win32_joystick.c
|
||||
win32_opengl.c win32_time.c win32_window.c
|
||||
win32_dllmain.c)
|
||||
elseif(_GLFW_X11_GLX)
|
||||
set(libglfw_SOURCES ${common_SOURCES} x11_fullscreen.c x11_gamma.c
|
||||
x11_init.c x11_input.c x11_joystick.c
|
||||
x11_keysym2unicode.c x11_opengl.c x11_time.c
|
||||
x11_window.c)
|
||||
else()
|
||||
message(FATAL_ERROR "No supported platform was selected")
|
||||
set_source_files_properties(${glfw_SOURCES} PROPERTIES LANGUAGE C)
|
||||
elseif (_GLFW_WIN32_WGL)
|
||||
set(glfw_SOURCES ${common_SOURCES} win32_fullscreen.c win32_gamma.c
|
||||
win32_init.c win32_input.c win32_joystick.c
|
||||
win32_opengl.c win32_time.c win32_window.c
|
||||
win32_dllmain.c)
|
||||
elseif (_GLFW_X11_GLX)
|
||||
set(glfw_SOURCES ${common_SOURCES} x11_fullscreen.c x11_gamma.c
|
||||
x11_init.c x11_input.c x11_joystick.c
|
||||
x11_keysym2unicode.c x11_opengl.c x11_time.c
|
||||
x11_window.c)
|
||||
endif()
|
||||
|
||||
add_library(libglfwStatic STATIC ${libglfw_SOURCES})
|
||||
add_library(libglfwShared SHARED ${libglfw_SOURCES})
|
||||
target_link_libraries(libglfwShared ${GLFW_LIBRARIES})
|
||||
set_target_properties(libglfwStatic libglfwShared PROPERTIES
|
||||
CLEAN_DIRECT_OUTPUT 1
|
||||
OUTPUT_NAME glfw)
|
||||
add_library(glfw ${glfw_SOURCES})
|
||||
|
||||
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
|
||||
COMPILE_DEFINITIONS "GLFW_BUILD_DLL;_GLFW_NO_DLOAD_GDI32;_GLFW_NO_DLOAD_WINMM"
|
||||
PREFIX ""
|
||||
IMPORT_PREFIX ""
|
||||
IMPORT_SUFFIX "dll.lib")
|
||||
endif()
|
||||
if (BUILD_SHARED_LIBS)
|
||||
|
||||
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 "")
|
||||
if (_GLFW_WIN32_WGL)
|
||||
# The GLFW DLL needs a special compile-time macro and import library name
|
||||
set_target_properties(glfw PROPERTIES
|
||||
COMPILE_DEFINITIONS "_GLFW_BUILD_DLL;_GLFW_NO_DLOAD_GDI32;_GLFW_NO_DLOAD_WINMM"
|
||||
PREFIX ""
|
||||
IMPORT_PREFIX ""
|
||||
IMPORT_SUFFIX "dll.lib")
|
||||
elseif (_GLFW_COCOA_NSGL)
|
||||
# Append -fno-common to the compile flags to work around a bug in the Apple GCC
|
||||
get_target_property(glfw_CFLAGS glfw COMPILE_FLAGS)
|
||||
if (NOT glfw_CFLAGS)
|
||||
set(glfw_CFLAGS "")
|
||||
endif()
|
||||
set_target_properties(glfw PROPERTIES
|
||||
COMPILE_FLAGS "${glfw_CFLAGS} -fno-common")
|
||||
endif()
|
||||
set_target_properties(libglfwShared PROPERTIES COMPILE_FLAGS "${CFLAGS} -fno-common")
|
||||
|
||||
target_link_libraries(glfw ${glfw_LIBRARIES})
|
||||
target_link_libraries(glfw LINK_INTERFACE_LIBRARIES)
|
||||
endif()
|
||||
|
||||
install(TARGETS libglfwStatic libglfwShared DESTINATION lib)
|
||||
install(TARGETS glfw DESTINATION lib)
|
||||
|
||||
|
@ -728,7 +728,7 @@ static GLboolean createContext(_GLFWwindow* window,
|
||||
#define ADD_ATTR2(x, y) { ADD_ATTR(x); ADD_ATTR(y); }
|
||||
|
||||
// Arbitrary array size here
|
||||
NSOpenGLPixelFormatAttribute attributes[24];
|
||||
NSOpenGLPixelFormatAttribute attributes[40];
|
||||
|
||||
ADD_ATTR(NSOpenGLPFADoubleBuffer);
|
||||
|
||||
|
@ -5,8 +5,9 @@ libdir=${exec_prefix}/lib
|
||||
|
||||
Name: GLFW
|
||||
Description: A portable library for OpenGL, window and input
|
||||
Version: 3.0.0
|
||||
Version: @GLFW_VERSION_FULL@
|
||||
URL: http://www.glfw.org/
|
||||
Requires.private: gl x11 @GLFW_PKGLIBS@
|
||||
Requires.private: @GLFW_PKG_DEPS@
|
||||
Libs: -L${libdir} -lglfw
|
||||
Libs.private: @GLFW_PKG_LIBS@
|
||||
Cflags: -I${includedir}
|
@ -31,7 +31,7 @@
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
#if defined(GLFW_BUILD_DLL)
|
||||
#if defined(_GLFW_BUILD_DLL)
|
||||
|
||||
//========================================================================
|
||||
// GLFW DLL entry point
|
||||
@ -45,5 +45,5 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif // GLFW_BUILD_DLL
|
||||
#endif // _GLFW_BUILD_DLL
|
||||
|
||||
|
@ -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;
|
||||
@ -271,7 +271,7 @@ const char* _glfwPlatformGetVersionString(void)
|
||||
#else
|
||||
" (unknown compiler)"
|
||||
#endif
|
||||
#if defined(GLFW_BUILD_DLL)
|
||||
#if defined(_GLFW_BUILD_DLL)
|
||||
" DLL"
|
||||
#endif
|
||||
#if !defined(_GLFW_NO_DLOAD_GDI32)
|
||||
|
@ -51,7 +51,9 @@
|
||||
#endif
|
||||
|
||||
// GLFW requires Windows XP
|
||||
#ifndef WINVER
|
||||
#define WINVER 0x0501
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
|
@ -34,30 +34,6 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Convert BPP to RGB bits based on "best guess"
|
||||
//========================================================================
|
||||
|
||||
static void bpp2rgb(int bpp, int* r, int* g, int* b)
|
||||
{
|
||||
int delta;
|
||||
|
||||
// We assume that by 32 they really meant 24
|
||||
if (bpp == 32)
|
||||
bpp = 24;
|
||||
|
||||
// Convert "bits per pixel" to red, green & blue sizes
|
||||
|
||||
*r = *g = *b = bpp / 3;
|
||||
delta = bpp - (*r * 3);
|
||||
if (delta >= 1)
|
||||
*g = *g + 1;
|
||||
|
||||
if (delta == 2)
|
||||
*r = *r + 1;
|
||||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Enable/disable minimize/restore animations
|
||||
//========================================================================
|
||||
@ -1620,29 +1596,10 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
|
||||
|
||||
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
||||
{
|
||||
//int bpp, refresh;
|
||||
int newMode = 0;
|
||||
GLboolean sizeChanged = GL_FALSE;
|
||||
|
||||
if (window->mode == GLFW_FULLSCREEN)
|
||||
{
|
||||
// Get some info about the current mode
|
||||
|
||||
DEVMODE dm;
|
||||
|
||||
dm.dmSize = sizeof(DEVMODE);
|
||||
//if (EnumDisplaySettings(NULL, window->Win32.modeID, &dm))
|
||||
//{
|
||||
// We need to keep BPP the same for the OpenGL context to keep working
|
||||
//bpp = dm.dmBitsPerPel;
|
||||
|
||||
// Get closest match for target video mode
|
||||
//refresh = window->Win32.desiredRefreshRate;
|
||||
//newMode = _glfwGetClosestVideoModeBPP(&width, &height, &bpp, &refresh);
|
||||
//}
|
||||
//else
|
||||
//newMode = window->Win32.modeID;
|
||||
|
||||
if (width > window->width || height > window->height)
|
||||
{
|
||||
// The new video mode is larger than the current one, so we resize
|
||||
@ -1654,8 +1611,7 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
||||
sizeChanged = GL_TRUE;
|
||||
}
|
||||
|
||||
//if (newMode != window->Win32.modeID)
|
||||
//_glfwSetVideoModeMODE(newMode);
|
||||
// TODO: Change video mode
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -323,7 +323,7 @@ struct _glfwResolution
|
||||
int _glfwPlatformGetVideoModes(GLFWvidmode* list, int maxcount)
|
||||
{
|
||||
int count, k, l, r, g, b, rgba, gl;
|
||||
int depth, screen;
|
||||
int depth, screen = DefaultScreen(_glfwLibrary.X11.display);
|
||||
XVisualInfo* vislist;
|
||||
XVisualInfo dummy;
|
||||
int viscount, rgbcount, rescount;
|
||||
|
@ -470,8 +470,8 @@ static void initGammaRamp(void)
|
||||
// RandR gamma support is only available with version 1.2 and above
|
||||
if (_glfwLibrary.X11.RandR.available &&
|
||||
(_glfwLibrary.X11.RandR.majorVersion > 1 ||
|
||||
_glfwLibrary.X11.RandR.majorVersion == 1 &&
|
||||
_glfwLibrary.X11.RandR.minorVersion >= 2))
|
||||
(_glfwLibrary.X11.RandR.majorVersion == 1 &&
|
||||
_glfwLibrary.X11.RandR.minorVersion >= 2)))
|
||||
{
|
||||
// FIXME: Assumes that all monitors have the same size gamma tables
|
||||
// This is reasonable as I suspect the that if they did differ, it
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
|
@ -1,68 +1,43 @@
|
||||
|
||||
set(STATIC_DEPS libglfwStatic ${GLFW_LIBRARIES} ${OPENGL_glu_LIBRARY})
|
||||
set(SHARED_DEPS libglfwShared ${GLFW_LIBRARIES} ${OPENGL_glu_LIBRARY})
|
||||
link_libraries(glfw ${OPENGL_glu_LIBRARY})
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
add_definitions(-DGLFW_DLL)
|
||||
link_libraries(${OPENGL_gl_LIBRARY})
|
||||
else()
|
||||
link_libraries(${glfw_LIBRARIES})
|
||||
endif()
|
||||
|
||||
include_directories(${GLFW_SOURCE_DIR}/include
|
||||
${GLFW_SOURCE_DIR}/support
|
||||
${OPENGL_INCLUDE_DIR})
|
||||
|
||||
add_executable(defaults defaults.c)
|
||||
target_link_libraries(defaults ${STATIC_DEPS})
|
||||
|
||||
add_executable(dynamic dynamic.c)
|
||||
target_link_libraries(dynamic ${SHARED_DEPS})
|
||||
|
||||
add_executable(events events.c)
|
||||
target_link_libraries(events ${STATIC_DEPS})
|
||||
|
||||
add_executable(fsaa fsaa.c getopt.c)
|
||||
target_link_libraries(fsaa ${STATIC_DEPS})
|
||||
|
||||
add_executable(fsfocus fsfocus.c)
|
||||
target_link_libraries(fsfocus ${STATIC_DEPS})
|
||||
|
||||
add_executable(gamma gamma.c getopt.c)
|
||||
target_link_libraries(gamma ${STATIC_DEPS})
|
||||
|
||||
add_executable(glfwinfo glfwinfo.c getopt.c)
|
||||
target_link_libraries(glfwinfo ${STATIC_DEPS})
|
||||
|
||||
add_executable(iconify iconify.c getopt.c)
|
||||
target_link_libraries(iconify ${STATIC_DEPS})
|
||||
|
||||
add_executable(joysticks joysticks.c)
|
||||
target_link_libraries(joysticks ${STATIC_DEPS})
|
||||
|
||||
add_executable(listmodes listmodes.c)
|
||||
target_link_libraries(listmodes ${STATIC_DEPS})
|
||||
|
||||
add_executable(modes modes.c getopt.c)
|
||||
target_link_libraries(modes ${STATIC_DEPS})
|
||||
|
||||
add_executable(peter peter.c)
|
||||
target_link_libraries(peter ${STATIC_DEPS})
|
||||
|
||||
add_executable(reopen reopen.c)
|
||||
target_link_libraries(reopen ${STATIC_DEPS})
|
||||
|
||||
add_executable(accuracy WIN32 MACOSX_BUNDLE accuracy.c)
|
||||
target_link_libraries(accuracy ${STATIC_DEPS})
|
||||
set_target_properties(accuracy PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Accuracy")
|
||||
|
||||
add_executable(sharing WIN32 MACOSX_BUNDLE sharing.c)
|
||||
target_link_libraries(sharing ${STATIC_DEPS})
|
||||
set_target_properties(sharing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Sharing")
|
||||
|
||||
add_executable(tearing WIN32 MACOSX_BUNDLE tearing.c)
|
||||
target_link_libraries(tearing ${STATIC_DEPS})
|
||||
set_target_properties(tearing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Tearing")
|
||||
|
||||
add_executable(title WIN32 MACOSX_BUNDLE title.c)
|
||||
target_link_libraries(title ${STATIC_DEPS})
|
||||
set_target_properties(title PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Title")
|
||||
|
||||
add_executable(windows WIN32 MACOSX_BUNDLE windows.c)
|
||||
target_link_libraries(windows ${STATIC_DEPS})
|
||||
set_target_properties(windows PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Windows")
|
||||
|
||||
set(WINDOWS_BINARIES accuracy sharing tearing title windows)
|
||||
|
@ -1,91 +0,0 @@
|
||||
//========================================================================
|
||||
// Dynamic linking test
|
||||
// Copyright (c) Camilla Berglund <elmindreda@elmindreda.org>
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would
|
||||
// be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such, and must not
|
||||
// be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
//
|
||||
// This test came about as the result of bug #3060461
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#define GLFW_DLL
|
||||
#include <GL/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
GLFWwindow window;
|
||||
int major, minor, rev;
|
||||
glfwGetVersion(&major, &minor, &rev);
|
||||
|
||||
printf("GLFW header version: %i.%i.%i\n",
|
||||
GLFW_VERSION_MAJOR,
|
||||
GLFW_VERSION_MINOR,
|
||||
GLFW_VERSION_REVISION);
|
||||
printf("GLFW library version: %i.%i.%i\n", major, minor, rev);
|
||||
printf("GLFW library version string: %s\n", glfwGetVersionString());
|
||||
|
||||
if (major != GLFW_VERSION_MAJOR ||
|
||||
minor != GLFW_VERSION_MINOR ||
|
||||
rev != GLFW_VERSION_REVISION)
|
||||
{
|
||||
fprintf(stderr, "GLFW library version mismatch\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
fprintf(stderr, "Failed to initialize GLFW\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
window = glfwOpenWindow(0, 0, GLFW_WINDOWED, "Dynamic Linking Test", NULL);
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
|
||||
fprintf(stderr, "Failed to open GLFW window\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
glfwSetWindowSizeCallback(window_size_callback);
|
||||
glfwSwapInterval(1);
|
||||
|
||||
while (glfwIsWindow(window))
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glfwSwapBuffers();
|
||||
glfwPollEvents();
|
||||
}
|
||||
|
||||
glfwTerminate();
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
@ -165,8 +165,6 @@ static void test_modes(GLFWvidmode* modes, int count)
|
||||
glfwCloseWindow(window);
|
||||
glfwPollEvents();
|
||||
window = NULL;
|
||||
|
||||
sleep(5);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user