From 0f93e8f25232d01645c6bf760c09c6f21e3f3c17 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 26 Jul 2011 15:16:34 +0200 Subject: [PATCH] Flattened source tree. --- CMakeLists.txt | 25 +-------- src/cocoa/CMakeLists.txt | 40 --------------- src/cocoa/libglfw.pc.cmake | 11 ---- src/{cocoa => }/cocoa_enable.m | 0 src/{cocoa => }/cocoa_fullscreen.m | 0 src/{cocoa => }/cocoa_gamma.m | 0 src/{cocoa => }/cocoa_init.m | 0 src/{cocoa => }/cocoa_joystick.m | 0 src/{cocoa => }/cocoa_opengl.m | 0 src/{cocoa/platform.h => cocoa_platform.h} | 0 src/{cocoa => }/cocoa_time.m | 0 src/{cocoa => }/cocoa_window.m | 0 src/internal.h | 15 ++++-- src/win32/CMakeLists.txt | 59 ---------------------- src/win32/libglfw.pc.cmake | 11 ---- src/{win32 => }/win32_dllmain.c | 0 src/{win32 => }/win32_enable.c | 0 src/{win32 => }/win32_fullscreen.c | 0 src/{win32 => }/win32_gamma.c | 0 src/{win32 => }/win32_init.c | 0 src/{win32 => }/win32_joystick.c | 0 src/{win32 => }/win32_opengl.c | 0 src/{win32/platform.h => win32_platform.h} | 0 src/{win32 => }/win32_time.c | 0 src/{win32 => }/win32_window.c | 0 src/x11/CMakeLists.txt | 30 ----------- src/x11/libglfw.pc.cmake | 11 ---- src/{x11 => }/x11_enable.c | 0 src/{x11 => }/x11_fullscreen.c | 0 src/{x11 => }/x11_gamma.c | 0 src/{x11 => }/x11_init.c | 0 src/{x11 => }/x11_joystick.c | 0 src/{x11 => }/x11_keysym2unicode.c | 0 src/{x11 => }/x11_opengl.c | 0 src/{x11/platform.h => x11_platform.h} | 0 src/{x11 => }/x11_time.c | 0 src/{x11 => }/x11_window.c | 0 37 files changed, 13 insertions(+), 189 deletions(-) delete mode 100644 src/cocoa/CMakeLists.txt delete mode 100644 src/cocoa/libglfw.pc.cmake rename src/{cocoa => }/cocoa_enable.m (100%) rename src/{cocoa => }/cocoa_fullscreen.m (100%) rename src/{cocoa => }/cocoa_gamma.m (100%) rename src/{cocoa => }/cocoa_init.m (100%) rename src/{cocoa => }/cocoa_joystick.m (100%) rename src/{cocoa => }/cocoa_opengl.m (100%) rename src/{cocoa/platform.h => cocoa_platform.h} (100%) rename src/{cocoa => }/cocoa_time.m (100%) rename src/{cocoa => }/cocoa_window.m (100%) delete mode 100644 src/win32/CMakeLists.txt delete mode 100644 src/win32/libglfw.pc.cmake rename src/{win32 => }/win32_dllmain.c (100%) rename src/{win32 => }/win32_enable.c (100%) rename src/{win32 => }/win32_fullscreen.c (100%) rename src/{win32 => }/win32_gamma.c (100%) rename src/{win32 => }/win32_init.c (100%) rename src/{win32 => }/win32_joystick.c (100%) rename src/{win32 => }/win32_opengl.c (100%) rename src/{win32/platform.h => win32_platform.h} (100%) rename src/{win32 => }/win32_time.c (100%) rename src/{win32 => }/win32_window.c (100%) delete mode 100644 src/x11/CMakeLists.txt delete mode 100644 src/x11/libglfw.pc.cmake rename src/{x11 => }/x11_enable.c (100%) rename src/{x11 => }/x11_fullscreen.c (100%) rename src/{x11 => }/x11_gamma.c (100%) rename src/{x11 => }/x11_init.c (100%) rename src/{x11 => }/x11_joystick.c (100%) rename src/{x11 => }/x11_keysym2unicode.c (100%) rename src/{x11 => }/x11_opengl.c (100%) rename src/{x11/platform.h => x11_platform.h} (100%) rename src/{x11 => }/x11_time.c (100%) rename src/{x11 => }/x11_window.c (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa2f01f0..f0c2eeef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,19 +15,6 @@ include(CheckSymbolExists) find_package(OpenGL REQUIRED) -set(common_SOURCES - ${GLFW_SOURCE_DIR}/src/enable.c - ${GLFW_SOURCE_DIR}/src/error.c - ${GLFW_SOURCE_DIR}/src/fullscreen.c - ${GLFW_SOURCE_DIR}/src/gamma.c - ${GLFW_SOURCE_DIR}/src/init.c - ${GLFW_SOURCE_DIR}/src/input.c - ${GLFW_SOURCE_DIR}/src/joystick.c - ${GLFW_SOURCE_DIR}/src/opengl.c - ${GLFW_SOURCE_DIR}/src/time.c - ${GLFW_SOURCE_DIR}/src/window.c -) - #-------------------------------------------------------------------- # Set up GLFW for Win32 and WGL on Windows #-------------------------------------------------------------------- @@ -41,9 +28,6 @@ if (WIN32) set(CMAKE_REQUIRED_LIBRARIES ${OPENGL_gl_LIBRARY}) list(APPEND GLFW_INCLUDE_DIR ${OPENGL_INCLUDE_DIR}) list(APPEND GLFW_LIBRARIES ${OPENGL_gl_LIBRARY}) - - # Select platform specific code - add_subdirectory(src/win32) endif (WIN32) #-------------------------------------------------------------------- @@ -105,9 +89,6 @@ if (UNIX AND NOT APPLE AND NOT CYGWIN) if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") set(_GLFW_USE_LINUX_JOYSTICKS 1) endif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - - # Select platform specific code - add_subdirectory(src/x11) endif(UNIX AND NOT APPLE AND NOT CYGWIN) #-------------------------------------------------------------------- @@ -135,14 +116,12 @@ if (UNIX AND APPLE) find_library(COCOA_FRAMEWORK Cocoa) list(APPEND GLFW_LIBRARIES ${COCOA_FRAMEWORK}) list(APPEND GLFW_LIBRARIES ${OPENGL_gl_LIBRARY}) - - # Select platform specific code - add_subdirectory(src/cocoa) endif(UNIX AND APPLE) #-------------------------------------------------------------------- -# Add example and test programs +# Add subdirectories #-------------------------------------------------------------------- +add_subdirectory(src) add_subdirectory(examples) add_subdirectory(tests) diff --git a/src/cocoa/CMakeLists.txt b/src/cocoa/CMakeLists.txt deleted file mode 100644 index f0bc3c4c..00000000 --- a/src/cocoa/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libglfw.pc.cmake - ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc @ONLY) - -include_directories(${CMAKE_CURRENT_SOURCE_DIR} - ${GLFW_SOURCE_DIR}/src - ${GLFW_BINARY_DIR}/src - ${GLFW_INCLUDE_DIR}) - -set(cocoa_SOURCES cocoa_enable.m - cocoa_fullscreen.m - cocoa_gamma.m - cocoa_init.m - cocoa_joystick.m - cocoa_opengl.m - cocoa_time.m - cocoa_window.m) - -# For some reason, CMake doesn't know about .m -set_source_files_properties(${cocoa_SOURCES} PROPERTIES LANGUAGE C) - -set(libglfw_SOURCES ${common_SOURCES} ${cocoa_SOURCES}) - -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) - -# 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) -set_target_properties(libglfwShared PROPERTIES COMPILE_FLAGS "${CFLAGS} -fno-common") - -install(TARGETS libglfwStatic libglfwShared DESTINATION lib) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc DESTINATION lib/pkgconfig) - diff --git a/src/cocoa/libglfw.pc.cmake b/src/cocoa/libglfw.pc.cmake deleted file mode 100644 index 37de53a3..00000000 --- a/src/cocoa/libglfw.pc.cmake +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@PREFIX@ -exec_prefix=@PREFIX@ -libdir=@PREFIX@/lib -includedir=@PREFIX@/include - -Name: GLFW -Description: A portable library for OpenGL development -Version: 3.0 -URL: http://www.glfw.org/ -Libs: -L${libdir} -lglfw -framework AGL -framework OpenGL -framework Carbon -Cflags: -I${includedir} diff --git a/src/cocoa/cocoa_enable.m b/src/cocoa_enable.m similarity index 100% rename from src/cocoa/cocoa_enable.m rename to src/cocoa_enable.m diff --git a/src/cocoa/cocoa_fullscreen.m b/src/cocoa_fullscreen.m similarity index 100% rename from src/cocoa/cocoa_fullscreen.m rename to src/cocoa_fullscreen.m diff --git a/src/cocoa/cocoa_gamma.m b/src/cocoa_gamma.m similarity index 100% rename from src/cocoa/cocoa_gamma.m rename to src/cocoa_gamma.m diff --git a/src/cocoa/cocoa_init.m b/src/cocoa_init.m similarity index 100% rename from src/cocoa/cocoa_init.m rename to src/cocoa_init.m diff --git a/src/cocoa/cocoa_joystick.m b/src/cocoa_joystick.m similarity index 100% rename from src/cocoa/cocoa_joystick.m rename to src/cocoa_joystick.m diff --git a/src/cocoa/cocoa_opengl.m b/src/cocoa_opengl.m similarity index 100% rename from src/cocoa/cocoa_opengl.m rename to src/cocoa_opengl.m diff --git a/src/cocoa/platform.h b/src/cocoa_platform.h similarity index 100% rename from src/cocoa/platform.h rename to src/cocoa_platform.h diff --git a/src/cocoa/cocoa_time.m b/src/cocoa_time.m similarity index 100% rename from src/cocoa/cocoa_time.m rename to src/cocoa_time.m diff --git a/src/cocoa/cocoa_window.m b/src/cocoa_window.m similarity index 100% rename from src/cocoa/cocoa_window.m rename to src/cocoa_window.m diff --git a/src/internal.h b/src/internal.h index 4a39b9c9..2c49aa2b 100644 --- a/src/internal.h +++ b/src/internal.h @@ -58,11 +58,18 @@ #include "config.h" -#include "../../include/GL/glfw3.h" -#include "../../include/GL/glext.h" - -#include "platform.h" +#include "../include/GL/glfw3.h" +#include "../include/GL/glext.h" +#if defined(_GLFW_COCOA_NSGL) +#include "cocoa_platform.h" +#elif defined(_GLFW_WIN32_WGL) +#include "win32_platform.h" +#elif defined(_GLFW_X11_GLX) +#include "x11_platform.h" +#else +#error "No supported platform selected" +#endif typedef struct _GLFWhints _GLFWhints; typedef struct _GLFWwndconfig _GLFWwndconfig; diff --git a/src/win32/CMakeLists.txt b/src/win32/CMakeLists.txt deleted file mode 100644 index 1220313d..00000000 --- a/src/win32/CMakeLists.txt +++ /dev/null @@ -1,59 +0,0 @@ - -if(CYGWIN) - - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libglfw.pc.cmake - ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc @ONLY) - -# These lines are intended to remove the --export-all-symbols -# flag added in the Modules/Platform/CYGWIN.cmake file of the -# CMake distribution. -# This is a HACK. If you have trouble _linking_ the GLFW -# _shared_ library on Cygwin, try disabling this. - set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") - set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) - -endif(CYGWIN) - -include_directories(${CMAKE_CURRENT_SOURCE_DIR} - ${GLFW_SOURCE_DIR}/src - ${GLFW_BINARY_DIR}/src - ${GLFW_INCLUDE_DIR}) - -set(libglfw_SOURCES ${common_SOURCES} - win32_enable.c - win32_fullscreen.c - win32_gamma.c - win32_init.c - win32_joystick.c - win32_opengl.c - win32_time.c - win32_window.c - win32_dllmain.c) - -add_library(libglfwStatic STATIC ${libglfw_SOURCES}) -add_library(libglfwShared SHARED ${libglfw_SOURCES}) - -target_link_libraries(libglfwShared ${OPENGL_gl_LIBRARY}) -set_target_properties(libglfwShared PROPERTIES - DEFINE_SYMBOL GLFW_BUILD_DLL - PREFIX "" - IMPORT_PREFIX "" - IMPORT_SUFFIX "dll.lib") - -set_target_properties(libglfwStatic libglfwShared PROPERTIES - CLEAN_DIRECT_OUTPUT 1 - OUTPUT_NAME glfw) - -if(CYGWIN) - # Build for the regular Win32 environment (not Cygwin) - set_target_properties(libglfwStatic libglfwShared PROPERTIES - COMPILE_FLAGS "-mwin32 -mno-cygwin" - LINK_FLAGS "-mwin32 -mno-cygwin") -endif(CYGWIN) - -install(TARGETS libglfwStatic libglfwShared DESTINATION lib) - -if(CYGWIN) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc DESTINATION lib/pkgconfig) -endif(CYGWIN) - diff --git a/src/win32/libglfw.pc.cmake b/src/win32/libglfw.pc.cmake deleted file mode 100644 index 9449ce2e..00000000 --- a/src/win32/libglfw.pc.cmake +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: GLFW -Description: A portable library for OpenGL development -Version: 3.0 -URL: http://www.glfw.org/ -Libs: -L${libdir} -lglfw @GLFW_LIBRARIES@ -Cflags: -I${includedir} -mwin32 diff --git a/src/win32/win32_dllmain.c b/src/win32_dllmain.c similarity index 100% rename from src/win32/win32_dllmain.c rename to src/win32_dllmain.c diff --git a/src/win32/win32_enable.c b/src/win32_enable.c similarity index 100% rename from src/win32/win32_enable.c rename to src/win32_enable.c diff --git a/src/win32/win32_fullscreen.c b/src/win32_fullscreen.c similarity index 100% rename from src/win32/win32_fullscreen.c rename to src/win32_fullscreen.c diff --git a/src/win32/win32_gamma.c b/src/win32_gamma.c similarity index 100% rename from src/win32/win32_gamma.c rename to src/win32_gamma.c diff --git a/src/win32/win32_init.c b/src/win32_init.c similarity index 100% rename from src/win32/win32_init.c rename to src/win32_init.c diff --git a/src/win32/win32_joystick.c b/src/win32_joystick.c similarity index 100% rename from src/win32/win32_joystick.c rename to src/win32_joystick.c diff --git a/src/win32/win32_opengl.c b/src/win32_opengl.c similarity index 100% rename from src/win32/win32_opengl.c rename to src/win32_opengl.c diff --git a/src/win32/platform.h b/src/win32_platform.h similarity index 100% rename from src/win32/platform.h rename to src/win32_platform.h diff --git a/src/win32/win32_time.c b/src/win32_time.c similarity index 100% rename from src/win32/win32_time.c rename to src/win32_time.c diff --git a/src/win32/win32_window.c b/src/win32_window.c similarity index 100% rename from src/win32/win32_window.c rename to src/win32_window.c diff --git a/src/x11/CMakeLists.txt b/src/x11/CMakeLists.txt deleted file mode 100644 index 6369a334..00000000 --- a/src/x11/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libglfw.pc.cmake - ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc @ONLY) - -include_directories(${CMAKE_CURRENT_SOURCE_DIR} - ${GLFW_SOURCE_DIR}/src - ${GLFW_BINARY_DIR}/src - ${GLFW_INCLUDE_DIR}) - -set(libglfw_SOURCES ${common_SOURCES} - x11_enable.c - x11_fullscreen.c - x11_gamma.c - x11_init.c - x11_joystick.c - x11_keysym2unicode.c - x11_opengl.c - x11_time.c - x11_window.c) - -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) - -install(TARGETS libglfwStatic libglfwShared DESTINATION lib) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc DESTINATION lib/pkgconfig) - diff --git a/src/x11/libglfw.pc.cmake b/src/x11/libglfw.pc.cmake deleted file mode 100644 index c9b8a690..00000000 --- a/src/x11/libglfw.pc.cmake +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: GLFW -Description: A portable library for OpenGL development -Version: 3.0 -URL: http://www.glfw.org/ -Libs: -L${libdir} -lglfw @GLFW_LIBRARIES@ -Cflags: -I${includedir} diff --git a/src/x11/x11_enable.c b/src/x11_enable.c similarity index 100% rename from src/x11/x11_enable.c rename to src/x11_enable.c diff --git a/src/x11/x11_fullscreen.c b/src/x11_fullscreen.c similarity index 100% rename from src/x11/x11_fullscreen.c rename to src/x11_fullscreen.c diff --git a/src/x11/x11_gamma.c b/src/x11_gamma.c similarity index 100% rename from src/x11/x11_gamma.c rename to src/x11_gamma.c diff --git a/src/x11/x11_init.c b/src/x11_init.c similarity index 100% rename from src/x11/x11_init.c rename to src/x11_init.c diff --git a/src/x11/x11_joystick.c b/src/x11_joystick.c similarity index 100% rename from src/x11/x11_joystick.c rename to src/x11_joystick.c diff --git a/src/x11/x11_keysym2unicode.c b/src/x11_keysym2unicode.c similarity index 100% rename from src/x11/x11_keysym2unicode.c rename to src/x11_keysym2unicode.c diff --git a/src/x11/x11_opengl.c b/src/x11_opengl.c similarity index 100% rename from src/x11/x11_opengl.c rename to src/x11_opengl.c diff --git a/src/x11/platform.h b/src/x11_platform.h similarity index 100% rename from src/x11/platform.h rename to src/x11_platform.h diff --git a/src/x11/x11_time.c b/src/x11_time.c similarity index 100% rename from src/x11/x11_time.c rename to src/x11_time.c diff --git a/src/x11/x11_window.c b/src/x11_window.c similarity index 100% rename from src/x11/x11_window.c rename to src/x11_window.c