Browse Source

CMake: link both GlfwApplication and Sdl2Application to EGL, if needed.

This is already done in the FindMagnum module for both, but not in the
source tree -- for SDL2 it was done in the FindSDL2 module (seems a
strange place) and for GLFW nowhere. To make things consistent, I'm
doing that in the Platform CMakeLists now and removed it from FindSDL2.

Hopefully this doesn't break anyone's workflow (static builds of
SDL2/GLFW?). In that case we would need to re-add it to the Find
modules as well.
pull/324/head
Vladimír Vondruš 7 years ago
parent
commit
75cc1725ad
  1. 7
      modules/FindSDL2.cmake
  2. 12
      src/Magnum/Platform/CMakeLists.txt

7
modules/FindSDL2.cmake

@ -145,13 +145,6 @@ if(NOT TARGET SDL2::SDL2)
set_property(TARGET SDL2::SDL2 APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${_SDL2_FRAMEWORK_LIBRARIES})
endif()
# Link also EGL library, if on ES (and not on WebGL)
if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_DESKTOP_GLES AND NOT MAGNUM_TARGET_WEBGL)
find_package(EGL REQUIRED)
set_property(TARGET SDL2::SDL2 APPEND PROPERTY
INTERFACE_LINK_LIBRARIES EGL::EGL)
endif()
else()
add_library(SDL2::SDL2 INTERFACE IMPORTED)
endif()

12
src/Magnum/Platform/CMakeLists.txt

@ -169,6 +169,12 @@ if(WITH_GLFWAPPLICATION)
endif()
endif()
# Link also EGL library, if on ES (and not on WebGL)
if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_DESKTOP_GLES AND NOT MAGNUM_TARGET_WEBGL)
find_package(EGL REQUIRED)
target_link_libraries(MagnumGlfwApplication PUBLIC EGL::EGL)
endif()
install(FILES ${MagnumGlfwApplication_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform)
install(TARGETS MagnumGlfwApplication
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
@ -272,6 +278,12 @@ if(WITH_SDL2APPLICATION)
endif()
endif()
# Link also EGL library, if on ES (and not on WebGL)
if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_DESKTOP_GLES AND NOT MAGNUM_TARGET_WEBGL)
find_package(EGL REQUIRED)
target_link_libraries(MagnumSdl2Application PUBLIC EGL::EGL)
endif()
install(FILES ${MagnumSdl2Application_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform)
install(TARGETS MagnumSdl2Application
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}

Loading…
Cancel
Save