diff --git a/CMake/README.txt b/CMake/README.txt index d24854ed..9581f832 100644 --- a/CMake/README.txt +++ b/CMake/README.txt @@ -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= . + +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 diff --git a/CMake/linux-mingw32msvc.cmake b/CMake/linux-i586-mingw32msvc.cmake similarity index 100% rename from CMake/linux-mingw32msvc.cmake rename to CMake/linux-i586-mingw32msvc.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e6554c5..f27cf7cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 @@ -175,7 +172,7 @@ configure_file("${GLFW_SOURCE_DIR}/docs/Doxyfile.in" # Uninstall operation # Don't generate this target if a higher-level project already has #-------------------------------------------------------------------- -if(NOT TARGET uninstall) +if (NOT TARGET uninstall) configure_file(${GLFW_SOURCE_DIR}/cmake_uninstall.cmake.in ${GLFW_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index d511b22d..37b7f754 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -7,14 +7,14 @@ include_directories(${GLFW_SOURCE_DIR}/include ${GLFW_SOURCE_DIR}/support ${OPENGL_INCLUDE_DIR}) -if(APPLE) +if (APPLE) # Set fancy names for bundles add_executable(Boing MACOSX_BUNDLE boing.c) add_executable(Gears MACOSX_BUNDLE gears.c) 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,13 +22,13 @@ 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) -if(MSVC) +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() diff --git a/include/GL/glfw3.h b/include/GL/glfw3.h index e84bdbba..cc817521 100644 --- a/include/GL/glfw3.h +++ b/include/GL/glfw3.h @@ -136,10 +136,6 @@ extern "C" { /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ -/* Include the declaration of the size_t type used below. - */ -#include - /* Include standard OpenGL headers: GLFW uses GL_FALSE/GL_TRUE, and it is * convenient for the user to only have to include . This also * solves the problem with Windows and needing some diff --git a/readme.html b/readme.html index 12f726bf..5943be58 100644 --- a/readme.html +++ b/readme.html @@ -316,6 +316,7 @@ version of GLFW.

  • [Cocoa] Bugfix: The loop condition for saving video modes used the wrong index variable
  • [Cocoa] Bugfix: The OpenGL framework was not retrieved, making glfwGetProcAddress crash
  • [Cocoa] Bugfix: glfwInit changed the current directory for unbundled executables
  • +
  • [Cocoa] Bugfix: The GLFW_WINDOW_NO_RESIZE window parameter was always zero
  • [X11] Added support for the GLX_EXT_swap_control extension as an alternative to GLX_SGI_swap_control
  • [X11] Added the POSIX CLOCK_MONOTONIC time source as the preferred method
  • [X11] Added dependency on libm, where present
  • @@ -329,6 +330,7 @@ version of GLFW.

  • [Win32] Bugfix: Software rasterizer pixel formats were not discarded by the WGL_ARB_pixel_format code path
  • [Win32] Bugfix: The array for WGL context attributes was too small and could overflow
  • [Win32] Bugfix: Alt+F4 hot key was not translated into WM_CLOSE
  • +
  • [Win32] Bugfix: The GLFW_WINDOW_NO_RESIZE window parameter was always zero
  • v2.7

    @@ -870,7 +872,8 @@ their skills. Special thanks go out to:

  • Tristam MacDonald, for his bug reports and feedback on the Cocoa port
  • -
  • Hans 'Hanmac' Mackowiak, for adding UTF-8 window title support on X11
  • +
  • Hans 'Hanmac' Mackowiak, for adding UTF-8 window title support on X11 and + a fix for the Xkb support
  • David Medlock, for doing the initial Lua port
  • diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b5569c40..bdc4d5fe 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,15 +1,15 @@ if(UNIX) - if(_GLFW_HAS_XRANDR) + if (_GLFW_HAS_XRANDR) set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xrandr") - endif(_GLFW_HAS_XRANDR) - if(_GLFW_HAS_XF86VIDMODE) + 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) + 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) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index c74138b3..239e883a 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -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) diff --git a/src/config.h.in b/src/config.h.in index f966356c..46a6e2aa 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -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@" diff --git a/src/win32_window.c b/src/win32_window.c index 24788a33..0f3c67d0 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -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) { diff --git a/src/x11_init.c b/src/x11_init.c index 4d3c0f74..3ed9ab13 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -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; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d7ac0954..58631603 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -61,9 +61,9 @@ set(WINDOWS_BINARIES accuracy sharing tearing title windows) set(CONSOLE_BINARIES defaults events fsaa fsfocus gamma glfwinfo iconify joysticks listmodes peter reopen) -if(MSVC) +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()