vcpkg/ports/libwebp/0008-sdl.patch

38 lines
1.6 KiB
Diff
Raw Normal View History

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 91a4ba8..10a3f4d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -624,11 +624,12 @@ endif()
if(WEBP_BUILD_WEBP_JS)
# 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 SDL)
- 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
@@ -641,14 +642,14 @@ 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 SDL)
- 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 LINK_FLAGS "-s WASM=1 \
-s EXPORTED_FUNCTIONS='[\"_WebpToSDL\"]' -s INVOKE_RUN=0 \
-s EXPORTED_RUNTIME_METHODS='[\"cwrap\"]'")
- 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()