mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-13 06:24:27 +02:00
Add an option to enable static builds.
The build is not fully static but enough for certain usage. Change-Id: I269fa40f332365873634b12ac54fd3c36beefd66
This commit is contained in:
@ -15,6 +15,14 @@ endif()
|
||||
project(WebP C)
|
||||
|
||||
# Options for coder / decoder executables.
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(WEBP_LINK_STATIC_DEFAULT OFF)
|
||||
else()
|
||||
set(WEBP_LINK_STATIC_DEFAULT ON)
|
||||
endif()
|
||||
option(WEBP_LINK_STATIC
|
||||
"Link using static libraries. If OFF, use dynamic libraries."
|
||||
${WEBP_LINK_STATIC_DEFAULT})
|
||||
if(NOT EMSCRIPTEN)
|
||||
# Disable SIMD on Emscripten by default, as it's a new unstable Wasm feature.
|
||||
# Users can still explicitly opt-in to make a SIMD-enabled build.
|
||||
@ -40,6 +48,18 @@ option(WEBP_ENABLE_SWAP_16BIT_CSP "Enable byte swap for 16 bit colorspaces."
|
||||
set(WEBP_BITTRACE "0" CACHE STRING "Bit trace mode (0=none, 1=bit, 2=bytes)")
|
||||
set_property(CACHE WEBP_BITTRACE PROPERTY STRINGS 0 1 2)
|
||||
|
||||
if(WEBP_LINK_STATIC)
|
||||
if(WIN32)
|
||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
# vwebp does not compile on Ubuntu with static libraries so disabling it for
|
||||
# now.
|
||||
set(WEBP_BUILD_VWEBP OFF)
|
||||
endif()
|
||||
|
||||
# Option needed for handling Unicode file names on Windows.
|
||||
if(WIN32)
|
||||
option(WEBP_UNICODE "Build Unicode executables." ON)
|
||||
@ -606,7 +626,7 @@ if(WEBP_BUILD_EXTRAS)
|
||||
|
||||
# vwebp_sdl
|
||||
find_package(SDL)
|
||||
if(SDL_FOUND)
|
||||
if(WEBP_BUILD_VWEBP AND SDL_FOUND)
|
||||
add_executable(vwebp_sdl ${VWEBP_SDL_SRCS})
|
||||
target_link_libraries(vwebp_sdl ${SDL_LIBRARY} imageioutil webp)
|
||||
target_include_directories(vwebp_sdl
|
||||
|
Reference in New Issue
Block a user