mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
Modernize CMake.
This is mostly to be compliant with Cmake CI tests. Change-Id: I4bb20d7f93b3808bbb1374cef4fd4cb9767e91e0
This commit is contained in:
parent
5357804f52
commit
e194928e8b
@ -29,6 +29,7 @@ endif()
|
|||||||
|
|
||||||
# Include dependencies.
|
# Include dependencies.
|
||||||
include(cmake/deps.cmake)
|
include(cmake/deps.cmake)
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Options.
|
# Options.
|
||||||
@ -120,13 +121,32 @@ target_link_libraries(webpdecoder ${WEBP_DEP_LIBRARIES})
|
|||||||
|
|
||||||
# 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} ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
add_library(webpdsp OBJECT ${WEBP_DSP_COMMON_SRCS} ${WEBP_DSP_DEC_SRCS}
|
add_library(webpdsp OBJECT ${WEBP_DSP_COMMON_SRCS} ${WEBP_DSP_DEC_SRCS}
|
||||||
${WEBP_DSP_ENC_SRCS})
|
${WEBP_DSP_ENC_SRCS})
|
||||||
|
target_include_directories(webpdsp PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
add_library(webputils OBJECT ${WEBP_UTILS_COMMON_SRCS} ${WEBP_UTILS_DEC_SRCS}
|
add_library(webputils OBJECT ${WEBP_UTILS_COMMON_SRCS} ${WEBP_UTILS_DEC_SRCS}
|
||||||
${WEBP_UTILS_ENC_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>
|
add_library(webp $<TARGET_OBJECTS:webpdecode> $<TARGET_OBJECTS:webpdsp>
|
||||||
$<TARGET_OBJECTS:webpencode> $<TARGET_OBJECTS:webputils>)
|
$<TARGET_OBJECTS:webpencode> $<TARGET_OBJECTS:webputils>)
|
||||||
|
if(XCODE)
|
||||||
|
libwebp_add_stub_file(webp)
|
||||||
|
endif()
|
||||||
target_link_libraries(webp ${WEBP_DEP_LIBRARIES})
|
target_link_libraries(webp ${WEBP_DEP_LIBRARIES})
|
||||||
|
target_include_directories(
|
||||||
|
webp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
|
||||||
|
$<INSTALL_INTERFACE:include>)
|
||||||
|
set_target_properties(
|
||||||
|
webp
|
||||||
|
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/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 not ON by default).
|
# (it is not ON by default).
|
||||||
@ -136,6 +156,17 @@ set_target_properties(webpdecode webpdspdecode webputilsdecode
|
|||||||
# Build the webp demux library.
|
# Build the webp demux library.
|
||||||
add_library(webpdemux ${WEBP_DEMUX_SRCS})
|
add_library(webpdemux ${WEBP_DEMUX_SRCS})
|
||||||
target_link_libraries(webpdemux webp)
|
target_link_libraries(webpdemux webp)
|
||||||
|
target_include_directories(
|
||||||
|
webpdemux PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
PUBLIC $<INSTALL_INTERFACE:include>)
|
||||||
|
set_target_properties(
|
||||||
|
webpdemux
|
||||||
|
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/mux_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)
|
||||||
@ -242,6 +273,11 @@ if(WEBP_BUILD_GIF2WEBP OR WEBP_BUILD_IMG2WEBP)
|
|||||||
parse_version(mux/Makefile.am webpmux WEBP_MUX_SOVERSION)
|
parse_version(mux/Makefile.am webpmux WEBP_MUX_SOVERSION)
|
||||||
set_target_properties(webpmux PROPERTIES VERSION ${PACKAGE_VERSION}
|
set_target_properties(webpmux PROPERTIES VERSION ${PACKAGE_VERSION}
|
||||||
SOVERSION ${WEBP_MUX_SOVERSION})
|
SOVERSION ${WEBP_MUX_SOVERSION})
|
||||||
|
set_target_properties(
|
||||||
|
webpmux
|
||||||
|
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/types.h;")
|
||||||
list(APPEND INSTALLED_LIBRARIES webpmux)
|
list(APPEND INSTALLED_LIBRARIES webpmux)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -314,16 +350,18 @@ add_definitions(-DHAVE_CONFIG_H)
|
|||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
# Install the different headers and libraries.
|
# Install the different headers and libraries.
|
||||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/webp/decode.h
|
install(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/demux.h
|
TARGETS ${INSTALLED_LIBRARIES}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/encode.h
|
EXPORT WebPTargets
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/mux.h
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/webp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/mux_types.h
|
INCLUDES
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/types.h
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
DESTINATION include/webp)
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
install(TARGETS ${INSTALLED_LIBRARIES}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
LIBRARY DESTINATION lib
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
ARCHIVE DESTINATION lib)
|
set(ConfigPackageLocation ${CMAKE_INSTALL_DATADIR}/WebP/cmake/)
|
||||||
|
install(EXPORT WebPTargets NAMESPACE WebP::
|
||||||
|
DESTINATION ${ConfigPackageLocation})
|
||||||
|
|
||||||
# Create the CMake version file.
|
# Create the CMake version file.
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
@ -340,7 +378,7 @@ 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}
|
||||||
)
|
PATH_VARS CMAKE_INSTALL_INCLUDEDIR)
|
||||||
|
|
||||||
# Install the generated CMake files.
|
# Install the generated CMake files.
|
||||||
install(
|
install(
|
||||||
|
@ -1,6 +1,19 @@
|
|||||||
|
set(WebP_VERSION @PROJECT_VERSION@)
|
||||||
|
set(WEBP_VERSION ${WebP_VERSION})
|
||||||
|
|
||||||
@PACKAGE_INIT@
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
set(WebP_INCLUDE_DIRS "webp")
|
if(@WEBP_USE_THREAD@)
|
||||||
set(WEBP_INCLUDE_DIRS ${WebP_INCLUDE_DIRS})
|
include(CMakeFindDependencyMacro)
|
||||||
|
find_dependency(Threads REQUIRED)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/WebPTargets.cmake")
|
||||||
|
|
||||||
|
set_and_check(WebP_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
|
||||||
|
set(WebP_INCLUDE_DIRS ${WebP_INCLUDE_DIR})
|
||||||
|
set(WEBP_INCLUDE_DIRS ${WebP_INCLUDE_DIR})
|
||||||
set(WebP_LIBRARIES "@INSTALLED_LIBRARIES@")
|
set(WebP_LIBRARIES "@INSTALLED_LIBRARIES@")
|
||||||
set(WEBP_LIBRARIES "${WebP_LIBRARIES}")
|
set(WEBP_LIBRARIES "${WebP_LIBRARIES}")
|
||||||
|
|
||||||
|
check_required_components(WebP)
|
||||||
|
Loading…
Reference in New Issue
Block a user