Browse Source

modules: why do I always find a nicer solution AFTER pushing to master.

pull/168/head
Vladimír Vondruš 3 years ago
parent
commit
750c6d92f1
  1. 7
      modules/FindMagnum.cmake
  2. 15
      modules/FindOpenGLES3.cmake
  3. 9
      src/Magnum/GL/CMakeLists.txt

7
modules/FindMagnum.cmake

@ -913,13 +913,6 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
find_package(OpenGLES3 REQUIRED) find_package(OpenGLES3 REQUIRED)
set_property(TARGET Magnum::${_component} APPEND PROPERTY set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES OpenGLES3::OpenGLES3) INTERFACE_LINK_LIBRARIES OpenGLES3::OpenGLES3)
if(CORRADE_TARGET_EMSCRIPTEN)
if(CMAKE_VERSION VERSION_LESS 3.13)
message(FATAL_ERROR "CMake 3.13+ is required in order to specify Emscripten linker options")
endif()
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_OPTIONS "SHELL:-s USE_WEBGL2=1")
endif()
endif() endif()
# MaterialTools library # MaterialTools library

15
modules/FindOpenGLES3.cmake

@ -79,16 +79,11 @@ if(NOT TARGET OpenGLES3::OpenGLES3)
IMPORTED_LOCATION ${OPENGLES3_LIBRARY}) IMPORTED_LOCATION ${OPENGLES3_LIBRARY})
endif() endif()
# Emscripten needs a special flag to use WebGL 2. CMake 3.13 allows to set # Emscripten needs a special flag to use WebGL 2
# this via INTERFACE_LINK_OPTIONS, for older versions we modify the global if(CORRADE_TARGET_EMSCRIPTEN)
# CMAKE_EXE_LINKER_FLAGS inside FindMagnum.cmake. if(CMAKE_VERSION VERSION_LESS 3.13)
# TODO since 1.39.19 it's possible to use `-sUSE_WEBGL2=1`, which can be message(FATAL_ERROR "CMake 3.13+ is required in order to specify Emscripten linker options")
# then passed via target_link_libraries() etc. without requiring CMake endif()
# 3.13: https://github.com/emscripten-core/emscripten/blob/main/ChangeLog.md#13919-07072020
# -- change to that once we drop support for older Emscripten versions
if(CORRADE_TARGET_EMSCRIPTEN AND NOT CMAKE_VERSION VERSION_LESS 3.13)
# I could probably use target_link_options() here, but let's be
# consistent with the rest
set_property(TARGET OpenGLES3::OpenGLES3 APPEND PROPERTY set_property(TARGET OpenGLES3::OpenGLES3 APPEND PROPERTY
INTERFACE_LINK_OPTIONS "SHELL:-s USE_WEBGL2=1") INTERFACE_LINK_OPTIONS "SHELL:-s USE_WEBGL2=1")
endif() endif()

9
src/Magnum/GL/CMakeLists.txt

@ -233,12 +233,6 @@ elseif(MAGNUM_TARGET_GLES2)
target_link_libraries(MagnumGL PUBLIC OpenGLES2::OpenGLES2) target_link_libraries(MagnumGL PUBLIC OpenGLES2::OpenGLES2)
else() else()
target_link_libraries(MagnumGL PUBLIC OpenGLES3::OpenGLES3) target_link_libraries(MagnumGL PUBLIC OpenGLES3::OpenGLES3)
if(CORRADE_TARGET_EMSCRIPTEN)
if(CMAKE_VERSION VERSION_LESS 3.13)
message(FATAL_ERROR "CMake 3.13+ is required in order to specify Emscripten linker options")
endif()
target_link_options(MagnumGL PUBLIC "SHELL:-s USE_WEBGL2=1")
endif()
endif() endif()
install(TARGETS MagnumGL install(TARGETS MagnumGL
@ -322,9 +316,6 @@ if(MAGNUM_BUILD_TESTS)
target_link_libraries(MagnumGLTestLib PUBLIC OpenGLES2::OpenGLES2) target_link_libraries(MagnumGLTestLib PUBLIC OpenGLES2::OpenGLES2)
else() else()
target_link_libraries(MagnumGLTestLib PUBLIC OpenGLES3::OpenGLES3) target_link_libraries(MagnumGLTestLib PUBLIC OpenGLES3::OpenGLES3)
if(CORRADE_TARGET_EMSCRIPTEN)
target_link_options(MagnumGLTestLib PUBLIC "SHELL:-s USE_WEBGL2=1")
endif()
endif() endif()
if(MAGNUM_BUILD_GL_TESTS) if(MAGNUM_BUILD_GL_TESTS)

Loading…
Cancel
Save