emscripten-core / emscripten-core/emscripten

SDL 2 and SDL image 2 dependencies

Open
#13,174 3 comments 0 reactions 0 assignees View on GitHub
wontfix
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

The `CMakeLists.txt` in my project contains the following lines

```
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_SDL=2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='[\"bmp\",\"png\"]'")
```

When I compile a project with no ports available in `emsdk\upstream\emscripten\cache` this leads to the following error:

```
File "/mnt/c/Users/Laguna_HP/webassembly/emsdk/upstream/emscripten/tools/ports/sdl2_image.py", line 18, in get
assert os.path.exists(sdl_build), 'You must use SDL2 to use SDL2_image'
AssertionError: You must use SDL2 to use SDL2_image
```
Apparently `emsdk\upstream\emscripten\cache\wasm\ports-builds\sdl2` has not been created at the point when SDL2_image is looking for that folder.

This seems like a dependency issue between the SDL2 and the SDL2 library ports. The same happens for sdl2 and sdl mixer 2.

If the second line in the `CMakeLists.txt` file (containing SDL2_image) is commented out a build of the sdl2 port is created. Of course the application build itself fails, because I am using functionality from SDL_image.
After that I can uncomment the second line and SDL_image correctly detects the sdl2 build.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.