Allow building jpegli against system libjpeg-turbo. This is an old version of https://github.com/libjxl/libjxl/pull/3085 --- CMakeLists.txt.orig 2024-09-13 05:31:05 UTC +++ CMakeLists.txt @@ -83,14 +83,6 @@ else() set(BUNDLE_LIBPNG_DEFAULT YES) else() set(BUNDLE_LIBPNG_DEFAULT NO) -endif() - - -if(EXISTS "${PROJECT_SOURCE_DIR}/third_party/libjpeg-turbo/jconfig.h.in") - set(ENABLE_JPEGLI_DEFAULT YES) -else() - set(ENABLE_JPEGLI_DEFAULT NO) - message(STATUS "libjpeg-turbo submodule is absent; not enabling jpegli") endif() include(TestBigEndian) @@ -112,7 +104,7 @@ set(JPEGXL_ENABLE_TOOLS true CACHE BOOL "Build JPEGXL developer tools.") set(JPEGXL_ENABLE_TOOLS true CACHE BOOL "Build JPEGXL user tools: cjxl and djxl.") -set(JPEGXL_ENABLE_JPEGLI ${ENABLE_JPEGLI_DEFAULT} CACHE BOOL +set(JPEGXL_ENABLE_JPEGLI true CACHE BOOL "Build jpegli library.") set(JPEGXL_ENABLE_JPEGLI_LIBJPEG true CACHE BOOL "Build libjpeg.so shared library based on jpegli.") --- lib/jpegli.cmake.orig 2024-01-10 09:51:57 UTC +++ lib/jpegli.cmake @@ -23,12 +23,14 @@ endif() set(JPEG_LIB_VERSION 80) endif() +if(JPEGXL_INSTALL_JPEGLI_LIBJPEG) configure_file( ../third_party/libjpeg-turbo/jconfig.h.in include/jpegli/jconfig.h) configure_file( ../third_party/libjpeg-turbo/jpeglib.h include/jpegli/jpeglib.h COPYONLY) configure_file( ../third_party/libjpeg-turbo/jmorecfg.h include/jpegli/jmorecfg.h COPYONLY) +endif() add_library(jpegli-static STATIC EXCLUDE_FROM_ALL "${JPEGXL_INTERNAL_JPEGLI_SOURCES}") target_compile_options(jpegli-static PRIVATE "${JPEGXL_INTERNAL_FLAGS}")