diff --git a/CMakeLists.txt b/CMakeLists.txt index 39d3d8f6..88d908a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -704,13 +704,13 @@ if(WEBP_BUILD_WEBP_JS) else() set(emscripten_stack_size "-sTOTAL_STACK=5MB") endif() - find_package(SDL2 REQUIRED) # wasm2js does not support SIMD. + find_package(SDL REQUIRED) if(NOT WEBP_ENABLE_SIMD) # JavaScript version add_executable(webp_js ${CMAKE_CURRENT_SOURCE_DIR}/extras/webp_to_sdl.c) - target_link_libraries(webp_js webpdecoder SDL2) - target_include_directories(webp_js PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + target_link_libraries(webp_js webpdecoder ${SDL_LIBRARY}) + target_include_directories(webp_js PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${SDL_INCLUDE_DIR}) set(WEBP_HAVE_SDL 1) set_target_properties( webp_js @@ -729,20 +729,20 @@ if(WEBP_BUILD_WEBP_JS) # WASM version add_executable(webp_wasm ${CMAKE_CURRENT_SOURCE_DIR}/extras/webp_to_sdl.c) - target_link_libraries(webp_wasm webpdecoder SDL2) - target_include_directories(webp_wasm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + target_link_libraries(webp_wasm webpdecoder ${SDL_LIBRARY}) + target_include_directories(webp_wasm PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${SDL_INCLUDE_DIR}) set_target_properties( webp_wasm PROPERTIES # Emscripten puts -sUSE_SDL2=1 in this variable, though it's needed at # compile time to ensure the headers are downloaded. - COMPILE_OPTIONS "${SDL2_LIBRARIES}" + COMPILE_OPTIONS "${SDL_LIBRARIES}" LINK_FLAGS "-sWASM=1 ${emscripten_stack_size} \ -sEXPORTED_FUNCTIONS=_WebPToSDL -sINVOKE_RUN=0 \ - -sEXPORTED_RUNTIME_METHODS=cwrap ${SDL2_LIBRARIES} \ + -sEXPORTED_RUNTIME_METHODS=cwrap ${SDL_LIBRARIES} \ -sALLOW_MEMORY_GROWTH") - target_compile_definitions(webp_wasm PUBLIC EMSCRIPTEN WEBP_HAVE_SDL) + target_compile_definitions(webp_wasm PUBLIC EMSCRIPTEN WEBP_HAVE_SDL WEBP_HAVE_JUST_SDL_H) target_compile_definitions(webpdspdecode PUBLIC EMSCRIPTEN) endif()