mirror of
https://github.com/webmproject/libwebp.git
synced 2025-04-03 23:46:49 +02:00
libwebp: cmake-format all
https://github.com/cheshirekow/cmake_format A complete row of # is replaced by only one, so add a space after the first one to keep it. Change-Id: I367749353a555c89c717f1939220699e43ecab2c
This commit is contained in:
parent
e7a697297b
commit
5c395f1d71
512
CMakeLists.txt
512
CMakeLists.txt
@ -15,8 +15,8 @@ option(WEBP_BUILD_WEBPMUX "Build the webpmux command line tool." ON)
|
|||||||
option(WEBP_BUILD_EXTRAS "Build extras." ON)
|
option(WEBP_BUILD_EXTRAS "Build extras." ON)
|
||||||
option(WEBP_BUILD_WEBP_JS "Emscripten build of webp.js." OFF)
|
option(WEBP_BUILD_WEBP_JS "Emscripten build of webp.js." OFF)
|
||||||
option(WEBP_NEAR_LOSSLESS "Enable near-lossless encoding" ON)
|
option(WEBP_NEAR_LOSSLESS "Enable near-lossless encoding" ON)
|
||||||
option(WEBP_ENABLE_SWAP_16BIT_CSP "Enable byte swap for 16 bit colorspaces." OFF
|
option(WEBP_ENABLE_SWAP_16BIT_CSP "Enable byte swap for 16 bit colorspaces."
|
||||||
)
|
OFF)
|
||||||
|
|
||||||
if(WEBP_BUILD_WEBP_JS)
|
if(WEBP_BUILD_WEBP_JS)
|
||||||
set(WEBP_ENABLE_SIMD OFF)
|
set(WEBP_ENABLE_SIMD OFF)
|
||||||
@ -26,60 +26,61 @@ set(WEBP_DEP_LIBRARIES)
|
|||||||
set(WEBP_DEP_INCLUDE_DIRS)
|
set(WEBP_DEP_INCLUDE_DIRS)
|
||||||
|
|
||||||
if(NOT CMAKE_BUILD_TYPE)
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_BUILD_TYPE "Release" CACHE
|
set(CMAKE_BUILD_TYPE "Release"
|
||||||
"Build type: Release, Debug, MinSizeRel or RelWithDebInfo" STRING FORCE
|
CACHE "Build type: Release, Debug, MinSizeRel or RelWithDebInfo" STRING
|
||||||
)
|
FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Include dependencies.
|
# Include dependencies.
|
||||||
include(cmake/deps.cmake)
|
include(cmake/deps.cmake)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
# Options.
|
# Options.
|
||||||
if(WEBP_ENABLE_SWAP_16BIT_CSP)
|
if(WEBP_ENABLE_SWAP_16BIT_CSP)
|
||||||
add_definitions(-DWEBP_SWAP_16BIT_CSP=1)
|
add_definitions(-DWEBP_SWAP_16BIT_CSP=1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
# Android only.
|
# Android only.
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
include_directories(${ANDROID_NDK}/sources/android/cpufeatures)
|
include_directories(${ANDROID_NDK}/sources/android/cpufeatures)
|
||||||
add_library(cpufeatures STATIC
|
add_library(cpufeatures STATIC
|
||||||
${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c
|
${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c)
|
||||||
)
|
|
||||||
target_link_libraries(cpufeatures dl)
|
target_link_libraries(cpufeatures dl)
|
||||||
set(WEBP_DEP_LIBRARIES ${WEBP_DEP_LIBRARIES} cpufeatures)
|
set(WEBP_DEP_LIBRARIES ${WEBP_DEP_LIBRARIES} cpufeatures)
|
||||||
set(WEBP_DEP_INCLUDE_DIRS ${WEBP_DEP_INCLUDE_DIRS}
|
set(WEBP_DEP_INCLUDE_DIRS ${WEBP_DEP_INCLUDE_DIRS}
|
||||||
${ANDROID_NDK}/sources/android/cpufeatures
|
${ANDROID_NDK}/sources/android/cpufeatures)
|
||||||
)
|
|
||||||
add_definitions(-DHAVE_CPU_FEATURES_H=1)
|
add_definitions(-DHAVE_CPU_FEATURES_H=1)
|
||||||
set(HAVE_CPU_FEATURES_H 1)
|
set(HAVE_CPU_FEATURES_H 1)
|
||||||
else()
|
else()
|
||||||
set(HAVE_CPU_FEATURES_H 0)
|
set(HAVE_CPU_FEATURES_H 0)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
# WebP source files.
|
# WebP source files. Read the Makefile.am to get the source files.
|
||||||
# Read the Makefile.am to get the source files.
|
|
||||||
|
|
||||||
# We expect the Makefiles to define the sources as defined in
|
# We expect the Makefiles to define the sources as defined in the first regex.
|
||||||
# the first regex. E.g.:
|
# E.g.: libimagedec_la_SOURCES = image_dec.c image_dec.h
|
||||||
# libimagedec_la_SOURCES = image_dec.c image_dec.h
|
|
||||||
function(parse_Makefile_am FOLDER VAR SRC_REGEX)
|
function(parse_Makefile_am FOLDER VAR SRC_REGEX)
|
||||||
file(READ ${FOLDER}/Makefile.am MAKEFILE_AM)
|
file(READ ${FOLDER}/Makefile.am MAKEFILE_AM)
|
||||||
string(REGEX MATCHALL "${SRC_REGEX}_SOURCES[ ]*\\+?=[ ]+[0-9a-z\\._ ]*"
|
string(REGEX MATCHALL
|
||||||
FILES_PER_LINE ${MAKEFILE_AM}
|
"${SRC_REGEX}_SOURCES[ ]*\\+?=[ ]+[0-9a-z\\._ ]*"
|
||||||
)
|
FILES_PER_LINE
|
||||||
|
${MAKEFILE_AM})
|
||||||
set(SRCS ${${VAR}})
|
set(SRCS ${${VAR}})
|
||||||
foreach(FILES ${FILES_PER_LINE})
|
foreach(FILES ${FILES_PER_LINE})
|
||||||
string(FIND ${FILES} "=" OFFSET)
|
string(FIND ${FILES} "=" OFFSET)
|
||||||
math(EXPR OFFSET "${OFFSET} + 2")
|
math(EXPR OFFSET "${OFFSET} + 2")
|
||||||
string(SUBSTRING ${FILES} ${OFFSET} -1 FILES)
|
string(SUBSTRING ${FILES}
|
||||||
|
${OFFSET}
|
||||||
|
-1
|
||||||
|
FILES)
|
||||||
if(FILES)
|
if(FILES)
|
||||||
string(REGEX MATCHALL "[0-9a-z\\._]+"
|
string(REGEX MATCHALL
|
||||||
FILES ${FILES}
|
"[0-9a-z\\._]+"
|
||||||
)
|
FILES
|
||||||
|
${FILES})
|
||||||
foreach(FILE ${FILES})
|
foreach(FILE ${FILES})
|
||||||
list(APPEND SRCS ${FOLDER}/${FILE})
|
list(APPEND SRCS ${FOLDER}/${FILE})
|
||||||
endforeach()
|
endforeach()
|
||||||
@ -89,16 +90,16 @@ function(parse_Makefile_am FOLDER VAR SRC_REGEX)
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
set(WEBP_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
set(WEBP_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
parse_Makefile_am(${WEBP_SRC_DIR}/dec "WEBP_DEC_SRCS" "")
|
parse_makefile_am(${WEBP_SRC_DIR}/dec "WEBP_DEC_SRCS" "")
|
||||||
parse_Makefile_am(${WEBP_SRC_DIR}/demux "WEBP_DEMUX_SRCS" "")
|
parse_makefile_am(${WEBP_SRC_DIR}/demux "WEBP_DEMUX_SRCS" "")
|
||||||
parse_Makefile_am(${WEBP_SRC_DIR}/dsp "WEBP_DSP_COMMON_SRCS" "COMMON")
|
parse_makefile_am(${WEBP_SRC_DIR}/dsp "WEBP_DSP_COMMON_SRCS" "COMMON")
|
||||||
parse_Makefile_am(${WEBP_SRC_DIR}/dsp "WEBP_DSP_ENC_SRCS" "ENC")
|
parse_makefile_am(${WEBP_SRC_DIR}/dsp "WEBP_DSP_ENC_SRCS" "ENC")
|
||||||
parse_Makefile_am(${WEBP_SRC_DIR}/dsp "WEBP_DSP_ENC_SRCS" "dsp_[^ ]*")
|
parse_makefile_am(${WEBP_SRC_DIR}/dsp "WEBP_DSP_ENC_SRCS" "dsp_[^ ]*")
|
||||||
parse_Makefile_am(${WEBP_SRC_DIR}/dsp "WEBP_DSP_DEC_SRCS" "decode_[^ ]*")
|
parse_makefile_am(${WEBP_SRC_DIR}/dsp "WEBP_DSP_DEC_SRCS" "decode_[^ ]*")
|
||||||
parse_Makefile_am(${WEBP_SRC_DIR}/enc "WEBP_ENC_SRCS" "")
|
parse_makefile_am(${WEBP_SRC_DIR}/enc "WEBP_ENC_SRCS" "")
|
||||||
parse_Makefile_am(${WEBP_SRC_DIR}/utils "WEBP_UTILS_COMMON_SRCS" "COMMON")
|
parse_makefile_am(${WEBP_SRC_DIR}/utils "WEBP_UTILS_COMMON_SRCS" "COMMON")
|
||||||
parse_Makefile_am(${WEBP_SRC_DIR}/utils "WEBP_UTILS_ENC_SRCS" "ENC")
|
parse_makefile_am(${WEBP_SRC_DIR}/utils "WEBP_UTILS_ENC_SRCS" "ENC")
|
||||||
parse_Makefile_am(${WEBP_SRC_DIR}/utils "WEBP_UTILS_DEC_SRCS" "decode_[^ ]*")
|
parse_makefile_am(${WEBP_SRC_DIR}/utils "WEBP_UTILS_DEC_SRCS" "decode_[^ ]*")
|
||||||
|
|
||||||
# Remove the files specific to SIMD we don't use.
|
# Remove the files specific to SIMD we don't use.
|
||||||
foreach(FILE ${WEBP_SIMD_FILES_NOT_TO_INCLUDE})
|
foreach(FILE ${WEBP_SIMD_FILES_NOT_TO_INCLUDE})
|
||||||
@ -108,10 +109,10 @@ endforeach()
|
|||||||
|
|
||||||
# Generate the config.h file.
|
# Generate the config.h file.
|
||||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/cmake/config.h.in
|
configure_file(${CMAKE_CURRENT_LIST_DIR}/cmake/config.h.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/src/webp/config.h)
|
${CMAKE_CURRENT_BINARY_DIR}/src/webp/config.h)
|
||||||
add_definitions(-DHAVE_CONFIG_H)
|
add_definitions(-DHAVE_CONFIG_H)
|
||||||
|
|
||||||
### Define the mandatory libraries.
|
# ##############################################################################
|
||||||
# Build the webpdecoder library.
|
# Build the webpdecoder library.
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# avoid security warnings for e.g., fopen() used in the examples.
|
# avoid security warnings for e.g., fopen() used in the examples.
|
||||||
@ -121,66 +122,81 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
include_directories(${WEBP_DEP_INCLUDE_DIRS})
|
include_directories(${WEBP_DEP_INCLUDE_DIRS})
|
||||||
add_library(webpdecode OBJECT ${WEBP_DEC_SRCS})
|
add_library(webpdecode OBJECT ${WEBP_DEC_SRCS})
|
||||||
target_include_directories(webpdecode PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
target_include_directories(webpdecode
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
add_library(webpdspdecode OBJECT ${WEBP_DSP_COMMON_SRCS} ${WEBP_DSP_DEC_SRCS})
|
add_library(webpdspdecode OBJECT ${WEBP_DSP_COMMON_SRCS} ${WEBP_DSP_DEC_SRCS})
|
||||||
target_include_directories(webpdspdecode PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
target_include_directories(webpdspdecode
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
add_library(webputilsdecode OBJECT ${WEBP_UTILS_COMMON_SRCS}
|
add_library(webputilsdecode
|
||||||
${WEBP_UTILS_DEC_SRCS}
|
OBJECT
|
||||||
)
|
${WEBP_UTILS_COMMON_SRCS}
|
||||||
target_include_directories(webputilsdecode PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
${WEBP_UTILS_DEC_SRCS})
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
target_include_directories(webputilsdecode
|
||||||
)
|
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
add_library(webpdecoder $<TARGET_OBJECTS:webpdecode>
|
${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
$<TARGET_OBJECTS:webpdspdecode> $<TARGET_OBJECTS:webputilsdecode>)
|
add_library(webpdecoder
|
||||||
|
$<TARGET_OBJECTS:webpdecode>
|
||||||
|
$<TARGET_OBJECTS:webpdspdecode>
|
||||||
|
$<TARGET_OBJECTS:webputilsdecode>)
|
||||||
target_link_libraries(webpdecoder ${WEBP_DEP_LIBRARIES})
|
target_link_libraries(webpdecoder ${WEBP_DEP_LIBRARIES})
|
||||||
target_include_directories(webpdecoder
|
target_include_directories(
|
||||||
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
webpdecoder
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||||
)
|
set_target_properties(
|
||||||
set_target_properties(webpdecoder PROPERTIES PUBLIC_HEADER
|
webpdecoder
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/webp/decode.h;\
|
PROPERTIES PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/src/webp/decode.h;\
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/types.h"
|
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/types.h")
|
||||||
)
|
|
||||||
|
|
||||||
# Build the webp library.
|
# Build the webp library.
|
||||||
add_library(webpencode OBJECT ${WEBP_ENC_SRCS})
|
add_library(webpencode OBJECT ${WEBP_ENC_SRCS})
|
||||||
target_include_directories(webpencode PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
target_include_directories(webpencode
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
add_library(webpdsp OBJECT ${WEBP_DSP_COMMON_SRCS} ${WEBP_DSP_DEC_SRCS}
|
add_library(webpdsp
|
||||||
${WEBP_DSP_ENC_SRCS})
|
OBJECT
|
||||||
target_include_directories(webpdsp PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
${WEBP_DSP_COMMON_SRCS}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${WEBP_DSP_DEC_SRCS}
|
||||||
)
|
${WEBP_DSP_ENC_SRCS})
|
||||||
add_library(webputils OBJECT ${WEBP_UTILS_COMMON_SRCS} ${WEBP_UTILS_DEC_SRCS}
|
target_include_directories(webpdsp
|
||||||
${WEBP_UTILS_ENC_SRCS})
|
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
target_include_directories(webputils PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
add_library(webputils
|
||||||
)
|
OBJECT
|
||||||
add_library(webp $<TARGET_OBJECTS:webpdecode> $<TARGET_OBJECTS:webpdsp>
|
${WEBP_UTILS_COMMON_SRCS}
|
||||||
$<TARGET_OBJECTS:webpencode> $<TARGET_OBJECTS:webputils>)
|
${WEBP_UTILS_DEC_SRCS}
|
||||||
|
${WEBP_UTILS_ENC_SRCS})
|
||||||
|
target_include_directories(webputils
|
||||||
|
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
add_library(webp
|
||||||
|
$<TARGET_OBJECTS:webpdecode>
|
||||||
|
$<TARGET_OBJECTS:webpdsp>
|
||||||
|
$<TARGET_OBJECTS:webpencode>
|
||||||
|
$<TARGET_OBJECTS:webputils>)
|
||||||
target_link_libraries(webp ${WEBP_DEP_LIBRARIES})
|
target_link_libraries(webp ${WEBP_DEP_LIBRARIES})
|
||||||
target_include_directories(webp
|
target_include_directories(webp
|
||||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
PUBLIC $<INSTALL_INTERFACE:include>
|
PUBLIC $<INSTALL_INTERFACE:include>)
|
||||||
)
|
set_target_properties(
|
||||||
set_target_properties(webp PROPERTIES PUBLIC_HEADER
|
webp
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/webp/decode.h;\
|
PROPERTIES PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/src/webp/decode.h;\
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/encode.h;\
|
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/encode.h;\
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/types.h"
|
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/types.h")
|
||||||
)
|
|
||||||
|
|
||||||
# Make sure the OBJECT libraries are built with position independent code
|
# Make sure the OBJECT libraries are built with position independent code (it is
|
||||||
# (it is not ON by default).
|
# not ON by default).
|
||||||
set_target_properties(webpdecode webpdspdecode webputilsdecode
|
set_target_properties(webpdecode
|
||||||
webpencode webpdsp webputils PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
webpdspdecode
|
||||||
|
webputilsdecode
|
||||||
|
webpencode
|
||||||
|
webpdsp
|
||||||
|
webputils
|
||||||
|
PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|
||||||
# Build the webp demux library.
|
# Build the webp demux library.
|
||||||
add_library(webpdemux ${WEBP_DEMUX_SRCS})
|
add_library(webpdemux ${WEBP_DEMUX_SRCS})
|
||||||
@ -188,54 +204,75 @@ target_link_libraries(webpdemux webp)
|
|||||||
target_include_directories(webpdemux
|
target_include_directories(webpdemux
|
||||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
PUBLIC $<INSTALL_INTERFACE:include>
|
PUBLIC $<INSTALL_INTERFACE:include>)
|
||||||
)
|
set_target_properties(
|
||||||
set_target_properties(webpdemux PROPERTIES PUBLIC_HEADER
|
webpdemux
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/webp/decode.h;\
|
PROPERTIES PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/src/webp/decode.h;\
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/demux.h;\
|
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/demux.h;\
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/mux_types.h;\
|
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/mux_types.h;\
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/types.h"
|
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/types.h")
|
||||||
)
|
|
||||||
|
|
||||||
# Set the version numbers.
|
# Set the version numbers.
|
||||||
function(parse_version FILE NAME VAR)
|
function(parse_version FILE NAME VAR)
|
||||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/src/${FILE} SOURCE_FILE)
|
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/src/${FILE} SOURCE_FILE)
|
||||||
string(REGEX MATCH "${NAME}_la_LDFLAGS[^\n]* -version-info [0-9:]+" TMP
|
string(REGEX MATCH
|
||||||
${SOURCE_FILE})
|
"${NAME}_la_LDFLAGS[^\n]* -version-info [0-9:]+"
|
||||||
string(REGEX MATCH "[0-9:]+" TMP ${TMP})
|
TMP
|
||||||
string(REGEX REPLACE ":" "." VERSION ${TMP})
|
${SOURCE_FILE})
|
||||||
|
string(REGEX MATCH
|
||||||
|
"[0-9:]+"
|
||||||
|
TMP
|
||||||
|
${TMP})
|
||||||
|
string(REGEX
|
||||||
|
REPLACE ":"
|
||||||
|
"."
|
||||||
|
VERSION
|
||||||
|
${TMP})
|
||||||
set(${VAR} "${VERSION}" PARENT_SCOPE)
|
set(${VAR} "${VERSION}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
parse_version(Makefile.am webp WEBP_WEBP_SOVERSION)
|
parse_version(Makefile.am webp WEBP_WEBP_SOVERSION)
|
||||||
set_target_properties(webp PROPERTIES VERSION ${PACKAGE_VERSION}
|
set_target_properties(webp
|
||||||
SOVERSION ${WEBP_WEBP_SOVERSION})
|
PROPERTIES VERSION
|
||||||
|
${PACKAGE_VERSION}
|
||||||
|
SOVERSION
|
||||||
|
${WEBP_WEBP_SOVERSION})
|
||||||
parse_version(Makefile.am webpdecoder WEBP_DECODER_SOVERSION)
|
parse_version(Makefile.am webpdecoder WEBP_DECODER_SOVERSION)
|
||||||
set_target_properties(webpdecoder PROPERTIES VERSION ${PACKAGE_VERSION}
|
set_target_properties(webpdecoder
|
||||||
SOVERSION ${WEBP_DECODER_SOVERSION})
|
PROPERTIES VERSION
|
||||||
|
${PACKAGE_VERSION}
|
||||||
|
SOVERSION
|
||||||
|
${WEBP_DECODER_SOVERSION})
|
||||||
parse_version(demux/Makefile.am webpdemux WEBP_DEMUX_SOVERSION)
|
parse_version(demux/Makefile.am webpdemux WEBP_DEMUX_SOVERSION)
|
||||||
set_target_properties(webpdemux PROPERTIES VERSION ${PACKAGE_VERSION}
|
set_target_properties(webpdemux
|
||||||
SOVERSION ${WEBP_DEMUX_SOVERSION})
|
PROPERTIES VERSION
|
||||||
|
${PACKAGE_VERSION}
|
||||||
|
SOVERSION
|
||||||
|
${WEBP_DEMUX_SOVERSION})
|
||||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/configure.ac CONFIGURE_FILE)
|
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/configure.ac CONFIGURE_FILE)
|
||||||
string(REGEX MATCH "AC_INIT\\([^\n]*\\[[0-9\\.]+\\]" TMP
|
string(REGEX MATCH
|
||||||
${CONFIGURE_FILE})
|
"AC_INIT\\([^\n]*\\[[0-9\\.]+\\]"
|
||||||
string(REGEX MATCH "[0-9\\.]+" PROJECT_VERSION ${TMP})
|
TMP
|
||||||
|
${CONFIGURE_FILE})
|
||||||
|
string(REGEX MATCH
|
||||||
|
"[0-9\\.]+"
|
||||||
|
PROJECT_VERSION
|
||||||
|
${TMP})
|
||||||
|
|
||||||
# Define the libraries to install.
|
# Define the libraries to install.
|
||||||
set(INSTALLED_LIBRARIES webpdecoder webp webpdemux)
|
set(INSTALLED_LIBRARIES webpdecoder webp webpdemux)
|
||||||
|
|
||||||
### Deal with SIMD.
|
# Deal with SIMD. Change the compile flags for SIMD files we use.
|
||||||
# Change the compile flags for SIMD files we use.
|
|
||||||
list(LENGTH WEBP_SIMD_FILES_TO_INCLUDE WEBP_SIMD_FILES_TO_INCLUDE_LENGTH)
|
list(LENGTH WEBP_SIMD_FILES_TO_INCLUDE WEBP_SIMD_FILES_TO_INCLUDE_LENGTH)
|
||||||
math(EXPR WEBP_SIMD_FILES_TO_INCLUDE_RANGE
|
math(EXPR WEBP_SIMD_FILES_TO_INCLUDE_RANGE
|
||||||
"${WEBP_SIMD_FILES_TO_INCLUDE_LENGTH}-1"
|
"${WEBP_SIMD_FILES_TO_INCLUDE_LENGTH}-1")
|
||||||
)
|
|
||||||
|
|
||||||
foreach(I_FILE RANGE ${WEBP_SIMD_FILES_TO_INCLUDE_RANGE})
|
foreach(I_FILE RANGE ${WEBP_SIMD_FILES_TO_INCLUDE_RANGE})
|
||||||
list(GET WEBP_SIMD_FILES_TO_INCLUDE ${I_FILE} FILE)
|
list(GET WEBP_SIMD_FILES_TO_INCLUDE ${I_FILE} FILE)
|
||||||
list(GET WEBP_SIMD_FLAGS_TO_INCLUDE ${I_FILE} SIMD_COMPILE_FLAG)
|
list(GET WEBP_SIMD_FLAGS_TO_INCLUDE ${I_FILE} SIMD_COMPILE_FLAG)
|
||||||
set_source_files_properties(${FILE} PROPERTIES
|
set_source_files_properties(${FILE}
|
||||||
COMPILE_FLAGS ${SIMD_COMPILE_FLAG}
|
PROPERTIES
|
||||||
)
|
COMPILE_FLAGS
|
||||||
|
${SIMD_COMPILE_FLAG})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if(WEBP_BUILD_GIF2WEBP AND NOT GIF_FOUND)
|
if(WEBP_BUILD_GIF2WEBP AND NOT GIF_FOUND)
|
||||||
@ -247,45 +284,54 @@ if(WEBP_BUILD_ANIM_UTILS AND NOT GIF_FOUND)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Build the executables if asked for.
|
# Build the executables if asked for.
|
||||||
if(WEBP_BUILD_ANIM_UTILS OR WEBP_BUILD_CWEBP OR WEBP_BUILD_DWEBP OR
|
if(WEBP_BUILD_ANIM_UTILS
|
||||||
WEBP_BUILD_GIF2WEBP OR WEBP_BUILD_IMG2WEBP OR WEBP_BUILD_VWEBP OR
|
OR WEBP_BUILD_CWEBP
|
||||||
WEBP_BUILD_WEBP_JS)
|
OR WEBP_BUILD_DWEBP
|
||||||
|
OR WEBP_BUILD_GIF2WEBP
|
||||||
|
OR WEBP_BUILD_IMG2WEBP
|
||||||
|
OR WEBP_BUILD_VWEBP
|
||||||
|
OR WEBP_BUILD_WEBP_JS)
|
||||||
# Example utility library.
|
# Example utility library.
|
||||||
parse_Makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "EXAMPLEUTIL_SRCS"
|
parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "EXAMPLEUTIL_SRCS"
|
||||||
"example_util_[^ ]*")
|
"example_util_[^ ]*")
|
||||||
list(APPEND EXAMPLEUTIL_SRCS
|
list(APPEND EXAMPLEUTIL_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/examples/stopwatch.h)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/examples/stopwatch.h)
|
|
||||||
add_library(exampleutil ${EXAMPLEUTIL_SRCS})
|
add_library(exampleutil ${EXAMPLEUTIL_SRCS})
|
||||||
target_include_directories(exampleutil
|
target_include_directories(
|
||||||
|
exampleutil
|
||||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)
|
||||||
|
|
||||||
parse_Makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/imageio "IMAGEIOUTILS_SRCS"
|
parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/imageio "IMAGEIOUTILS_SRCS"
|
||||||
"imageio_util_[^ ]*")
|
"imageio_util_[^ ]*")
|
||||||
add_library(imageioutil ${IMAGEIOUTILS_SRCS})
|
add_library(imageioutil ${IMAGEIOUTILS_SRCS})
|
||||||
target_link_libraries(imageioutil webp)
|
target_link_libraries(imageioutil webp)
|
||||||
|
|
||||||
# Image-decoding utility library.
|
# Image-decoding utility library.
|
||||||
parse_Makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/imageio "IMAGEDEC_SRCS"
|
parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/imageio "IMAGEDEC_SRCS"
|
||||||
"imagedec_[^ ]*")
|
"imagedec_[^ ]*")
|
||||||
add_library(imagedec ${IMAGEDEC_SRCS})
|
add_library(imagedec ${IMAGEDEC_SRCS})
|
||||||
target_link_libraries(imagedec imageioutil webpdemux webp
|
target_link_libraries(imagedec
|
||||||
${WEBP_DEP_IMG_LIBRARIES})
|
imageioutil
|
||||||
|
webpdemux
|
||||||
|
webp
|
||||||
|
${WEBP_DEP_IMG_LIBRARIES})
|
||||||
|
|
||||||
# Image-encoding utility library.
|
# Image-encoding utility library.
|
||||||
parse_Makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/imageio "IMAGEENC_SRCS"
|
parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/imageio "IMAGEENC_SRCS"
|
||||||
"imageenc_[^ ]*")
|
"imageenc_[^ ]*")
|
||||||
add_library(imageenc ${IMAGEENC_SRCS})
|
add_library(imageenc ${IMAGEENC_SRCS})
|
||||||
target_link_libraries(imageenc webp)
|
target_link_libraries(imageenc webp)
|
||||||
|
|
||||||
set_property(TARGET exampleutil imageioutil imagedec imageenc
|
set_property(TARGET exampleutil
|
||||||
PROPERTY INCLUDE_DIRECTORIES
|
imageioutil
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src)
|
imagedec
|
||||||
|
imageenc
|
||||||
|
PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WEBP_BUILD_DWEBP)
|
if(WEBP_BUILD_DWEBP)
|
||||||
# dwebp
|
# dwebp
|
||||||
parse_Makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "DWEBP_SRCS"
|
parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "DWEBP_SRCS" "dwebp")
|
||||||
"dwebp")
|
|
||||||
add_executable(dwebp ${DWEBP_SRCS})
|
add_executable(dwebp ${DWEBP_SRCS})
|
||||||
target_link_libraries(dwebp exampleutil imagedec imageenc)
|
target_link_libraries(dwebp exampleutil imagedec imageenc)
|
||||||
target_include_directories(dwebp PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src)
|
target_include_directories(dwebp PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||||
@ -294,8 +340,7 @@ endif()
|
|||||||
|
|
||||||
if(WEBP_BUILD_CWEBP)
|
if(WEBP_BUILD_CWEBP)
|
||||||
# cwebp
|
# cwebp
|
||||||
parse_Makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "CWEBP_SRCS"
|
parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "CWEBP_SRCS" "cwebp")
|
||||||
"cwebp")
|
|
||||||
add_executable(cwebp ${CWEBP_SRCS})
|
add_executable(cwebp ${CWEBP_SRCS})
|
||||||
target_link_libraries(cwebp exampleutil imagedec webp)
|
target_link_libraries(cwebp exampleutil imagedec webp)
|
||||||
target_include_directories(cwebp PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src)
|
target_include_directories(cwebp PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||||
@ -303,20 +348,23 @@ if(WEBP_BUILD_CWEBP)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WEBP_BUILD_GIF2WEBP OR WEBP_BUILD_IMG2WEBP)
|
if(WEBP_BUILD_GIF2WEBP OR WEBP_BUILD_IMG2WEBP)
|
||||||
parse_Makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/src/mux "WEBP_MUX_SRCS"
|
parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/src/mux "WEBP_MUX_SRCS" "")
|
||||||
"")
|
|
||||||
add_library(libwebpmux ${WEBP_MUX_SRCS})
|
add_library(libwebpmux ${WEBP_MUX_SRCS})
|
||||||
target_link_libraries(libwebpmux webp)
|
target_link_libraries(libwebpmux webp)
|
||||||
target_include_directories(libwebpmux
|
target_include_directories(libwebpmux
|
||||||
PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
parse_version(mux/Makefile.am webpmux WEBP_MUX_SOVERSION)
|
parse_version(mux/Makefile.am webpmux WEBP_MUX_SOVERSION)
|
||||||
set_target_properties(libwebpmux PROPERTIES VERSION ${PACKAGE_VERSION}
|
set_target_properties(libwebpmux
|
||||||
SOVERSION ${WEBP_MUX_SOVERSION})
|
PROPERTIES VERSION
|
||||||
set_target_properties(libwebpmux PROPERTIES PUBLIC_HEADER
|
${PACKAGE_VERSION}
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/webp/mux.h;\
|
SOVERSION
|
||||||
|
${WEBP_MUX_SOVERSION})
|
||||||
|
set_target_properties(libwebpmux
|
||||||
|
PROPERTIES PUBLIC_HEADER
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/webp/mux.h;\
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/mux_types.h;\
|
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/mux_types.h;\
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/types.h;"
|
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/types.h;")
|
||||||
)
|
|
||||||
set_target_properties(libwebpmux PROPERTIES OUTPUT_NAME webpmux)
|
set_target_properties(libwebpmux PROPERTIES OUTPUT_NAME webpmux)
|
||||||
list(APPEND INSTALLED_LIBRARIES libwebpmux)
|
list(APPEND INSTALLED_LIBRARIES libwebpmux)
|
||||||
endif()
|
endif()
|
||||||
@ -324,11 +372,15 @@ endif()
|
|||||||
if(WEBP_BUILD_GIF2WEBP)
|
if(WEBP_BUILD_GIF2WEBP)
|
||||||
# gif2webp
|
# gif2webp
|
||||||
include_directories(${WEBP_DEP_GIF_INCLUDE_DIRS})
|
include_directories(${WEBP_DEP_GIF_INCLUDE_DIRS})
|
||||||
parse_Makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "GIF2WEBP_SRCS"
|
parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "GIF2WEBP_SRCS"
|
||||||
"gif2webp")
|
"gif2webp")
|
||||||
add_executable(gif2webp ${GIF2WEBP_SRCS})
|
add_executable(gif2webp ${GIF2WEBP_SRCS})
|
||||||
target_link_libraries(gif2webp exampleutil imageioutil webp libwebpmux
|
target_link_libraries(gif2webp
|
||||||
${WEBP_DEP_GIF_LIBRARIES})
|
exampleutil
|
||||||
|
imageioutil
|
||||||
|
webp
|
||||||
|
libwebpmux
|
||||||
|
${WEBP_DEP_GIF_LIBRARIES})
|
||||||
target_include_directories(gif2webp PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src)
|
target_include_directories(gif2webp PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||||
install(TARGETS gif2webp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install(TARGETS gif2webp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
endif()
|
endif()
|
||||||
@ -336,11 +388,15 @@ endif()
|
|||||||
if(WEBP_BUILD_IMG2WEBP)
|
if(WEBP_BUILD_IMG2WEBP)
|
||||||
# img2webp
|
# img2webp
|
||||||
include_directories(${WEBP_DEP_IMG_INCLUDE_DIRS})
|
include_directories(${WEBP_DEP_IMG_INCLUDE_DIRS})
|
||||||
parse_Makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "IMG2WEBP_SRCS"
|
parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "IMG2WEBP_SRCS"
|
||||||
"img2webp")
|
"img2webp")
|
||||||
add_executable(img2webp ${IMG2WEBP_SRCS})
|
add_executable(img2webp ${IMG2WEBP_SRCS})
|
||||||
target_link_libraries(img2webp exampleutil imagedec imageioutil webp
|
target_link_libraries(img2webp
|
||||||
libwebpmux)
|
exampleutil
|
||||||
|
imagedec
|
||||||
|
imageioutil
|
||||||
|
webp
|
||||||
|
libwebpmux)
|
||||||
target_include_directories(img2webp PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src)
|
target_include_directories(img2webp PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||||
install(TARGETS img2webp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install(TARGETS img2webp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
endif()
|
endif()
|
||||||
@ -350,13 +406,19 @@ if(WEBP_BUILD_VWEBP)
|
|||||||
find_package(GLUT)
|
find_package(GLUT)
|
||||||
if(GLUT_FOUND)
|
if(GLUT_FOUND)
|
||||||
include_directories(${WEBP_DEP_IMG_INCLUDE_DIRS})
|
include_directories(${WEBP_DEP_IMG_INCLUDE_DIRS})
|
||||||
parse_Makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "VWEBP_SRCS"
|
parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "VWEBP_SRCS" "vwebp")
|
||||||
"vwebp")
|
|
||||||
add_executable(vwebp ${VWEBP_SRCS})
|
add_executable(vwebp ${VWEBP_SRCS})
|
||||||
target_link_libraries(vwebp ${OPENGL_LIBRARIES} exampleutil GLUT::GLUT
|
target_link_libraries(vwebp
|
||||||
imageioutil webp webpdemux)
|
${OPENGL_LIBRARIES}
|
||||||
target_include_directories(vwebp PRIVATE GLUT::GLUT
|
exampleutil
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/src ${OPENGL_INCLUDE_DIR})
|
GLUT::GLUT
|
||||||
|
imageioutil
|
||||||
|
webp
|
||||||
|
webpdemux)
|
||||||
|
target_include_directories(vwebp
|
||||||
|
PRIVATE GLUT::GLUT
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/src
|
||||||
|
${OPENGL_INCLUDE_DIR})
|
||||||
install(TARGETS vwebp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install(TARGETS vwebp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||||
check_c_compiler_flag("-Wno-deprecated-declarations" HAS_NO_DEPRECATED)
|
check_c_compiler_flag("-Wno-deprecated-declarations" HAS_NO_DEPRECATED)
|
||||||
@ -370,8 +432,8 @@ endif()
|
|||||||
if(WEBP_BUILD_WEBPINFO)
|
if(WEBP_BUILD_WEBPINFO)
|
||||||
# webpinfo
|
# webpinfo
|
||||||
include_directories(${WEBP_DEP_IMG_INCLUDE_DIRS})
|
include_directories(${WEBP_DEP_IMG_INCLUDE_DIRS})
|
||||||
parse_Makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "WEBPINFO_SRCS"
|
parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "WEBPINFO_SRCS"
|
||||||
"webpinfo")
|
"webpinfo")
|
||||||
add_executable(webpinfo ${WEBPINFO_SRCS})
|
add_executable(webpinfo ${WEBPINFO_SRCS})
|
||||||
target_link_libraries(webpinfo exampleutil imageioutil)
|
target_link_libraries(webpinfo exampleutil imageioutil)
|
||||||
target_include_directories(webpinfo PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src)
|
target_include_directories(webpinfo PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||||
@ -380,8 +442,8 @@ endif()
|
|||||||
|
|
||||||
if(WEBP_BUILD_WEBPMUX)
|
if(WEBP_BUILD_WEBPMUX)
|
||||||
# webpmux
|
# webpmux
|
||||||
parse_Makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "WEBPMUX_SRCS"
|
parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "WEBPMUX_SRCS"
|
||||||
"webpmux")
|
"webpmux")
|
||||||
add_executable(webpmux ${WEBPMUX_SRCS})
|
add_executable(webpmux ${WEBPMUX_SRCS})
|
||||||
target_link_libraries(webpmux exampleutil imageioutil libwebpmux webp)
|
target_link_libraries(webpmux exampleutil imageioutil libwebpmux webp)
|
||||||
target_include_directories(webpmux PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src)
|
target_include_directories(webpmux PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||||
@ -390,16 +452,18 @@ endif()
|
|||||||
|
|
||||||
if(WEBP_BUILD_EXTRAS)
|
if(WEBP_BUILD_EXTRAS)
|
||||||
set(EXTRAS_MAKEFILE "${CMAKE_CURRENT_SOURCE_DIR}/extras")
|
set(EXTRAS_MAKEFILE "${CMAKE_CURRENT_SOURCE_DIR}/extras")
|
||||||
parse_Makefile_am(${EXTRAS_MAKEFILE} "WEBP_EXTRAS_SRCS" "libwebpextras_la")
|
parse_makefile_am(${EXTRAS_MAKEFILE} "WEBP_EXTRAS_SRCS" "libwebpextras_la")
|
||||||
parse_Makefile_am(${EXTRAS_MAKEFILE} "GET_DISTO_SRCS" "get_disto")
|
parse_makefile_am(${EXTRAS_MAKEFILE} "GET_DISTO_SRCS" "get_disto")
|
||||||
parse_Makefile_am(${EXTRAS_MAKEFILE} "WEBP_QUALITY_SRCS" "webp_quality")
|
parse_makefile_am(${EXTRAS_MAKEFILE} "WEBP_QUALITY_SRCS" "webp_quality")
|
||||||
parse_Makefile_am(${EXTRAS_MAKEFILE} "VWEBP_SDL_SRCS" "vwebp_sdl")
|
parse_makefile_am(${EXTRAS_MAKEFILE} "VWEBP_SDL_SRCS" "vwebp_sdl")
|
||||||
|
|
||||||
# get_disto
|
# get_disto
|
||||||
add_executable(get_disto ${GET_DISTO_SRCS})
|
add_executable(get_disto ${GET_DISTO_SRCS})
|
||||||
target_link_libraries(get_disto imagedec)
|
target_link_libraries(get_disto imagedec)
|
||||||
target_include_directories(get_disto PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
target_include_directories(get_disto
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src)
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||||
install(TARGETS get_disto RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install(TARGETS get_disto RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
|
|
||||||
# webp_quality
|
# webp_quality
|
||||||
@ -413,9 +477,12 @@ if(WEBP_BUILD_EXTRAS)
|
|||||||
if(SDL_FOUND)
|
if(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 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
target_include_directories(vwebp_sdl
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/src ${SDL_INCLUDE_DIR})
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/src
|
||||||
|
${SDL_INCLUDE_DIR})
|
||||||
set(WEBP_HAVE_SDL 1)
|
set(WEBP_HAVE_SDL 1)
|
||||||
target_compile_definitions(vwebp_sdl PUBLIC WEBP_HAVE_SDL)
|
target_compile_definitions(vwebp_sdl PUBLIC WEBP_HAVE_SDL)
|
||||||
install(TARGETS vwebp_sdl RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install(TARGETS vwebp_sdl RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
@ -428,8 +495,10 @@ if(WEBP_BUILD_WEBP_JS)
|
|||||||
target_link_libraries(webp_js webpdecoder SDL)
|
target_link_libraries(webp_js webpdecoder SDL)
|
||||||
target_include_directories(webp_js PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
target_include_directories(webp_js PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
set(WEBP_HAVE_SDL 1)
|
set(WEBP_HAVE_SDL 1)
|
||||||
set_target_properties(webp_js PROPERTIES LINK_FLAGS
|
set_target_properties(
|
||||||
"-s EXPORTED_FUNCTIONS='[\"_WebpToSDL\"]' -s INVOKE_RUN=0 \
|
webp_js
|
||||||
|
PROPERTIES LINK_FLAGS
|
||||||
|
"-s EXPORTED_FUNCTIONS='[\"_WebpToSDL\"]' -s INVOKE_RUN=0 \
|
||||||
-s EXTRA_EXPORTED_RUNTIME_METHODS='[\"cwrap\"]'")
|
-s EXTRA_EXPORTED_RUNTIME_METHODS='[\"cwrap\"]'")
|
||||||
set_target_properties(webp_js PROPERTIES OUTPUT_NAME webp)
|
set_target_properties(webp_js PROPERTIES OUTPUT_NAME webp)
|
||||||
target_compile_definitions(webp_js PUBLIC EMSCRIPTEN WEBP_HAVE_SDL)
|
target_compile_definitions(webp_js PUBLIC EMSCRIPTEN WEBP_HAVE_SDL)
|
||||||
@ -438,8 +507,9 @@ if(WEBP_BUILD_WEBP_JS)
|
|||||||
add_executable(webp_wasm ${CMAKE_CURRENT_SOURCE_DIR}/extras/webp_to_sdl.c)
|
add_executable(webp_wasm ${CMAKE_CURRENT_SOURCE_DIR}/extras/webp_to_sdl.c)
|
||||||
target_link_libraries(webp_wasm webpdecoder SDL)
|
target_link_libraries(webp_wasm webpdecoder SDL)
|
||||||
target_include_directories(webp_wasm PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
target_include_directories(webp_wasm PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
set_target_properties(webp_wasm PROPERTIES LINK_FLAGS
|
set_target_properties(
|
||||||
"-s WASM=1 -s 'BINARYEN_METHOD=\"native-wasm\"' \
|
webp_wasm
|
||||||
|
PROPERTIES LINK_FLAGS "-s WASM=1 -s 'BINARYEN_METHOD=\"native-wasm\"' \
|
||||||
-s EXPORTED_FUNCTIONS='[\"_WebpToSDL\"]' -s INVOKE_RUN=0 \
|
-s EXPORTED_FUNCTIONS='[\"_WebpToSDL\"]' -s INVOKE_RUN=0 \
|
||||||
-s EXTRA_EXPORTED_RUNTIME_METHODS='[\"cwrap\"]'")
|
-s EXTRA_EXPORTED_RUNTIME_METHODS='[\"cwrap\"]'")
|
||||||
target_compile_definitions(webp_wasm PUBLIC EMSCRIPTEN WEBP_HAVE_SDL)
|
target_compile_definitions(webp_wasm PUBLIC EMSCRIPTEN WEBP_HAVE_SDL)
|
||||||
@ -449,71 +519,90 @@ endif()
|
|||||||
|
|
||||||
if(WEBP_BUILD_ANIM_UTILS)
|
if(WEBP_BUILD_ANIM_UTILS)
|
||||||
# anim_diff
|
# anim_diff
|
||||||
include_directories(${WEBP_DEP_IMG_INCLUDE_DIRS}
|
include_directories(${WEBP_DEP_IMG_INCLUDE_DIRS} ${WEBP_DEP_GIF_INCLUDE_DIRS})
|
||||||
${WEBP_DEP_GIF_INCLUDE_DIRS})
|
parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "ANIM_DIFF_SRCS"
|
||||||
parse_Makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "ANIM_DIFF_SRCS"
|
"anim_diff")
|
||||||
"anim_diff")
|
|
||||||
add_executable(anim_diff ${ANIM_DIFF_SRCS})
|
add_executable(anim_diff ${ANIM_DIFF_SRCS})
|
||||||
target_link_libraries(anim_diff exampleutil imagedec imageenc imageioutil
|
target_link_libraries(anim_diff
|
||||||
webp libwebpmux webpdemux ${WEBP_DEP_GIF_LIBRARIES})
|
exampleutil
|
||||||
|
imagedec
|
||||||
|
imageenc
|
||||||
|
imageioutil
|
||||||
|
webp
|
||||||
|
libwebpmux
|
||||||
|
webpdemux
|
||||||
|
${WEBP_DEP_GIF_LIBRARIES})
|
||||||
target_include_directories(anim_diff PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src)
|
target_include_directories(anim_diff PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||||
|
|
||||||
# anim_dump
|
# anim_dump
|
||||||
include_directories(${WEBP_DEP_IMG_INCLUDE_DIRS}
|
include_directories(${WEBP_DEP_IMG_INCLUDE_DIRS} ${WEBP_DEP_GIF_INCLUDE_DIRS})
|
||||||
${WEBP_DEP_GIF_INCLUDE_DIRS})
|
parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "ANIM_DUMP_SRCS"
|
||||||
parse_Makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "ANIM_DUMP_SRCS"
|
"anim_dump")
|
||||||
"anim_dump")
|
|
||||||
add_executable(anim_dump ${ANIM_DUMP_SRCS})
|
add_executable(anim_dump ${ANIM_DUMP_SRCS})
|
||||||
target_link_libraries(anim_dump exampleutil imagedec imageenc imageioutil
|
target_link_libraries(anim_dump
|
||||||
webp libwebpmux webpdemux ${WEBP_DEP_GIF_LIBRARIES})
|
exampleutil
|
||||||
|
imagedec
|
||||||
|
imageenc
|
||||||
|
imageioutil
|
||||||
|
webp
|
||||||
|
libwebpmux
|
||||||
|
webpdemux
|
||||||
|
${WEBP_DEP_GIF_LIBRARIES})
|
||||||
target_include_directories(anim_dump PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src)
|
target_include_directories(anim_dump PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Install the different headers and libraries.
|
# Install the different headers and libraries.
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
install(
|
install(TARGETS ${INSTALLED_LIBRARIES}
|
||||||
TARGETS ${INSTALLED_LIBRARIES}
|
EXPORT ${PROJECT_NAME}Targets
|
||||||
EXPORT ${PROJECT_NAME}Targets
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/webp
|
||||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/webp
|
INCLUDES
|
||||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
)
|
|
||||||
set(ConfigPackageLocation ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake/)
|
set(ConfigPackageLocation ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake/)
|
||||||
install(EXPORT ${PROJECT_NAME}Targets
|
install(EXPORT ${PROJECT_NAME}Targets
|
||||||
NAMESPACE ${PROJECT_NAME}::
|
NAMESPACE ${PROJECT_NAME}::
|
||||||
DESTINATION ${ConfigPackageLocation}
|
DESTINATION ${ConfigPackageLocation})
|
||||||
)
|
|
||||||
|
|
||||||
# Create the CMake version file.
|
# Create the CMake version file.
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
write_basic_package_version_file(
|
write_basic_package_version_file(
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/WebPConfigVersion.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/WebPConfigVersion.cmake"
|
||||||
VERSION ${PACKAGE_VERSION}
|
VERSION ${PACKAGE_VERSION}
|
||||||
COMPATIBILITY AnyNewerVersion
|
COMPATIBILITY AnyNewerVersion)
|
||||||
)
|
|
||||||
|
|
||||||
# Create the Config file.
|
# Create the Config file.
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
configure_package_config_file(
|
configure_package_config_file(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/WebPConfig.cmake.in
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake/WebPConfig.cmake.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/WebPConfig.cmake
|
${CMAKE_CURRENT_BINARY_DIR}/WebPConfig.cmake
|
||||||
INSTALL_DESTINATION ${ConfigPackageLocation}
|
INSTALL_DESTINATION
|
||||||
)
|
${ConfigPackageLocation})
|
||||||
|
|
||||||
# Install the generated CMake files.
|
# Install the generated CMake files.
|
||||||
install(
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/WebPConfigVersion.cmake"
|
||||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/WebPConfigVersion.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/WebPConfig.cmake"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/WebPConfig.cmake"
|
DESTINATION ${ConfigPackageLocation})
|
||||||
DESTINATION ${ConfigPackageLocation}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Install the man pages.
|
# Install the man pages.
|
||||||
set(MAN_PAGES cwebp.1 dwebp.1 gif2webp.1 img2webp.1 vwebp.1 webpmux.1
|
set(MAN_PAGES
|
||||||
webpinfo.1)
|
cwebp.1
|
||||||
set(EXEC_BUILDS "CWEBP" "DWEBP" "GIF2WEBP" "IMG2WEBP" "VWEBP" "WEBPMUX"
|
dwebp.1
|
||||||
"WEBPINFO")
|
gif2webp.1
|
||||||
|
img2webp.1
|
||||||
|
vwebp.1
|
||||||
|
webpmux.1
|
||||||
|
webpinfo.1)
|
||||||
|
set(EXEC_BUILDS
|
||||||
|
"CWEBP"
|
||||||
|
"DWEBP"
|
||||||
|
"GIF2WEBP"
|
||||||
|
"IMG2WEBP"
|
||||||
|
"VWEBP"
|
||||||
|
"WEBPMUX"
|
||||||
|
"WEBPINFO")
|
||||||
list(LENGTH MAN_PAGES MAN_PAGES_LENGTH)
|
list(LENGTH MAN_PAGES MAN_PAGES_LENGTH)
|
||||||
math(EXPR MAN_PAGES_RANGE "${MAN_PAGES_LENGTH} - 1")
|
math(EXPR MAN_PAGES_RANGE "${MAN_PAGES_LENGTH} - 1")
|
||||||
|
|
||||||
@ -522,8 +611,7 @@ foreach(I_MAN RANGE ${MAN_PAGES_RANGE})
|
|||||||
if(WEBP_BUILD_${EXEC_BUILD})
|
if(WEBP_BUILD_${EXEC_BUILD})
|
||||||
list(GET MAN_PAGES ${I_MAN} MAN_PAGE)
|
list(GET MAN_PAGES ${I_MAN} MAN_PAGE)
|
||||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/man/${MAN_PAGE}
|
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/man/${MAN_PAGE}
|
||||||
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
|
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
|
||||||
COMPONENT doc
|
COMPONENT doc)
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
## Check for SIMD extensions.
|
# Check for SIMD extensions.
|
||||||
include(CMakePushCheckState)
|
include(CMakePushCheckState)
|
||||||
|
|
||||||
function(webp_check_compiler_flag WEBP_SIMD_FLAG ENABLE_SIMD)
|
function(webp_check_compiler_flag WEBP_SIMD_FLAG ENABLE_SIMD)
|
||||||
@ -18,8 +18,7 @@ function(webp_check_compiler_flag WEBP_SIMD_FLAG ENABLE_SIMD)
|
|||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
" WEBP_HAVE_FLAG_${WEBP_SIMD_FLAG}
|
" WEBP_HAVE_FLAG_${WEBP_SIMD_FLAG})
|
||||||
)
|
|
||||||
cmake_pop_check_state()
|
cmake_pop_check_state()
|
||||||
if(WEBP_HAVE_FLAG_${WEBP_SIMD_FLAG})
|
if(WEBP_HAVE_FLAG_${WEBP_SIMD_FLAG})
|
||||||
set(WEBP_HAVE_${WEBP_SIMD_FLAG} 1 PARENT_SCOPE)
|
set(WEBP_HAVE_${WEBP_SIMD_FLAG} 1 PARENT_SCOPE)
|
||||||
@ -30,15 +29,17 @@ endfunction()
|
|||||||
|
|
||||||
# those are included in the names of WEBP_USE_* in c++ code.
|
# those are included in the names of WEBP_USE_* in c++ code.
|
||||||
set(WEBP_SIMD_FLAGS "SSE2;SSE41;AVX2;MIPS32;MIPS_DSP_R2;NEON;MSA")
|
set(WEBP_SIMD_FLAGS "SSE2;SSE41;AVX2;MIPS32;MIPS_DSP_R2;NEON;MSA")
|
||||||
set(WEBP_SIMD_FILE_EXTENSIONS "_sse2.c;_sse41.c;_avx2.c;_mips32.c;_mips_dsp_r2.c;_neon.c;_msa.c")
|
set(WEBP_SIMD_FILE_EXTENSIONS
|
||||||
|
"_sse2.c;_sse41.c;_avx2.c;_mips32.c;_mips_dsp_r2.c;_neon.c;_msa.c")
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# MSVC does not have a SSE4 flag but AVX2 support implies
|
# MSVC does not have a SSE4 flag but AVX2 support implies SSE4 support.
|
||||||
# SSE4 support.
|
|
||||||
set(SIMD_ENABLE_FLAGS "/arch:SSE2;/arch:AVX2;/arch:AVX2;;;;")
|
set(SIMD_ENABLE_FLAGS "/arch:SSE2;/arch:AVX2;/arch:AVX2;;;;")
|
||||||
set(SIMD_DISABLE_FLAGS)
|
set(SIMD_DISABLE_FLAGS)
|
||||||
else()
|
else()
|
||||||
set(SIMD_ENABLE_FLAGS "-msse2;-msse4.1;-mavx2;-mips32;-mdspr2;-mfpu=neon;-mmsa")
|
set(SIMD_ENABLE_FLAGS
|
||||||
set(SIMD_DISABLE_FLAGS "-mno-sse2;-mno-sse4.1;-mno-avx2;;-mno-dspr2;;-mno-msa")
|
"-msse2;-msse4.1;-mavx2;-mips32;-mdspr2;-mfpu=neon;-mmsa")
|
||||||
|
set(SIMD_DISABLE_FLAGS
|
||||||
|
"-mno-sse2;-mno-sse4.1;-mno-avx2;;-mno-dspr2;;-mno-msa")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(WEBP_SIMD_FILES_TO_NOT_INCLUDE)
|
set(WEBP_SIMD_FILES_TO_NOT_INCLUDE)
|
||||||
@ -47,10 +48,9 @@ set(WEBP_SIMD_FLAGS_TO_INCLUDE)
|
|||||||
|
|
||||||
if(${ANDROID})
|
if(${ANDROID})
|
||||||
if(${ANDROID_ABI} STREQUAL "armeabi-v7a")
|
if(${ANDROID_ABI} STREQUAL "armeabi-v7a")
|
||||||
# This is because Android studio uses the configuration
|
# This is because Android studio uses the configuration "-march=armv7-a
|
||||||
# "-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16"
|
# -mfloat-abi=softfp -mfpu=vfpv3-d16" that does not trigger neon
|
||||||
# that does not trigger neon optimizations but should
|
# optimizations but should (as this configuration does not exist anymore).
|
||||||
# (as this configuration does not exist anymore).
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon ")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon ")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@ -77,8 +77,7 @@ foreach(I_SIMD RANGE ${WEBP_SIMD_FLAGS_RANGE})
|
|||||||
# Check which files we should include or not.
|
# Check which files we should include or not.
|
||||||
list(GET WEBP_SIMD_FILE_EXTENSIONS ${I_SIMD} WEBP_SIMD_FILE_EXTENSION)
|
list(GET WEBP_SIMD_FILE_EXTENSIONS ${I_SIMD} WEBP_SIMD_FILE_EXTENSION)
|
||||||
file(GLOB SIMD_FILES "${CMAKE_CURRENT_LIST_DIR}/../"
|
file(GLOB SIMD_FILES "${CMAKE_CURRENT_LIST_DIR}/../"
|
||||||
"src/dsp/*${WEBP_SIMD_FILE_EXTENSION}"
|
"src/dsp/*${WEBP_SIMD_FILE_EXTENSION}")
|
||||||
)
|
|
||||||
if(WEBP_HAVE_${WEBP_SIMD_FLAG})
|
if(WEBP_HAVE_${WEBP_SIMD_FLAG})
|
||||||
# Memorize the file and flags.
|
# Memorize the file and flags.
|
||||||
foreach(FILE ${SIMD_FILES})
|
foreach(FILE ${SIMD_FILES})
|
||||||
@ -107,10 +106,10 @@ foreach(I_SIMD RANGE ${WEBP_SIMD_FLAGS_RANGE})
|
|||||||
endif()
|
endif()
|
||||||
set(CMAKE_REQUIRED_DEFINITIONS ${SIMD_COMPILE_FLAG})
|
set(CMAKE_REQUIRED_DEFINITIONS ${SIMD_COMPILE_FLAG})
|
||||||
check_c_source_compiles("int main(void) {return 0;}"
|
check_c_source_compiles("int main(void) {return 0;}"
|
||||||
FLAG_${SIMD_COMPILE_FLAG}
|
FLAG_${SIMD_COMPILE_FLAG}
|
||||||
FAIL_REGEX "warning: argument unused during compilation:"
|
FAIL_REGEX
|
||||||
${COMMON_PATTERNS}
|
"warning: argument unused during compilation:"
|
||||||
)
|
${COMMON_PATTERNS})
|
||||||
if(NOT FLAG_${SIMD_COMPILE_FLAG})
|
if(NOT FLAG_${SIMD_COMPILE_FLAG})
|
||||||
unset(HAS_COMPILE_FLAG CACHE)
|
unset(HAS_COMPILE_FLAG CACHE)
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,33 +1,27 @@
|
|||||||
# Generate the config.h to compile with specific intrinsics / libs.
|
# Generate the config.h to compile with specific intrinsics / libs.
|
||||||
|
|
||||||
## Check for compiler options.
|
# Check for compiler options.
|
||||||
include(CheckCSourceCompiles)
|
include(CheckCSourceCompiles)
|
||||||
check_c_source_compiles("
|
check_c_source_compiles("
|
||||||
int main(void) {
|
int main(void) {
|
||||||
(void)__builtin_bswap16(0);
|
(void)__builtin_bswap16(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
"
|
" HAVE_BUILTIN_BSWAP16)
|
||||||
HAVE_BUILTIN_BSWAP16
|
|
||||||
)
|
|
||||||
check_c_source_compiles("
|
check_c_source_compiles("
|
||||||
int main(void) {
|
int main(void) {
|
||||||
(void)__builtin_bswap32(0);
|
(void)__builtin_bswap32(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
"
|
" HAVE_BUILTIN_BSWAP32)
|
||||||
HAVE_BUILTIN_BSWAP32
|
|
||||||
)
|
|
||||||
check_c_source_compiles("
|
check_c_source_compiles("
|
||||||
int main(void) {
|
int main(void) {
|
||||||
(void)__builtin_bswap64(0);
|
(void)__builtin_bswap64(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
"
|
" HAVE_BUILTIN_BSWAP64)
|
||||||
HAVE_BUILTIN_BSWAP64
|
|
||||||
)
|
|
||||||
|
|
||||||
## Check for libraries.
|
# Check for libraries.
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
if(Threads_FOUND)
|
if(Threads_FOUND)
|
||||||
if(CMAKE_USE_PTHREADS_INIT)
|
if(CMAKE_USE_PTHREADS_INIT)
|
||||||
@ -40,8 +34,7 @@ if(Threads_FOUND)
|
|||||||
int attr = ${PTHREAD_TEST};
|
int attr = ${PTHREAD_TEST};
|
||||||
return attr;
|
return attr;
|
||||||
}
|
}
|
||||||
" ${PTHREAD_TEST}
|
" ${PTHREAD_TEST})
|
||||||
)
|
|
||||||
endforeach()
|
endforeach()
|
||||||
list(APPEND WEBP_DEP_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
list(APPEND WEBP_DEP_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
||||||
endif()
|
endif()
|
||||||
@ -54,17 +47,14 @@ set(LT_OBJDIR ".libs/")
|
|||||||
find_package(OpenGL)
|
find_package(OpenGL)
|
||||||
set(WEBP_HAVE_GL ${OPENGL_FOUND})
|
set(WEBP_HAVE_GL ${OPENGL_FOUND})
|
||||||
|
|
||||||
# Check if we need to link to the C math library.
|
# Check if we need to link to the C math library. We do not look for it as it is
|
||||||
# We do not look for it as it is not found when
|
# not found when cross-compiling, while it is here.
|
||||||
# cross-compiling, while it is here.
|
|
||||||
check_c_source_compiles("
|
check_c_source_compiles("
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
return (int)pow(argc, 2.5);
|
return (int)pow(argc, 2.5);
|
||||||
}
|
}
|
||||||
"
|
" HAVE_MATH_LIBRARY)
|
||||||
HAVE_MATH_LIBRARY
|
|
||||||
)
|
|
||||||
if(NOT HAVE_MATH_LIBRARY)
|
if(NOT HAVE_MATH_LIBRARY)
|
||||||
message(STATUS "Adding -lm flag.")
|
message(STATUS "Adding -lm flag.")
|
||||||
list(APPEND WEBP_DEP_LIBRARIES m)
|
list(APPEND WEBP_DEP_LIBRARIES m)
|
||||||
@ -78,8 +68,8 @@ foreach(I_LIB PNG JPEG TIFF)
|
|||||||
set(WEBP_HAVE_${I_LIB} ${${I_LIB}_FOUND})
|
set(WEBP_HAVE_${I_LIB} ${${I_LIB}_FOUND})
|
||||||
if(${I_LIB}_FOUND)
|
if(${I_LIB}_FOUND)
|
||||||
list(APPEND WEBP_DEP_IMG_LIBRARIES ${${I_LIB}_LIBRARIES})
|
list(APPEND WEBP_DEP_IMG_LIBRARIES ${${I_LIB}_LIBRARIES})
|
||||||
list(APPEND WEBP_DEP_IMG_INCLUDE_DIRS
|
list(APPEND WEBP_DEP_IMG_INCLUDE_DIRS ${${I_LIB}_INCLUDE_DIR}
|
||||||
${${I_LIB}_INCLUDE_DIR} ${${I_LIB}_INCLUDE_DIRS})
|
${${I_LIB}_INCLUDE_DIRS})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
if(WEBP_DEP_IMG_INCLUDE_DIRS)
|
if(WEBP_DEP_IMG_INCLUDE_DIRS)
|
||||||
@ -95,8 +85,8 @@ set(WEBP_HAVE_GIF ${GIF_FOUND})
|
|||||||
if(GIF_FOUND)
|
if(GIF_FOUND)
|
||||||
# GIF find_package only locates the header and library, it doesn't fail
|
# GIF find_package only locates the header and library, it doesn't fail
|
||||||
# compile tests when detecting the version, but falls back to 3 (as of at
|
# compile tests when detecting the version, but falls back to 3 (as of at
|
||||||
# least cmake 3.7.2). Make sure the library links to avoid incorrect
|
# least cmake 3.7.2). Make sure the library links to avoid incorrect detection
|
||||||
# detection when cross compiling.
|
# when cross compiling.
|
||||||
cmake_push_check_state()
|
cmake_push_check_state()
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${GIF_LIBRARIES})
|
set(CMAKE_REQUIRED_LIBRARIES ${GIF_LIBRARIES})
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${GIF_INCLUDE_DIR})
|
set(CMAKE_REQUIRED_INCLUDES ${GIF_INCLUDE_DIR})
|
||||||
@ -106,8 +96,7 @@ if(GIF_FOUND)
|
|||||||
(void)DGifOpenFileHandle;
|
(void)DGifOpenFileHandle;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
" GIF_COMPILES
|
" GIF_COMPILES)
|
||||||
)
|
|
||||||
cmake_pop_check_state()
|
cmake_pop_check_state()
|
||||||
if(GIF_COMPILES)
|
if(GIF_COMPILES)
|
||||||
list(APPEND WEBP_DEP_GIF_LIBRARIES ${GIF_LIBRARIES})
|
list(APPEND WEBP_DEP_GIF_LIBRARIES ${GIF_LIBRARIES})
|
||||||
@ -117,7 +106,7 @@ if(GIF_FOUND)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
## Check for specific headers.
|
# Check for specific headers.
|
||||||
include(CheckIncludeFiles)
|
include(CheckIncludeFiles)
|
||||||
check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
|
check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
|
||||||
check_include_files(dlfcn.h HAVE_DLFCN_H)
|
check_include_files(dlfcn.h HAVE_DLFCN_H)
|
||||||
@ -139,25 +128,32 @@ check_include_files(windows.h HAVE_WINDOWS_H)
|
|||||||
|
|
||||||
# Windows specifics
|
# Windows specifics
|
||||||
if(HAVE_WINCODEC_H)
|
if(HAVE_WINCODEC_H)
|
||||||
list(APPEND WEBP_DEP_LIBRARIES shlwapi ole32 windowscodecs)
|
list(APPEND WEBP_DEP_LIBRARIES
|
||||||
|
shlwapi
|
||||||
|
ole32
|
||||||
|
windowscodecs)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
## Check for SIMD extensions.
|
# Check for SIMD extensions.
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/cpu.cmake)
|
include(${CMAKE_CURRENT_LIST_DIR}/cpu.cmake)
|
||||||
|
|
||||||
## Define extra info.
|
# Define extra info.
|
||||||
set(PACKAGE ${PROJECT_NAME})
|
set(PACKAGE ${PROJECT_NAME})
|
||||||
set(PACKAGE_NAME ${PROJECT_NAME})
|
set(PACKAGE_NAME ${PROJECT_NAME})
|
||||||
|
|
||||||
# Read from configure.ac.
|
# Read from configure.ac.
|
||||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/configure.ac CONFIGURE_AC)
|
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/configure.ac CONFIGURE_AC)
|
||||||
string(REGEX MATCHALL "\\[([0-9a-z\\.:/]*)\\]"
|
string(REGEX MATCHALL
|
||||||
CONFIGURE_AC_PACKAGE_INFO ${CONFIGURE_AC}
|
"\\[([0-9a-z\\.:/]*)\\]"
|
||||||
)
|
CONFIGURE_AC_PACKAGE_INFO
|
||||||
|
${CONFIGURE_AC})
|
||||||
function(strip_bracket VAR)
|
function(strip_bracket VAR)
|
||||||
string(LENGTH ${${VAR}} TMP_LEN)
|
string(LENGTH ${${VAR}} TMP_LEN)
|
||||||
math(EXPR TMP_LEN ${TMP_LEN}-2)
|
math(EXPR TMP_LEN ${TMP_LEN}-2)
|
||||||
string(SUBSTRING ${${VAR}} 1 ${TMP_LEN} TMP_SUB)
|
string(SUBSTRING ${${VAR}}
|
||||||
|
1
|
||||||
|
${TMP_LEN}
|
||||||
|
TMP_SUB)
|
||||||
set(${VAR} ${TMP_SUB} PARENT_SCOPE)
|
set(${VAR} ${TMP_SUB} PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user