Browse Source

TODOs for the stupid annoying Emscripten -s<SPACE>WHATEVER flags.

sceneconverter
Vladimír Vondruš 4 years ago
parent
commit
6b18a5e11f
  1. 4
      modules/FindMagnum.cmake
  2. 4
      modules/FindOpenGLES3.cmake
  3. 4
      src/CMakeLists.txt

4
modules/FindMagnum.cmake

@ -1042,6 +1042,10 @@ if(CORRADE_TARGET_EMSCRIPTEN)
# IN_LIST as an operator since 3.1 (Emscripten needs at least 3.7), but
# it's behind a policy, so enable that one as well.
cmake_policy(SET CMP0057 NEW)
# TODO since 1.39.19 it's possible to use `-sUSE_WEBGL2=1`, which can be
# then passed via target_link_libraries() etc. without requiring CMake
# 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(CMAKE_VERSION VERSION_LESS 3.13 AND GL IN_LIST Magnum_FIND_COMPONENTS AND NOT MAGNUM_TARGET_GLES2 AND NOT CMAKE_EXE_LINKER_FLAGS MATCHES "-s USE_WEBGL2=1")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_WEBGL2=1")
endif()

4
modules/FindOpenGLES3.cmake

@ -82,6 +82,10 @@ if(NOT TARGET OpenGLES3::OpenGLES3)
# Emscripten needs a special flag to use WebGL 2. CMake 3.13 allows to set
# this via INTERFACE_LINK_OPTIONS, for older versions we modify the global
# CMAKE_EXE_LINKER_FLAGS inside FindMagnum.cmake.
# TODO since 1.39.19 it's possible to use `-sUSE_WEBGL2=1`, which can be
# then passed via target_link_libraries() etc. without requiring CMake
# 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

4
src/CMakeLists.txt

@ -40,6 +40,10 @@ endif()
# `-s USE_WEBGL2=1` linker option is propagated from FindOpenGLES3.cmake
# already. If not (and the GL library is used), we need to modify the global
# CMAKE_EXE_LINKER_FLAGS.
# TODO since 1.39.19 it's possible to use `-sUSE_WEBGL2=1`, which can be then
# passed via target_link_libraries() etc. without requiring CMake 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 CMAKE_VERSION VERSION_LESS 3.13 AND WITH_GL AND NOT TARGET_GLES2)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_WEBGL2=1")
endif()

Loading…
Cancel
Save