1 # Copyright (c) the JPEG XL Project Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style
4 # license that can be found in the LICENSE file.
6 # Ubuntu bionic ships with cmake 3.10.
7 cmake_minimum_required(VERSION 3.10)
8 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
10 # Honor VISIBILITY_INLINES_HIDDEN on all types of targets.
12 cmake_policy(SET CMP0063 NEW)
14 # Pass CMAKE_EXE_LINKER_FLAGS to CC and CXX compilers when testing if they work.
16 cmake_policy(SET CMP0065 NEW)
19 # Set PIE flags for POSITION_INDEPENDENT_CODE targets, added in 3.14.
21 cmake_policy(SET CMP0083 NEW)
24 project(LIBJXL LANGUAGES C CXX)
26 include(CheckCXXSourceCompiles)
27 check_cxx_source_compiles(
29 #if !defined(__EMSCRIPTEN__)
30 static_assert(false, \"__EMSCRIPTEN__ is not defined\");
37 message(STATUS "CMAKE_SYSTEM_PROCESSOR is ${CMAKE_SYSTEM_PROCESSOR}")
38 include(CheckCXXCompilerFlag)
39 check_cxx_compiler_flag("-fsanitize=fuzzer-no-link" CXX_FUZZERS_SUPPORTED)
40 check_cxx_compiler_flag("-Xclang -mconstructor-aliases" CXX_CONSTRUCTOR_ALIASES_SUPPORTED)
41 check_cxx_compiler_flag("-fmacro-prefix-map=OLD=NEW" CXX_MACRO_PREFIX_MAP)
42 check_cxx_compiler_flag("-fno-rtti" CXX_NO_RTTI_SUPPORTED)
44 # Enabled PIE binaries by default if supported.
45 include(CheckPIESupported OPTIONAL RESULT_VARIABLE CHECK_PIE_SUPPORTED)
46 if(CHECK_PIE_SUPPORTED)
47 check_pie_supported(LANGUAGES CXX)
48 if(CMAKE_CXX_LINK_PIE_SUPPORTED)
49 set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
53 if(PROVISION_DEPENDENCIES)
54 # Run script to provision dependencies.
55 find_program (BASH_PROGRAM bash)
58 COMMAND ${BASH_PROGRAM} ${CMAKE_CURRENT_SOURCE_DIR}/deps.sh
59 RESULT_VARIABLE PROVISION_DEPENDENCIES_RESULT)
61 if(NOT PROVISION_DEPENDENCIES_RESULT EQUAL "0")
62 message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR}/deps.sh failed with ${PROVISION_DEPENDENCIES_RESULT}")
66 ### Project build options:
67 if(CXX_FUZZERS_SUPPORTED)
68 # Enabled by default except on arm64, Windows and Apple builds.
69 set(ENABLE_FUZZERS_DEFAULT true)
71 find_package(PkgConfig)
72 if(NOT APPLE AND NOT WIN32 AND NOT HAIKU AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
73 pkg_check_modules(TCMallocMinimalVersionCheck QUIET IMPORTED_TARGET
75 if(TCMallocMinimalVersionCheck_FOUND AND
76 NOT TCMallocMinimalVersionCheck_VERSION VERSION_EQUAL 2.8.0)
77 # Enabled by default except on Windows and Apple builds for
78 # tcmalloc != 2.8.0. tcmalloc 2.8.1 already has a fix for this issue.
79 set(ENABLE_TCMALLOC_DEFAULT true)
82 "tcmalloc version ${TCMallocMinimalVersionCheck_VERSION} -- "
83 "tcmalloc 2.8.0 disabled due to "
84 "https://github.com/gperftools/gperftools/issues/1204")
88 check_cxx_source_compiles(
90 #if !defined(HWY_DISABLED_TARGETS)
91 static_assert(false, \"HWY_DISABLED_TARGETS is not defined\");
95 JXL_HWY_DISABLED_TARGETS_FORCED
98 set(WARNINGS_AS_ERRORS_DEFAULT false)
100 if((SANITIZER STREQUAL "msan") OR JPEGXL_EMSCRIPTEN)
101 set(BUNDLE_LIBPNG_DEFAULT YES)
103 set(BUNDLE_LIBPNG_DEFAULT NO)
106 # Standard cmake naming for building shared libraries.
107 get_property(SHARED_LIBS_SUPPORTED GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
108 option(BUILD_SHARED_LIBS "Build shared libraries instead of static ones" ${SHARED_LIBS_SUPPORTED})
110 set(JPEGXL_ENABLE_FUZZERS ${ENABLE_FUZZERS_DEFAULT} CACHE BOOL
111 "Build JPEGXL fuzzer targets.")
112 set(JPEGXL_ENABLE_DEVTOOLS false CACHE BOOL
113 "Build JPEGXL developer tools.")
114 set(JPEGXL_ENABLE_TOOLS true CACHE BOOL
115 "Build JPEGXL user tools: cjxl and djxl.")
116 set(JPEGXL_ENABLE_JPEGLI true CACHE BOOL
117 "Build jpegli library.")
118 set(JPEGXL_ENABLE_JPEGLI_LIBJPEG true CACHE BOOL
119 "Build libjpeg.so shared library based on jpegli.")
120 set(JPEGXL_INSTALL_JPEGLI_LIBJPEG false CACHE BOOL
121 "Install jpegli version of libjpeg.so system-wide.")
122 set(JPEGLI_LIBJPEG_LIBRARY_VERSION "62.3.0" CACHE STRING
123 "Library version of the libjpeg.so shared library that we build.")
124 set(JPEGLI_LIBJPEG_LIBRARY_SOVERSION "62" CACHE STRING
125 "Library so-version of the libjpeg.so shared library that we build.")
126 set(JPEGXL_ENABLE_DOXYGEN true CACHE BOOL
127 "Generate C API documentation using Doxygen.")
128 set(JPEGXL_ENABLE_MANPAGES true CACHE BOOL
129 "Build and install man pages for the command-line tools.")
130 set(JPEGXL_ENABLE_BENCHMARK true CACHE BOOL
131 "Build JPEGXL benchmark tools.")
132 set(JPEGXL_ENABLE_EXAMPLES true CACHE BOOL
133 "Build JPEGXL library usage examples.")
134 set(JPEGXL_BUNDLE_LIBPNG ${BUNDLE_LIBPNG_DEFAULT} CACHE BOOL
135 "Build libpng from source and link it statically.")
136 set(JPEGXL_ENABLE_JNI true CACHE BOOL
137 "Build JPEGXL JNI Java wrapper, if Java dependencies are installed.")
138 set(JPEGXL_ENABLE_SJPEG true CACHE BOOL
139 "Build JPEGXL with support for encoding with sjpeg.")
140 set(JPEGXL_ENABLE_OPENEXR true CACHE BOOL
141 "Build JPEGXL with support for OpenEXR if available.")
142 set(JPEGXL_ENABLE_SKCMS true CACHE BOOL
143 "Build with skcms instead of lcms2.")
144 set(JPEGXL_BUNDLE_SKCMS true CACHE BOOL
145 "When building with skcms, bundle it into libjxl.a.")
146 set(JPEGXL_ENABLE_VIEWERS false CACHE BOOL
147 "Build JPEGXL viewer tools for evaluation.")
148 set(JPEGXL_ENABLE_TCMALLOC ${ENABLE_TCMALLOC_DEFAULT} CACHE BOOL
149 "Build JPEGXL using gperftools (tcmalloc) allocator.")
150 set(JPEGXL_ENABLE_PLUGINS false CACHE BOOL
151 "Build third-party plugins to support JPEG XL in other applications.")
152 set(JPEGXL_ENABLE_COVERAGE false CACHE BOOL
153 "Enable code coverage tracking for libjxl. This also enables debug and disables optimizations.")
154 set(JPEGXL_ENABLE_SIZELESS_VECTORS false CACHE BOOL
155 "Builds in support for SVE/RVV vectorization")
156 set(JPEGXL_ENABLE_TRANSCODE_JPEG true CACHE BOOL
157 "Builds in support for decoding transcoded JXL files back to JPEG,\
158 disabling it makes the decoder reject JXL_DEC_JPEG_RECONSTRUCTION events,\
160 set(JPEGXL_ENABLE_BOXES true CACHE BOOL
161 "Builds in support for decoding boxes in JXL files,\
162 disabling it makes the decoder reject JXL_DEC_BOX events,\
164 set(JPEGXL_STATIC false CACHE BOOL
165 "Build tools as static binaries.")
166 set(JPEGXL_WARNINGS_AS_ERRORS ${WARNINGS_AS_ERRORS_DEFAULT} CACHE BOOL
167 "Treat warnings as errors during compilation.")
168 set(JPEGXL_DEP_LICENSE_DIR "" CACHE STRING
169 "Directory where to search for system dependencies \"copyright\" files.")
170 set(JPEGXL_FORCE_NEON false CACHE BOOL
171 "Set flags to enable NEON in arm if not enabled by your toolchain.")
172 set(JPEGXL_TEST_TOOLS false CACHE BOOL
173 "Run scripts that test the encoding / decoding tools.")
174 set(JPEGXL_ENABLE_AVX512 false CACHE BOOL
175 "Build with AVX512 support (faster on CPUs that support it, but larger binary size).")
176 set(JPEGXL_ENABLE_AVX512_ZEN4 false CACHE BOOL
177 "Build with Zen4-optimized AVX512 support (faster on CPUs that support it, but larger binary size).")
179 # Force system dependencies.
180 set(JPEGXL_FORCE_SYSTEM_BROTLI false CACHE BOOL
181 "Force using system installed brotli instead of third_party/brotli source.")
182 set(JPEGXL_FORCE_SYSTEM_GTEST false CACHE BOOL
183 "Force using system installed googletest (gtest/gmock) instead of third_party/googletest source.")
184 set(JPEGXL_FORCE_SYSTEM_LCMS2 false CACHE BOOL
185 "Force using system installed lcms2 instead of third_party/lcms source.")
186 set(JPEGXL_FORCE_SYSTEM_HWY false CACHE BOOL
187 "Force using system installed highway (libhwy-dev) instead of third_party/highway source.")
189 # Check minimum compiler versions. Older compilers are not supported and fail
190 # with hard to understand errors.
191 if (NOT CMAKE_C_COMPILER_ID STREQUAL CMAKE_CXX_COMPILER_ID)
192 message(FATAL_ERROR "Different C/C++ compilers set: "
193 "${CMAKE_C_COMPILER_ID} vs ${CMAKE_CXX_COMPILER_ID}")
195 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
196 # Android NDK's toolchain.cmake fakes the clang version in
197 # CMAKE_CXX_COMPILER_VERSION with an incorrect number, so ignore this.
198 if (NOT CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION MATCHES "clang"
199 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5)
201 "Minimum Clang version required is Clang 5, please update.")
203 elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
204 if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7)
206 "Minimum GCC version required is 7, please update.")
211 "Compiled IDs C:${CMAKE_C_COMPILER_ID}, C++:${CMAKE_CXX_COMPILER_ID}")
213 # Always disable SSSE3 since it is rare to have SSSE3 but not SSE4
214 set(HWY_DISABLED_TARGETS "HWY_SSSE3")
215 if (NOT JPEGXL_ENABLE_AVX512)
216 message(STATUS "Disabled AVX512 (set JPEGXL_ENABLE_AVX512 to enable it)")
217 set(HWY_DISABLED_TARGETS "${HWY_DISABLED_TARGETS}|HWY_AVX3")
218 add_definitions(-DFJXL_ENABLE_AVX512=0)
220 if (NOT JPEGXL_ENABLE_AVX512_ZEN4)
221 message(STATUS "Disabled AVX512_ZEN4 (set JPEGXL_ENABLE_AVX512_ZEN4 to enable it)")
222 set(HWY_DISABLED_TARGETS "${HWY_DISABLED_TARGETS}|HWY_AVX3_ZEN4")
227 # CMAKE_EXPORT_COMPILE_COMMANDS is used to generate the compilation database
228 # used by clang-tidy.
229 set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
232 set(BUILD_SHARED_LIBS 0)
233 # Clang developers say that in case to use "static" we have to build stdlib
234 # ourselves; for real use case we don't care about stdlib, as it is "granted",
235 # so just linking all other libraries is fine.
236 if (NOT MSVC AND NOT APPLE)
237 set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
238 set(CMAKE_EXE_LINKER_FLAGS
239 "${CMAKE_EXE_LINKER_FLAGS} -static -static-libgcc -static-libstdc++")
241 endif() # JPEGXL_STATIC
244 set(THREADS_PREFER_PTHREAD_FLAG YES)
245 find_package(Threads REQUIRED)
247 # These settings are important to drive check_cxx_source_compiles
248 # See CMP0067 (min cmake version is 3.10 anyway)
249 set(CMAKE_CXX_STANDARD 11)
250 set(CMAKE_CXX_EXTENSIONS OFF)
251 set(CMAKE_CXX_STANDARD_REQUIRED YES)
254 find_package(Atomics REQUIRED)
258 # In MINGW libstdc++ uses pthreads directly. When building statically a
259 # program (regardless of whether the source code uses pthread or not) the
260 # toolchain will add stdc++ and pthread to the linking step but stdc++ will
261 # be linked statically while pthread will be linked dynamically.
262 # To avoid this and have pthread statically linked with need to pass it in
263 # the command line with "-Wl,-Bstatic -lpthread -Wl,-Bdynamic" but the
264 # linker will discard it if not used by anything else up to that point in
265 # the linker command line. If the program or any dependency don't use
266 # pthread directly -lpthread is discarded and libstdc++ (added by the
267 # toolchain later) will then use the dynamic version. For this we also need
268 # to pass -lstdc++ explicitly before -lpthread. For pure C programs -lstdc++
269 # will be discarded anyway.
270 # This adds these flags as dependencies for *all* targets. Adding this to
271 # CMAKE_EXE_LINKER_FLAGS instead would cause them to be included before any
272 # object files and therefore discarded. This should be set in the
273 # INTERFACE_LINK_LIBRARIES of Threads::Threads but some third_part targets
274 # don't depend on it.
275 link_libraries(-Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic)
276 elseif(CMAKE_USE_PTHREADS_INIT)
277 # "whole-archive" is not supported on OSX.
279 # Set pthreads as a whole-archive, otherwise weak symbols in the static
280 # libraries will discard pthreads symbols leading to segmentation fault at
282 message(STATUS "Using -lpthread as --whole-archive")
283 set_target_properties(Threads::Threads PROPERTIES
284 INTERFACE_LINK_LIBRARIES
285 "-Wl,--whole-archive;-lpthread;-Wl,--no-whole-archive")
288 endif() # JPEGXL_STATIC
290 if (JPEGXL_EMSCRIPTEN)
291 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
292 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
293 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
296 if (CXX_MACRO_PREFIX_MAP)
297 add_compile_options(-fmacro-prefix-map=${CMAKE_CURRENT_SOURCE_DIR}=.)
300 if (CXX_NO_RTTI_SUPPORTED)
301 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
304 # Internal flags for coverage builds:
305 set(JPEGXL_COVERAGE_FLAGS)
306 set(JPEGXL_COVERAGE_LINK_FLAGS)
309 # TODO(janwas): add flags
310 add_definitions(-D_CRT_SECURE_NO_WARNINGS)
312 # Global compiler flags for all targets here and in subdirectories.
314 # Avoid changing the binary based on the current time and date.
315 -D__DATE__="redacted"
316 -D__TIMESTAMP__="redacted"
317 -D__TIME__="redacted"
320 # TODO(eustas): JXL currently compiles, but does not pass tests...
321 if (NOT JXL_HWY_DISABLED_TARGETS_FORCED)
322 if (NOT JPEGXL_ENABLE_SIZELESS_VECTORS)
323 set(HWY_DISABLED_TARGETS "${HWY_DISABLED_TARGETS}|HWY_SVE|HWY_SVE2|HWY_SVE_256|HWY_SVE2_128|HWY_RVV")
325 add_definitions(-DHWY_DISABLED_TARGETS=\(${HWY_DISABLED_TARGETS}\))
328 # In CMake before 3.12 it is problematic to pass repeated flags like -Xclang.
329 # For this reason we place them in CMAKE_CXX_FLAGS instead.
330 # See https://gitlab.kitware.com/cmake/cmake/issues/15826
333 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -funwind-tables")
334 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
335 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xclang -mrelax-all")
337 if (CXX_CONSTRUCTOR_ALIASES_SUPPORTED)
338 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xclang -mconstructor-aliases")
342 # Not supported by clang-cl, but frame pointers are default on Windows
344 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer")
347 # CPU flags - remove once we have NEON dynamic dispatch
349 # TODO(janwas): this also matches M1, but only ARMv7 is intended/needed.
350 if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
351 if(JPEGXL_FORCE_NEON)
352 # GCC requires these flags, otherwise __ARM_NEON is undefined.
353 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
354 -mfpu=neon-vfpv4 -mfloat-abi=hard")
358 # Force build with optimizations in release mode.
359 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
362 # Ignore this to allow redefining __DATE__ and others.
363 -Wno-builtin-macro-redefined
365 # Global warning settings.
369 if (JPEGXL_WARNINGS_AS_ERRORS)
370 add_compile_options(-Werror)
373 if(JPEGXL_ENABLE_COVERAGE)
374 set(JPEGXL_COVERAGE_FLAGS
375 -g -O0 -fprofile-arcs -ftest-coverage
376 -DJXL_ENABLE_ASSERT=0 -DJXL_ENABLE_CHECK=0
378 set(JPEGXL_COVERAGE_LINK_FLAGS
381 endif() # JPEGXL_ENABLE_COVERAGE
384 include(GNUInstallDirs)
386 # Separately build/configure testing frameworks and other third_party libraries
387 # to allow disabling tests in those libraries.
388 include(third_party/testing.cmake)
389 add_subdirectory(third_party)
390 # Copy the JXL license file to the output build directory.
391 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/LICENSE"
392 ${PROJECT_BINARY_DIR}/LICENSE.jpeg-xl COPYONLY)
394 # Enable tests regardless of where they are defined.
397 # Specify default location of `testdata`:
398 if(NOT DEFINED JPEGXL_TEST_DATA_PATH)
399 set(JPEGXL_TEST_DATA_PATH "${PROJECT_SOURCE_DIR}/testdata")
403 add_subdirectory(lib)
406 # Script to run tests over the source code in bash.
407 find_program (BASH_PROGRAM bash)
411 COMMAND ${BASH_PROGRAM} ${CMAKE_CURRENT_SOURCE_DIR}/bash_test.sh)
413 endif() # BUILD_TESTING
415 # Documentation generated by Doxygen
416 if(JPEGXL_ENABLE_DOXYGEN)
417 find_package(Doxygen)
419 set(DOXYGEN_GENERATE_HTML "YES")
420 set(DOXYGEN_GENERATE_XML "YES")
421 set(DOXYGEN_STRIP_FROM_PATH "${CMAKE_CURRENT_SOURCE_DIR}/lib/include")
422 set(DOXYGEN_USE_MDFILE_AS_MAINPAGE "README.md")
423 if(JPEGXL_WARNINGS_AS_ERRORS)
424 set(DOXYGEN_WARN_AS_ERROR "YES")
426 set(DOXYGEN_QUIET "YES")
428 "${CMAKE_CURRENT_SOURCE_DIR}/lib/include"
429 "${CMAKE_CURRENT_SOURCE_DIR}/doc/api.txt"
430 WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
431 COMMENT "Generating C API documentation")
433 # Add sphinx doc build step for readthedocs.io (requires doxygen too).
434 find_program(SPHINX_BUILD_PROGRAM sphinx-build)
435 if(SPHINX_BUILD_PROGRAM)
437 OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/rtd/nonexistent"
438 COMMENT "Generating readthedocs.io output on ${CMAKE_CURRENT_BINARY_DIR}/rtd"
439 COMMAND ${SPHINX_BUILD_PROGRAM} -q -W -b html -j auto
440 ${CMAKE_SOURCE_DIR}/doc/sphinx
441 ${CMAKE_CURRENT_BINARY_DIR}/rtd
444 # This command runs the documentation generation every time since the output
445 # target file doesn't exist.
446 add_custom_target(rtd-html
447 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/rtd/nonexistent
449 else() # SPHINX_BUILD_PROGRAM\
450 message(WARNING "sphinx-build not found, skipping rtd documentation")
451 endif() # SPHINX_BUILD_PROGRAM
454 # Create a "doc" target for compatibility since "doc" is not otherwise added to
455 # the build when doxygen is not installed.
456 add_custom_target(doc false
457 COMMENT "Error: Can't generate doc since Doxygen not installed.")
458 endif() # DOXYGEN_FOUND
459 endif() # JPEGXL_ENABLE_DOXYGEN
461 if(JPEGXL_ENABLE_MANPAGES)
462 find_program(ASCIIDOC a2x)
464 file(STRINGS "${ASCIIDOC}" ASCIIDOC_SHEBANG LIMIT_COUNT 1)
465 if(ASCIIDOC_SHEBANG MATCHES "/sh|/bash" OR MINGW)
466 set(ASCIIDOC_PY_FOUND ON)
467 # Run the program directly and set ASCIIDOC as empty.
468 set(ASCIIDOC_PY "${ASCIIDOC}")
470 elseif(ASCIIDOC_SHEBANG MATCHES "python2")
471 find_package(Python2 COMPONENTS Interpreter)
472 set(ASCIIDOC_PY_FOUND "${Python2_Interpreter_FOUND}")
473 set(ASCIIDOC_PY Python2::Interpreter)
474 elseif(ASCIIDOC_SHEBANG MATCHES "python3")
475 find_package(Python3 COMPONENTS Interpreter)
476 set(ASCIIDOC_PY_FOUND "${Python3_Interpreter_FOUND}")
477 set(ASCIIDOC_PY Python3::Interpreter)
479 find_package(Python COMPONENTS Interpreter QUIET)
480 if(NOT Python_Interpreter_FOUND)
481 find_program(ASCIIDOC_PY python)
483 set(ASCIIDOC_PY_FOUND ON)
486 set(ASCIIDOC_PY_FOUND "${Python_Interpreter_FOUND}")
487 set(ASCIIDOC_PY Python::Interpreter)
491 if (ASCIIDOC_PY_FOUND)
492 set(MANPAGE_FILES "")
494 foreach(PAGE IN ITEMS cjxl djxl)
495 # Invoking the Python interpreter ourselves instead of running the a2x binary
496 # directly is necessary on MSYS2, otherwise it is run through cmd.exe which
497 # does not recognize it.
500 COMMAND "${ASCIIDOC_PY}"
502 --format manpage --destination-dir="${CMAKE_CURRENT_BINARY_DIR}"
503 "${CMAKE_CURRENT_SOURCE_DIR}/doc/man/${PAGE}.txt"
504 MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/doc/man/${PAGE}.txt")
505 list(APPEND MANPAGE_FILES "${CMAKE_CURRENT_BINARY_DIR}/${PAGE}.1")
506 list(APPEND MANPAGES "${PAGE}.1")
508 add_custom_target(manpages ALL DEPENDS ${MANPAGES})
509 install(FILES ${MANPAGE_FILES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
510 endif() # ASCIIDOC_PY_FOUND
512 message(WARNING "asciidoc was not found, the man pages will not be installed.")
514 endif() # JPEGXL_ENABLE_MANPAGES
516 # Example usage code.
517 if (JPEGXL_ENABLE_EXAMPLES)
518 include(examples/examples.cmake)
521 # Plugins for third-party software
522 if (JPEGXL_ENABLE_PLUGINS)
523 add_subdirectory(plugins)
527 add_subdirectory(tools)