Browse Source

modules: updated FindMagnum.cmake.

pull/16/head
Vladimír Vondruš 4 years ago
parent
commit
66bb4451df
  1. 77
      modules/FindMagnum.cmake

77
modules/FindMagnum.cmake

@ -78,7 +78,6 @@
# WindowlessGlxApplication - Windowless GLX application # WindowlessGlxApplication - Windowless GLX application
# WindowlessIosApplication - Windowless iOS application # WindowlessIosApplication - Windowless iOS application
# WindowlessWglApplication - Windowless WGL application # WindowlessWglApplication - Windowless WGL application
# WindowlessWindowsEglApplication - Windowless Windows/EGL application
# CglContext - CGL context # CglContext - CGL context
# EglContext - EGL context # EglContext - EGL context
# GlxContext - GLX context # GlxContext - GLX context
@ -137,10 +136,9 @@
# MAGNUM_TARGET_GLES - Defined if compiled for OpenGL ES # MAGNUM_TARGET_GLES - Defined if compiled for OpenGL ES
# MAGNUM_TARGET_GLES2 - Defined if compiled for OpenGL ES 2.0 # MAGNUM_TARGET_GLES2 - Defined if compiled for OpenGL ES 2.0
# MAGNUM_TARGET_GLES3 - Defined if compiled for OpenGL ES 3.0 # MAGNUM_TARGET_GLES3 - Defined if compiled for OpenGL ES 3.0
# MAGNUM_TARGET_DESKTOP_GLES - Defined if compiled with OpenGL ES
# emulation on desktop OpenGL
# MAGNUM_TARGET_WEBGL - Defined if compiled for WebGL # MAGNUM_TARGET_WEBGL - Defined if compiled for WebGL
# MAGNUM_TARGET_HEADLESS - Defined if compiled for headless machines # MAGNUM_TARGET_EGL - Defined if compiled for EGL instead of a
# platform-specific OpenGL support library like CGL, EAGL, GLX or WGL
# MAGNUM_TARGET_VK - Defined if compiled with Vulkan interop # MAGNUM_TARGET_VK - Defined if compiled with Vulkan interop
# #
# The following variables are provided for backwards compatibility purposes # The following variables are provided for backwards compatibility purposes
@ -149,6 +147,10 @@
# #
# MAGNUM_BUILD_MULTITHREADED - Alias to CORRADE_BUILD_MULTITHREADED. Use # MAGNUM_BUILD_MULTITHREADED - Alias to CORRADE_BUILD_MULTITHREADED. Use
# CORRADE_BUILD_MULTITHREADED instead. # CORRADE_BUILD_MULTITHREADED instead.
# MAGNUM_TARGET_HEADLESS - Alias to MAGNUM_TARGET_EGL, unless on iOS,
# Android, Emscripten or Windows RT. Use MAGNUM_TARGET_EGL instead.
# MAGNUM_TARGET_DESKTOP_GLES` - Defined if compiled for OpenGL ES but
# GLX / WGL is used instead of EGL. Use MAGNUM_TARGET_EGL instead.
# #
# Additionally these variables are defined for internal usage: # Additionally these variables are defined for internal usage:
# #
@ -269,9 +271,8 @@ set(_magnumFlags
TARGET_GLES TARGET_GLES
TARGET_GLES2 TARGET_GLES2
TARGET_GLES3 TARGET_GLES3
TARGET_DESKTOP_GLES
TARGET_WEBGL TARGET_WEBGL
TARGET_HEADLESS TARGET_EGL
TARGET_VK) TARGET_VK)
foreach(_magnumFlag ${_magnumFlags}) foreach(_magnumFlag ${_magnumFlags})
list(FIND _magnumConfigure "#define MAGNUM_${_magnumFlag}" _magnum_${_magnumFlag}) list(FIND _magnumConfigure "#define MAGNUM_${_magnumFlag}" _magnum_${_magnumFlag})
@ -280,9 +281,20 @@ foreach(_magnumFlag ${_magnumFlags})
endif() endif()
endforeach() endforeach()
# For compatibility only, to be removed at some point # For compatibility only, to be removed at some point. Refer to
if(MAGNUM_BUILD_DEPRECATED AND CORRADE_BUILD_MULTITHREADED) # src/Magnum/configure.h.cmake for the decision logic here.
set(MAGNUM_BUILD_MULTITHREADED 1) if(MAGNUM_BUILD_DEPRECATED)
if(CORRADE_BUILD_MULTITHREADED)
set(MAGNUM_BUILD_MULTITHREADED 1)
endif()
if(NOT CORRADE_TARGET_IOS AND NOT CORRADE_TARGET_ANDROID AND NOT CORRADE_TARGET_EMSCRIPTEN AND NOT CORRADE_TARGET_WINDOWS_RT)
if(NOT MAGNUM_TARGET_GLES AND MAGNUM_TARGET_EGL)
set(MAGNUM_TARGET_HEADLESS 1)
endif()
if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_EGL)
set(MAGNUM_TARGET_DESKTOP_GLES 1)
endif()
endif()
endif() endif()
# OpenGL library preference. Prefer to use GLVND, since that's the better # OpenGL library preference. Prefer to use GLVND, since that's the better
@ -395,7 +407,7 @@ if(CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE)
list(APPEND _MAGNUM_LIBRARY_COMPONENTS GlxApplication XEglApplication WindowlessGlxApplication GlxContext) list(APPEND _MAGNUM_LIBRARY_COMPONENTS GlxApplication XEglApplication WindowlessGlxApplication GlxContext)
endif() endif()
if(CORRADE_TARGET_WINDOWS) if(CORRADE_TARGET_WINDOWS)
list(APPEND _MAGNUM_LIBRARY_COMPONENTS WindowlessWglApplication WglContext WindowlessWindowsEglApplication) list(APPEND _MAGNUM_LIBRARY_COMPONENTS WindowlessWglApplication WglContext)
endif() endif()
if(CORRADE_TARGET_UNIX OR CORRADE_TARGET_WINDOWS) if(CORRADE_TARGET_UNIX OR CORRADE_TARGET_WINDOWS)
list(APPEND _MAGNUM_EXECUTABLE_COMPONENTS fontconverter distancefieldconverter) list(APPEND _MAGNUM_EXECUTABLE_COMPONENTS fontconverter distancefieldconverter)
@ -426,24 +438,16 @@ if(MAGNUM_TARGET_GL)
endif() endif()
set(_MAGNUM_OpenGLTester_DEPENDENCIES GL) set(_MAGNUM_OpenGLTester_DEPENDENCIES GL)
if(MAGNUM_TARGET_HEADLESS OR CORRADE_TARGET_EMSCRIPTEN OR CORRADE_TARGET_ANDROID) if(MAGNUM_TARGET_EGL)
list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessEglApplication) list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessEglApplication)
elseif(CORRADE_TARGET_IOS) elseif(CORRADE_TARGET_IOS)
list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessIosApplication) list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessIosApplication)
elseif(CORRADE_TARGET_APPLE AND NOT MAGNUM_TARGET_GLES) elseif(CORRADE_TARGET_APPLE)
list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessCglApplication) list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessCglApplication)
elseif(CORRADE_TARGET_UNIX) elseif(CORRADE_TARGET_UNIX)
if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_DESKTOP_GLES) list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessGlxApplication)
list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessEglApplication)
else()
list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessGlxApplication)
endif()
elseif(CORRADE_TARGET_WINDOWS) elseif(CORRADE_TARGET_WINDOWS)
if(NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES) list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessWglApplication)
list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessWglApplication)
else()
list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessWindowsEglApplication)
endif()
endif() endif()
set(_MAGNUM_Primitives_DEPENDENCIES MeshTools Trade) set(_MAGNUM_Primitives_DEPENDENCIES MeshTools Trade)
@ -492,7 +496,6 @@ set(_MAGNUM_WindowlessEglApplication_DEPENDENCIES GL)
set(_MAGNUM_WindowlessGlxApplication_DEPENDENCIES GL) set(_MAGNUM_WindowlessGlxApplication_DEPENDENCIES GL)
set(_MAGNUM_WindowlessIosApplication_DEPENDENCIES GL) set(_MAGNUM_WindowlessIosApplication_DEPENDENCIES GL)
set(_MAGNUM_WindowlessWglApplication_DEPENDENCIES GL) set(_MAGNUM_WindowlessWglApplication_DEPENDENCIES GL)
set(_MAGNUM_WindowlessWindowsEglApplication_DEPENDENCIES GL)
set(_MAGNUM_XEglApplication_DEPENDENCIES GL) set(_MAGNUM_XEglApplication_DEPENDENCIES GL)
set(_MAGNUM_CglContext_DEPENDENCIES GL) set(_MAGNUM_CglContext_DEPENDENCIES GL)
set(_MAGNUM_EglContext_DEPENDENCIES GL) set(_MAGNUM_EglContext_DEPENDENCIES GL)
@ -708,16 +711,16 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
# OPENGL_opengl_LIBRARY because that's set even if # OPENGL_opengl_LIBRARY because that's set even if
# OpenGL_GL_PREFERENCE is explicitly set to LEGACY. # OpenGL_GL_PREFERENCE is explicitly set to LEGACY.
if(MAGNUM_TARGET_GL) if(MAGNUM_TARGET_GL)
if(CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE AND (NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES)) if(MAGNUM_TARGET_EGL)
find_package(EGL)
set_property(TARGET Magnum::${_component} APPEND
PROPERTY INTERFACE_LINK_LIBRARIES EGL::EGL)
elseif(CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE)
find_package(OpenGL) find_package(OpenGL)
if(OPENGL_opengl_LIBRARY AND OpenGL_GL_PREFERENCE STREQUAL GLVND) if(OPENGL_opengl_LIBRARY AND OpenGL_GL_PREFERENCE STREQUAL GLVND)
set_property(TARGET Magnum::${_component} APPEND set_property(TARGET Magnum::${_component} APPEND
PROPERTY INTERFACE_LINK_LIBRARIES OpenGL::GLX) PROPERTY INTERFACE_LINK_LIBRARIES OpenGL::GLX)
endif() endif()
elseif(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_DESKTOP_GLES AND NOT CORRADE_TARGET_EMSCRIPTEN)
find_package(EGL)
set_property(TARGET Magnum::${_component} APPEND
PROPERTY INTERFACE_LINK_LIBRARIES EGL::EGL)
endif() endif()
endif() endif()
@ -747,16 +750,16 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
# OPENGL_opengl_LIBRARY because that's set even if # OPENGL_opengl_LIBRARY because that's set even if
# OpenGL_GL_PREFERENCE is explicitly set to LEGACY. # OpenGL_GL_PREFERENCE is explicitly set to LEGACY.
if(MAGNUM_TARGET_GL) if(MAGNUM_TARGET_GL)
if(CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE AND (NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES)) if(MAGNUM_TARGET_EGL)
find_package(EGL)
set_property(TARGET Magnum::${_component} APPEND
PROPERTY INTERFACE_LINK_LIBRARIES EGL::EGL)
elseif(CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE)
find_package(OpenGL) find_package(OpenGL)
if(OPENGL_opengl_LIBRARY AND OpenGL_GL_PREFERENCE STREQUAL GLVND) if(OPENGL_opengl_LIBRARY AND OpenGL_GL_PREFERENCE STREQUAL GLVND)
set_property(TARGET Magnum::${_component} APPEND set_property(TARGET Magnum::${_component} APPEND
PROPERTY INTERFACE_LINK_LIBRARIES OpenGL::GLX) PROPERTY INTERFACE_LINK_LIBRARIES OpenGL::GLX)
endif() endif()
elseif(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_DESKTOP_GLES AND NOT CORRADE_TARGET_EMSCRIPTEN)
find_package(EGL)
set_property(TARGET Magnum::${_component} APPEND
PROPERTY INTERFACE_LINK_LIBRARIES EGL::EGL)
endif() endif()
endif() endif()
@ -799,12 +802,6 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
# Windowless WGL application has no additional dependencies # Windowless WGL application has no additional dependencies
# Windowless Windows/EGL application dependencies
elseif(_component STREQUAL WindowlessWindowsEglApplication)
find_package(EGL)
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES EGL::EGL)
# X/EGL application dependencies # X/EGL application dependencies
elseif(_component STREQUAL XEglApplication) elseif(_component STREQUAL XEglApplication)
find_package(EGL) find_package(EGL)
@ -860,7 +857,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
# GL library # GL library
elseif(_component STREQUAL GL) elseif(_component STREQUAL GL)
if(NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES) if(NOT MAGNUM_TARGET_GLES OR (MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_EGL AND NOT CORRADE_TARGET_IOS))
# If the GLVND library (CMake 3.11+) was found, link to the # If the GLVND library (CMake 3.11+) was found, link to the
# imported target. Otherwise (and also on all systems except # imported target. Otherwise (and also on all systems except
# Linux) link to the classic libGL. Can't use # Linux) link to the classic libGL. Can't use

Loading…
Cancel
Save