3rdParty-devel: Install OpenGL headers only if needed
MinGW already distributes OpenGL headers and libraries under different directories. In such cases, it is more sensible to rely on those than the in-tree copies maintained by the project. Note that, for some unknown reason, the include directories for the OpenGL::GL target are not filled, even if find_package(OpenGL) is successful and the library is found. Therefore, this commit works around this limitation by finding GL/gl.h from a possible list of directories inside the toolchain. git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9606 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: f663966c6bd42cfcb2b5135b871bb2e2e1636994 Former-commit-id: 92e313ea0f1edc8e030021225dec2c347b69f86f
This commit is contained in:
parent
4e08c6ae72
commit
826e02b48d
1 changed files with 39 additions and 4 deletions
|
@ -156,14 +156,49 @@ else()
|
||||||
set(SUPER_BUILD_POSTFIX "")
|
set(SUPER_BUILD_POSTFIX "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# OpenGL extensions (Windows only??)
|
# OpenGL extensions
|
||||||
message(STATUS "OpenGL extensions (Windows only??)")
|
find_package(OpenGL)
|
||||||
if(WIN32 AND OPTION_OPENGL_HEADERS)
|
|
||||||
|
if(NOT TARGET OpenGL::GL)
|
||||||
|
message(STATUS "Copying in-tree OpenGL headers")
|
||||||
ExternalProject_Add(OpenGL-headers
|
ExternalProject_Add(OpenGL-headers
|
||||||
URL ${CMAKE_CURRENT_SOURCE_DIR}/patches/openglheaders.zip
|
URL ${CMAKE_CURRENT_SOURCE_DIR}/patches/openglheaders.zip
|
||||||
URL_HASH SHA256=344debe6e65629d70020b6da056255de56c7d4fe48194336ea2cb896fc1b545b
|
URL_HASH SHA256=344debe6e65629d70020b6da056255de56c7d4fe48194336ea2cb896fc1b545b
|
||||||
CMAKE_ARGS ${EXTERNALS_CMAKE_ARGS})
|
CMAKE_ARGS ${EXTERNALS_CMAKE_ARGS})
|
||||||
endif(WIN32 AND OPTION_OPENGL_HEADERS)
|
else()
|
||||||
|
if(TARGET OpenGL::GL)
|
||||||
|
add_library(OpenGL-headers ALIAS OpenGL::GL)
|
||||||
|
|
||||||
|
if(MINGW AND NOT OPENGL_INCLUDE_DIR)
|
||||||
|
get_filename_component(MINGW_BINDIR "${CMAKE_CXX_COMPILER}" PATH)
|
||||||
|
get_filename_component(MINGW_BINDIR "${MINGW_BINDIR}/../" REALPATH)
|
||||||
|
|
||||||
|
if(CMAKE_CROSSCOMPILING)
|
||||||
|
find_path(OPENGL_INCLUDE_DIR GL/gl.h
|
||||||
|
REQUIRED
|
||||||
|
NO_CMAKE_SYSTEM_PATH
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
NO_CMAKE_PATH
|
||||||
|
NO_CMAKE_INSTALL_PREFIX
|
||||||
|
HINTS
|
||||||
|
"${MINGW_BINDIR}/include"
|
||||||
|
"${MINGW_BINDIR}/*/include"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
find_path(OPENGL_INCLUDE_DIR GL/gl.h
|
||||||
|
REQUIRED
|
||||||
|
HINTS
|
||||||
|
"${MINGW_BINDIR}/include"
|
||||||
|
"${MINGW_BINDIR}/*/include"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# FindOpenGL.cmake seems not to set this property under
|
||||||
|
# some circumstances.
|
||||||
|
target_include_directories(OpenGL::GL INTERFACE ${OPENGL_INCLUDE_DIR})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(OPTION_ZLIB)
|
if(OPTION_ZLIB)
|
||||||
ExternalProject_Add(${ZLIB_PROJECT}
|
ExternalProject_Add(${ZLIB_PROJECT}
|
||||||
|
|
Loading…
Reference in a new issue