Change WITH_JXL option to tristate (AUTO/ON/OFF)

This commit is contained in:
xiota 2024-04-10 18:18:55 +00:00
parent b2550abd83
commit 4a16bdd624

View File

@ -222,7 +222,6 @@ option(USE_EXPERIMENTAL_LANG_VERSIONS "Build with -std=c++0x" OFF)
option(BUILD_SHARED "Build with shared libraries" OFF) option(BUILD_SHARED "Build with shared libraries" OFF)
option(WITH_BENCHMARK "Build with benchmark code" OFF) option(WITH_BENCHMARK "Build with benchmark code" OFF)
option(WITH_MYFILE_MMAP "Build using memory mapped file" ON) option(WITH_MYFILE_MMAP "Build using memory mapped file" ON)
option(WITH_JXL "Build with JPEG XL import support" OFF)
option(WITH_LTO "Build with link-time optimizations" OFF) option(WITH_LTO "Build with link-time optimizations" OFF)
option(WITH_SAN "Build with run-time sanitizer" OFF) option(WITH_SAN "Build with run-time sanitizer" OFF)
option(WITH_PROF "Build with profiling instrumentation" OFF) option(WITH_PROF "Build with profiling instrumentation" OFF)
@ -248,6 +247,9 @@ set(TCMALLOC_LIB_DIR
"" ""
CACHE PATH "Custom path for the tcmalloc library") CACHE PATH "Custom path for the tcmalloc library")
set(WITH_JXL AUTO CACHE STRING "Build with JPEG XL support")
set_property(CACHE WITH_JXL PROPERTY STRINGS AUTO ON OFF)
# Set installation directories: # Set installation directories:
if(WIN32 OR APPLE) if(WIN32 OR APPLE)
if(BUILD_BUNDLE) if(BUILD_BUNDLE)
@ -560,7 +562,13 @@ else()
pkg_check_modules(JXL IMPORTED_TARGET ${JXL_LIBS}) pkg_check_modules(JXL IMPORTED_TARGET ${JXL_LIBS})
endif() endif()
if(JXL_FOUND) if(JXL_FOUND)
if(WITH_JXL OR WITH_JXL STREQUAL AUTO)
add_definitions(-DLIBJXL) add_definitions(-DLIBJXL)
else()
message(STATUS " JXL support disabled by WITH_JXL = ${WITH_JXL}")
set(JXL_INCLUDE_DIRS "")
set(JXL_LIBRARIES "")
endif()
endif() endif()
# Check for libcanberra-gtk3 (sound events on Linux): # Check for libcanberra-gtk3 (sound events on Linux):