From 926ce921f395e42811584946cb4e0b0b76f68c84 Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 5 Feb 2021 15:06:36 -0800 Subject: [PATCH 1/2] cmake: don't install binaries from extras/ this matches the behavior of configure Bug: webp:502 Change-Id: I99e597971636bdc2b9a9465ba13bb24c70ce87c0 --- CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c0e98e0..16407f8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -567,7 +567,6 @@ if(WEBP_BUILD_EXTRAS) PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src) - install(TARGETS get_disto RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) # webp_quality add_executable(webp_quality ${WEBP_QUALITY_SRCS} ${WEBP_EXTRAS_SRCS}) @@ -575,7 +574,6 @@ if(WEBP_BUILD_EXTRAS) target_include_directories(webp_quality PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) - install(TARGETS webp_quality RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) # vwebp_sdl find_package(SDL) @@ -590,7 +588,6 @@ if(WEBP_BUILD_EXTRAS) ${SDL_INCLUDE_DIR}) set(WEBP_HAVE_SDL 1) target_compile_definitions(vwebp_sdl PUBLIC WEBP_HAVE_SDL) - install(TARGETS vwebp_sdl RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() endif() From 759b9d5a061d87ee20d822bd9cce8e2812b9e089 Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 5 Feb 2021 15:05:29 -0800 Subject: [PATCH 2/2] cmake: add WEBP_USE_THREAD option this controls the config.h define of the same name and matches the behavior of configure's --disable-threading Bug: webp:502 Change-Id: Id135bbf4e6b3c9900e2b4f4f7ab744b3457ce41c --- CMakeLists.txt | 2 ++ cmake/deps.cmake | 33 ++++++++++++++++----------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 16407f8b..90b0deb3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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_EXTRAS "Build extras." ON) 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_ENABLE_SWAP_16BIT_CSP "Enable byte swap for 16 bit colorspaces." OFF) @@ -50,6 +51,7 @@ if(WEBP_BUILD_WEBP_JS) set(WEBP_BUILD_WEBPINFO OFF) set(WEBP_BUILD_WEBPMUX OFF) set(WEBP_BUILD_EXTRAS OFF) + set(WEBP_USE_THREAD OFF) if(WEBP_ENABLE_SIMD) message("wasm2js does not support SIMD, disabling webp.js generation.") diff --git a/cmake/deps.cmake b/cmake/deps.cmake index fb55f048..fce8318d 100644 --- a/cmake/deps.cmake +++ b/cmake/deps.cmake @@ -22,26 +22,25 @@ check_c_source_compiles(" " HAVE_BUILTIN_BSWAP64) # Check for libraries. -if(NOT WEBP_BUILD_WEBP_JS) - # Disable pThreads for WASM. +if(WEBP_USE_THREAD) find_package(Threads) -endif() -if(Threads_FOUND) - # 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") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") + if(Threads_FOUND) + # 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") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") + endif() + check_c_source_compiles(" + #include + 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() - check_c_source_compiles(" - #include - 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}) + set(WEBP_USE_THREAD ${Threads_FOUND}) endif() -set(WEBP_USE_THREAD ${Threads_FOUND}) # TODO: this seems unused, check with autotools. set(LT_OBJDIR ".libs/")