Merge changes Id135bbf4,I99e59797

* changes:
  cmake: add WEBP_USE_THREAD option
  cmake: don't install binaries from extras/
This commit is contained in:
James Zern 2021-02-09 21:25:12 +00:00 committed by Gerrit Code Review
commit 8f0d41aac0
2 changed files with 18 additions and 20 deletions

View File

@ -29,6 +29,7 @@ option(WEBP_BUILD_WEBPINFO "Build the webpinfo command line tool." ON)
option(WEBP_BUILD_WEBPMUX "Build the webpmux command line tool." ON) 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_USE_THREAD "Enable threading support" ON)
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." option(WEBP_ENABLE_SWAP_16BIT_CSP "Enable byte swap for 16 bit colorspaces."
OFF) OFF)
@ -50,6 +51,7 @@ if(WEBP_BUILD_WEBP_JS)
set(WEBP_BUILD_WEBPINFO OFF) set(WEBP_BUILD_WEBPINFO OFF)
set(WEBP_BUILD_WEBPMUX OFF) set(WEBP_BUILD_WEBPMUX OFF)
set(WEBP_BUILD_EXTRAS OFF) set(WEBP_BUILD_EXTRAS OFF)
set(WEBP_USE_THREAD OFF)
if(WEBP_ENABLE_SIMD) if(WEBP_ENABLE_SIMD)
message("wasm2js does not support SIMD, disabling webp.js generation.") message("wasm2js does not support SIMD, disabling webp.js generation.")
@ -567,7 +569,6 @@ if(WEBP_BUILD_EXTRAS)
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}/src) ${CMAKE_CURRENT_BINARY_DIR}/src)
install(TARGETS get_disto RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
# webp_quality # webp_quality
add_executable(webp_quality ${WEBP_QUALITY_SRCS} ${WEBP_EXTRAS_SRCS}) add_executable(webp_quality ${WEBP_QUALITY_SRCS} ${WEBP_EXTRAS_SRCS})
@ -575,7 +576,6 @@ if(WEBP_BUILD_EXTRAS)
target_include_directories(webp_quality target_include_directories(webp_quality
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}) ${CMAKE_CURRENT_BINARY_DIR})
install(TARGETS webp_quality RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
# vwebp_sdl # vwebp_sdl
find_package(SDL) find_package(SDL)
@ -590,7 +590,6 @@ if(WEBP_BUILD_EXTRAS)
${SDL_INCLUDE_DIR}) ${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})
endif() endif()
endif() endif()

View File

@ -22,26 +22,25 @@ check_c_source_compiles("
" HAVE_BUILTIN_BSWAP64) " HAVE_BUILTIN_BSWAP64)
# Check for libraries. # Check for libraries.
if(NOT WEBP_BUILD_WEBP_JS) if(WEBP_USE_THREAD)
# Disable pThreads for WASM.
find_package(Threads) find_package(Threads)
endif() if(Threads_FOUND)
if(Threads_FOUND) # work around cmake bug on QNX (https://cmake.org/Bug/view.php?id=11333)
# work around cmake bug on QNX (https://cmake.org/Bug/view.php?id=11333) if(CMAKE_USE_PTHREADS_INIT AND NOT CMAKE_SYSTEM_NAME STREQUAL "QNX")
if(CMAKE_USE_PTHREADS_INIT AND NOT CMAKE_SYSTEM_NAME STREQUAL "QNX") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") endif()
check_c_source_compiles("
#include <pthread.h>
int main (void) {
int attr = PTHREAD_PRIO_INHERIT;
return attr;
}
" FLAG_HAVE_PTHREAD_PRIO_INHERIT)
set(HAVE_PTHREAD_PRIO_INHERIT ${FLAG_HAVE_PTHREAD_PRIO_INHERIT})
list(APPEND WEBP_DEP_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
endif() endif()
check_c_source_compiles(" set(WEBP_USE_THREAD ${Threads_FOUND})
#include <pthread.h>
int main (void) {
int attr = PTHREAD_PRIO_INHERIT;
return attr;
}
" FLAG_HAVE_PTHREAD_PRIO_INHERIT)
set(HAVE_PTHREAD_PRIO_INHERIT ${FLAG_HAVE_PTHREAD_PRIO_INHERIT})
list(APPEND WEBP_DEP_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
endif() endif()
set(WEBP_USE_THREAD ${Threads_FOUND})
# TODO: this seems unused, check with autotools. # TODO: this seems unused, check with autotools.
set(LT_OBJDIR ".libs/") set(LT_OBJDIR ".libs/")