Browse Source

Platform: don't crash EmscriptenApplication on a WebGL-less build.

The code right below is querying the `log` option, which wasn't added.
Becomes a problem when Magnum is compiled w/o GL support, e.g. for a
custom WebGPU renderer.
pull/617/head
Hugo Amiard 3 years ago committed by Vladimír Vondruš
parent
commit
1d2c6aeb77
  1. 6
      src/Magnum/Platform/EmscriptenApplication.cpp
  2. 5
      src/Magnum/Platform/GlfwApplication.cpp
  3. 5
      src/Magnum/Platform/Sdl2Application.cpp

6
src/Magnum/Platform/EmscriptenApplication.cpp

@ -238,7 +238,11 @@ EmscriptenApplication::EmscriptenApplication(const Arguments& arguments, NoCreat
#ifdef MAGNUM_TARGET_GL
_context.emplace(NoCreate, args, arguments.argc, arguments.argv);
#else
args.parse(arguments.argc, arguments.argv);
/** @todo this is duplicated here, in Sdl2Application and in
GlfwApplication, figure out a nice non-duplicated way to handle this */
args.addOption("log", "default").setHelp("log", "console logging", "default|quiet|verbose")
.setFromEnvironment("log")
.parse(arguments.argc, arguments.argv);
#endif
/* Save command-line arguments */

5
src/Magnum/Platform/GlfwApplication.cpp

@ -81,8 +81,9 @@ GlfwApplication::GlfwApplication(const Arguments& arguments, NoCreateT):
#ifdef MAGNUM_TARGET_GL
_context.emplace(NoCreate, args, arguments.argc, arguments.argv);
#else
/** @todo this is duplicated here and in Sdl2Application, figure out a nice
non-duplicated way to handle this */
/** @todo this is duplicated here, in Sdl2Application and in
EmscriptenApplication, figure out a nice non-duplicated way to handle
this */
args.addOption("log", "default").setHelp("log", "console logging", "default|quiet|verbose")
.setFromEnvironment("log")
.parse(arguments.argc, arguments.argv);

5
src/Magnum/Platform/Sdl2Application.cpp

@ -126,8 +126,9 @@ Sdl2Application::Sdl2Application(const Arguments& arguments, NoCreateT):
#ifdef MAGNUM_TARGET_GL
_context.emplace(NoCreate, args, arguments.argc, arguments.argv);
#else
/** @todo this is duplicated here and in GlfwApplication, figure out a nice
non-duplicated way to handle this */
/** @todo this is duplicated here, in GlfwApplication and in
EmscriptenApplication, figure out a nice non-duplicated way to handle
this */
args.addOption("log", "default").setHelp("log", "console logging", "default|quiet|verbose")
.setFromEnvironment("log")
.parse(arguments.argc, arguments.argv);

Loading…
Cancel
Save