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 set(JPEGXL_MAJOR_VERSION 0)
7 set(JPEGXL_MINOR_VERSION 10)
8 set(JPEGXL_PATCH_VERSION 0)
9 set(JPEGXL_LIBRARY_VERSION
10 "${JPEGXL_MAJOR_VERSION}.${JPEGXL_MINOR_VERSION}.${JPEGXL_PATCH_VERSION}")
12 # This is the library API/ABI compatibility version. Changing this value makes
13 # the shared library incompatible with previous version. A program linked
14 # against this shared library SOVERSION will not run with an older SOVERSION.
15 # It is important to update this value when making incompatible API/ABI changes
16 # so that programs that depend on libjxl can update their dependencies. Semantic
17 # versioning allows 0.y.z to have incompatible changes in minor versions.
18 set(JPEGXL_SO_MINOR_VERSION 10)
19 if (JPEGXL_MAJOR_VERSION EQUAL 0)
20 set(JPEGXL_LIBRARY_SOVERSION
21 "${JPEGXL_MAJOR_VERSION}.${JPEGXL_SO_MINOR_VERSION}")
23 set(JPEGXL_LIBRARY_SOVERSION "${JPEGXL_MAJOR_VERSION}")
27 # List of warning and feature flags for our library and tests.
29 set(JPEGXL_INTERNAL_FLAGS
30 # TODO(janwas): add flags
33 set(JPEGXL_INTERNAL_FLAGS
45 -Wimplicit-fallthrough
46 -Wno-register # Needed by public headers in lcms
54 # Warning flags supported by clang.
55 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
56 list(APPEND JPEGXL_INTERNAL_FLAGS
57 -Wdeprecated-increment-bool
58 # TODO(deymo): Add -Wextra-semi once we update third_party/highway.
60 -Wfloat-overflow-conversion
61 -Wfloat-zero-conversion
67 -Wno-unused-command-line-argument
71 -Wtautological-overlap-compare
72 -Wthread-safety-analysis
73 -Wundefined-func-template
77 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.0)
78 list(APPEND HWY_FLAGS -Wc++2a-extensions)
83 list(APPEND JPEGXL_INTERNAL_FLAGS
87 -Wno-format-nonliteral
90 -Wno-zero-as-null-pointer-constant
93 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
94 list(APPEND JPEGXL_INTERNAL_FLAGS
95 -Wno-used-but-marked-unused
97 -Wno-unused-member-function
98 -Wno-shadow-field-in-constructor
99 -Wno-language-extension-token
100 -Wno-global-constructors
101 -Wno-c++98-compat-pedantic
105 list(APPEND JPEGXL_INTERNAL_FLAGS
113 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
114 list(APPEND JPEGXL_INTERNAL_FLAGS
121 -disable-llvm-verifier
127 if (JPEGXL_ENABLE_SKCMS)
128 list(APPEND JPEGXL_INTERNAL_FLAGS -DJPEGXL_ENABLE_SKCMS=1)
131 # strips the -internal suffix from all the elements in LIST
132 function(strip_internal OUTPUT_VAR LIB_LIST)
133 foreach(lib IN LISTS ${LIB_LIST})
134 string(REGEX REPLACE "-internal$" "" lib "${lib}")
135 list(APPEND out_list "${lib}")
137 set(${OUTPUT_VAR} ${out_list} PARENT_SCOPE)
140 # set variables for jxl_cms.cmake and jxl.cmake
141 if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
142 set(PKGCONFIG_TARGET_INCLUDES "${CMAKE_INSTALL_INCLUDEDIR}")
144 set(PKGCONFIG_TARGET_INCLUDES "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
146 if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
147 set(PKGCONFIG_TARGET_LIBS "${CMAKE_INSTALL_LIBDIR}")
149 set(PKGCONFIG_TARGET_LIBS "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
152 # The jxl_cms library definition.
153 include(jxl_cms.cmake)
154 # The jxl library definition.
157 # Other libraries outside the core jxl library.
158 if(JPEGXL_ENABLE_TOOLS OR BUILD_TESTING)
159 include(jxl_extras.cmake)
161 include(jxl_threads.cmake)
162 if (JPEGXL_ENABLE_JPEGLI)
163 include(jpegli.cmake)
166 # Install all the library headers from the source and the generated ones. There
167 # is no distinction on which libraries use which header since it is expected
168 # that all developer libraries are available together at build time.
169 install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/jxl
170 DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
171 install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/jxl
172 DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
178 # Tests for the jxl library.
179 include(jxl_tests.cmake)
182 # Google benchmark for the jxl library
183 include(jxl_benchmark.cmake)