Skip to content

Commit

Permalink
sdl2 is provided by emscripten itself
Browse files Browse the repository at this point in the history
  • Loading branch information
jgsogo committed Sep 25, 2021
1 parent ddf2fb1 commit 88e7e80
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions recipes/magnum/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import re
import textwrap
import shutil

required_conan_version = ">=1.33.0"

Expand Down Expand Up @@ -192,9 +193,9 @@ def config_options(self):

if self.settings.os == "Emscripten":
self.options.shared_plugins = False
self.options.target_gl = "desktop_gl" # FIXME: Should be gles2?
self.options.target_gl = "gles2"

self.options.sdl2_application = False # FIXME: Fails to build (because of target_gl value? Needs emscripten-port?)
self.options.sdl2_application = True # FIXME: Fails to build. Use emscripten-port?)

self.options.gl_info = False

Expand Down Expand Up @@ -276,7 +277,7 @@ def requirements(self):
if self.options.glfw_application:
self.requires("glfw/3.3.4")

if self.options.sdl2_application:
if self.options.sdl2_application and self.settings.os != "Emscripten":
self.requires("sdl/2.0.16")

def build_requirements(self):
Expand Down Expand Up @@ -433,6 +434,12 @@ def _patch_sources(self):
"EGL::EGL",
"egl::egl")

# Copy FindOpenGLES2/3.cmake to build folder
shutil.copy(os.path.join(self._source_subfolder, "modules", "FindOpenGLES2.cmake"), "FindOpenGLES2.cmake")
shutil.copy(os.path.join(self._source_subfolder, "modules", "FindOpenGLES3.cmake"), "FindOpenGLES3.cmake")
if self.settings.os == "Emscripten":
shutil.copy(os.path.join(self._source_subfolder, "modules", "FindSDL2.cmake"), "FindSDL2.cmake")

def build(self):
self._patch_sources()

Expand Down Expand Up @@ -611,7 +618,9 @@ def package_info(self):
self.cpp_info.components["sdl2_application"].names["cmake_find_package"] = "Sdl2Application"
self.cpp_info.components["sdl2_application"].names["cmake_find_package_multi"] = "Sdl2Application"
self.cpp_info.components["sdl2_application"].libs = ["MagnumSdl2Application{}".format(lib_suffix)]
self.cpp_info.components["sdl2_application"].requires = ["magnum_main", "sdl::sdl"]
self.cpp_info.components["sdl2_application"].requires = ["magnum_main"]
if self.settings.os != "Emscripten":
self.cpp_info.components["sdl2_application"].requires += ["sdl::sdl"]
if self.options.target_gl:
self.cpp_info.components["sdl2_application"].requires += ["gl"]

Expand Down

0 comments on commit 88e7e80

Please sign in to comment.