From a689c3ab9610ce21c7b36cb7ac4e452e21b0ee68 Mon Sep 17 00:00:00 2001 From: leo60228 Date: Wed, 31 Mar 2021 13:48:45 -0400 Subject: [PATCH] Support Emscripten's SDL2 Emscripten defaults to using SDL 2.0.10, but `export EMCC_LOCAL_PORTS=sdl2=/path/to/SDL2` seems to work. --- desktop_version/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/desktop_version/CMakeLists.txt b/desktop_version/CMakeLists.txt index 7405c122..111272e2 100644 --- a/desktop_version/CMakeLists.txt +++ b/desktop_version/CMakeLists.txt @@ -304,6 +304,10 @@ if(DEFINED SDL2_INCLUDE_DIRS AND DEFINED SDL2_LIBRARIES) message(STATUS "Using pre-defined SDL2 variables SDL2_INCLUDE_DIRS and SDL2_LIBRARIES") target_include_directories(VVVVVV SYSTEM PRIVATE "$") target_link_libraries(VVVVVV ${SDL2_LIBRARIES}) +elseif (EMSCRIPTEN) + message(STATUS "Using Emscripten SDL2") + target_compile_options(VVVVVV PUBLIC -sUSE_SDL=2 -sUSE_SDL_MIXER=2) + target_link_libraries(VVVVVV -sUSE_SDL=2 -sUSE_SDL_MIXER=2) else() # Only try to autodetect if both SDL2 variables aren't explicitly set find_package(SDL2 CONFIG)