Browse Source

Better usage of external OpenGL headers.

Moved them to `OpenGL/` subdirectory, allowing them to be included
explicitly with e.g. <OpenGL/GLES2/gl2ext.h> overriding the system
<GLES2/gl2ext.h> header. Our versions of the headers are thus now
explicitly included in `OpenGL.h`, but they can be also included using
no-prefix path if no system version is available. It might break some ES
platforms, they will be fixed when found.

The headers are now installed into `Magnum/OpenGL` (not into any
artificial `external` directory). Now also installing GLES2 headers for
OpenGL ES 2 (previously ES3 headers were installed for both ES2 and
ES3).
pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
8f37ebe9cf
  1. 2
      CMakeLists.txt
  2. 7
      external/CMakeLists.txt
  3. 34
      external/OpenGL/CMakeLists.txt
  4. 2
      external/OpenGL/GL/CMakeLists.txt
  5. 0
      external/OpenGL/GL/glcorearb.h
  6. 25
      external/OpenGL/GLES2/CMakeLists.txt
  7. 0
      external/OpenGL/GLES2/gl2.h
  8. 0
      external/OpenGL/GLES2/gl2ext.h
  9. 0
      external/OpenGL/GLES2/gl2platform.h
  10. 2
      external/OpenGL/GLES3/CMakeLists.txt
  11. 0
      external/OpenGL/GLES3/gl3.h
  12. 0
      external/OpenGL/GLES3/gl3platform.h
  13. 2
      external/OpenGL/KHR/CMakeLists.txt
  14. 0
      external/OpenGL/KHR/khrplatform.h
  15. 2
      modules/FindMagnum.cmake
  16. 11
      src/CMakeLists.txt
  17. 11
      src/OpenGL.h

2
CMakeLists.txt

@ -104,8 +104,6 @@ set(MAGNUM_LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
set(MAGNUM_CMAKE_MODULE_INSTALL_DIR ${CMAKE_ROOT}/Modules)
set(MAGNUM_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/Magnum)
include_directories(${CMAKE_SOURCE_DIR}/external)
add_subdirectory(external)
add_subdirectory(modules)
add_subdirectory(src)

7
external/CMakeLists.txt vendored

@ -22,9 +22,4 @@
# DEALINGS IN THE SOFTWARE.
#
if(NOT TARGET_GLES)
add_subdirectory(GL)
else()
add_subdirectory(GLES3)
add_subdirectory(KHR)
endif()
add_subdirectory(OpenGL)

34
external/OpenGL/CMakeLists.txt vendored

@ -0,0 +1,34 @@
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
if(NOT TARGET_GLES)
add_subdirectory(GL)
else()
add_subdirectory(KHR)
if(TARGET_GLES2)
add_subdirectory(GLES2)
else()
add_subdirectory(GLES3)
endif()
endif()

2
external/GL/CMakeLists.txt → external/OpenGL/GL/CMakeLists.txt vendored

@ -22,4 +22,4 @@
# DEALINGS IN THE SOFTWARE.
#
install(FILES glcorearb.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/external/GL)
install(FILES glcorearb.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/GL)

0
external/GL/glcorearb.h → external/OpenGL/GL/glcorearb.h vendored

25
external/OpenGL/GLES2/CMakeLists.txt vendored

@ -0,0 +1,25 @@
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
install(FILES gl2.h gl2platform.h gl2ext.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/GLES2)

0
external/GLES2/gl2.h → external/OpenGL/GLES2/gl2.h vendored

0
external/GLES2/gl2ext.h → external/OpenGL/GLES2/gl2ext.h vendored

0
external/GLES2/gl2platform.h → external/OpenGL/GLES2/gl2platform.h vendored

2
external/GLES3/CMakeLists.txt → external/OpenGL/GLES3/CMakeLists.txt vendored

@ -22,4 +22,4 @@
# DEALINGS IN THE SOFTWARE.
#
install(FILES gl3.h gl3platform.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/external/GLES3)
install(FILES gl3.h gl3platform.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/GLES3)

0
external/GLES3/gl3.h → external/OpenGL/GLES3/gl3.h vendored

0
external/GLES3/gl3platform.h → external/OpenGL/GLES3/gl3platform.h vendored

2
external/KHR/CMakeLists.txt → external/OpenGL/KHR/CMakeLists.txt vendored

@ -22,4 +22,4 @@
# DEALINGS IN THE SOFTWARE.
#
install(FILES khrplatform.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/external/KHR)
install(FILES khrplatform.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/KHR)

0
external/KHR/khrplatform.h → external/OpenGL/KHR/khrplatform.h vendored

2
modules/FindMagnum.cmake

@ -295,7 +295,7 @@ find_package_handle_standard_args(Magnum
# Dependent libraries and includes
set(MAGNUM_INCLUDE_DIRS ${MAGNUM_INCLUDE_DIR}
${MAGNUM_INCLUDE_DIR}/external
${MAGNUM_INCLUDE_DIR}/OpenGL
${CORRADE_INCLUDE_DIR})
set(MAGNUM_LIBRARIES ${MAGNUM_LIBRARY}
${CORRADE_UTILITY_LIBRARY}

11
src/CMakeLists.txt

@ -30,7 +30,16 @@ if(CORRADE_GCC46_COMPATIBILITY)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CORRADE_CXX_FLAGS}")
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CORRADE_INCLUDE_DIR})
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CORRADE_INCLUDE_DIR}
# We can use both implicit include path (GLES2/gl2.h) where our headers can
# be overriden with system ones or explicit (OpenGL/GLES2/gl2ext.h) where
# only our headers will be used
${CMAKE_SOURCE_DIR}/external
${CMAKE_SOURCE_DIR}/external/OpenGL)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/magnumConfigure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/magnumConfigure.h)

11
src/OpenGL.h

@ -32,13 +32,16 @@
#ifndef MAGNUM_TARGET_GLES
#include <GL/glew.h>
#include <GL/glcorearb.h>
#include <OpenGL/GL/glcorearb.h>
#else
#include <OpenGL/KHR/khrplatform.h>
#ifndef MAGNUM_TARGET_GLES2
#include <GLES3/gl3.h>
#include <OpenGL/GLES3/gl3platform.h>
#include <OpenGL/GLES3/gl3.h>
#else
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <OpenGL/GLES2/gl2platform.h>
#include <OpenGL/GLES2/gl2.h>
#include <OpenGL/GLES2/gl2ext.h>
#endif
#endif

Loading…
Cancel
Save