mirror of
https://github.com/webmproject/libwebp.git
synced 2025-04-19 23:36:45 +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:
parent
7efcf3cc26
commit
42888f6c7c
@ -15,6 +15,14 @@ endif()
|
|||||||
project(WebP C)
|
project(WebP C)
|
||||||
|
|
||||||
# Options for coder / decoder executables.
|
# 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)
|
if(NOT EMSCRIPTEN)
|
||||||
# Disable SIMD on Emscripten by default, as it's a new unstable Wasm feature.
|
# 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.
|
# 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(WEBP_BITTRACE "0" CACHE STRING "Bit trace mode (0=none, 1=bit, 2=bytes)")
|
||||||
set_property(CACHE WEBP_BITTRACE PROPERTY STRINGS 0 1 2)
|
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.
|
# Option needed for handling Unicode file names on Windows.
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
option(WEBP_UNICODE "Build Unicode executables." ON)
|
option(WEBP_UNICODE "Build Unicode executables." ON)
|
||||||
@ -606,7 +626,7 @@ if(WEBP_BUILD_EXTRAS)
|
|||||||
|
|
||||||
# vwebp_sdl
|
# vwebp_sdl
|
||||||
find_package(SDL)
|
find_package(SDL)
|
||||||
if(SDL_FOUND)
|
if(WEBP_BUILD_VWEBP AND SDL_FOUND)
|
||||||
add_executable(vwebp_sdl ${VWEBP_SDL_SRCS})
|
add_executable(vwebp_sdl ${VWEBP_SDL_SRCS})
|
||||||
target_link_libraries(vwebp_sdl ${SDL_LIBRARY} imageioutil webp)
|
target_link_libraries(vwebp_sdl ${SDL_LIBRARY} imageioutil webp)
|
||||||
target_include_directories(vwebp_sdl
|
target_include_directories(vwebp_sdl
|
||||||
|
@ -74,6 +74,11 @@ endif()
|
|||||||
set(WEBP_DEP_IMG_LIBRARIES)
|
set(WEBP_DEP_IMG_LIBRARIES)
|
||||||
set(WEBP_DEP_IMG_INCLUDE_DIRS)
|
set(WEBP_DEP_IMG_INCLUDE_DIRS)
|
||||||
foreach(I_LIB PNG JPEG TIFF)
|
foreach(I_LIB PNG JPEG TIFF)
|
||||||
|
# Disable tiff when compiling in static mode as it is failing on Ubuntu.
|
||||||
|
if(WEBP_LINK_STATIC AND ${I_LIB} STREQUAL "TIFF")
|
||||||
|
message("TIFF is disabled when statically linking.")
|
||||||
|
continue()
|
||||||
|
endif()
|
||||||
find_package(${I_LIB})
|
find_package(${I_LIB})
|
||||||
set(WEBP_HAVE_${I_LIB} ${${I_LIB}_FOUND})
|
set(WEBP_HAVE_${I_LIB} ${${I_LIB}_FOUND})
|
||||||
if(${I_LIB}_FOUND)
|
if(${I_LIB}_FOUND)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user