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 # Load sources/headers/tests lists.
11 "libjxl_codec_apng_sources",
12 "libjxl_codec_exr_sources",
13 "libjxl_codec_gif_sources",
14 "libjxl_codec_jpegli_sources",
15 "libjxl_codec_jpg_sources",
16 "libjxl_codec_jxl_sources",
17 "libjxl_codec_npy_sources",
18 "libjxl_codec_pgx_sources",
19 "libjxl_codec_pnm_sources",
20 "libjxl_dec_box_sources",
21 "libjxl_dec_jpeg_sources",
24 "libjxl_extras_for_tools_sources",
25 "libjxl_extras_sources",
26 #'libjxl_gbench_sources',
27 "libjxl_jpegli_lib_version",
28 "libjxl_jpegli_libjpeg_helper_files",
29 "libjxl_jpegli_sources",
30 "libjxl_jpegli_testlib_files",
31 "libjxl_jpegli_tests",
32 "libjxl_major_version",
33 "libjxl_minor_version",
34 "libjxl_patch_version",
35 "libjxl_public_headers",
36 "libjxl_testlib_files",
38 "libjxl_threads_public_headers",
39 "libjxl_threads_sources",
48 "libjxl_deps_hwy_nanobenchmark",
49 "libjxl_deps_hwy_test_util",
52 "libjxl_deps_runfiles",
54 "libjxl_deps_testdata",
55 "libjxl_root_package",
57 "libjxl_test_timeouts",
59 load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
60 load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
62 DEFAULT_VISIBILITY = ["//:__subpackages__"]
64 DEFAULT_COMPATIBILITY = []
66 INCLUDES_DIR = "include"
69 default_visibility = ["//:__subpackages__"],
74 exports_files(["LICENSE"])
84 # define @_DEPRECATED __attribute__ ((__deprecated__))
90 JXL_EXPORT_H = INCLUDES_DIR + "/jxl/jxl_export.h"
93 name = "create_jxl_export",
94 outs = [JXL_EXPORT_H],
95 cmd = "echo '" + EXPORT_TEMPLATE.replace("@", "JXL") + "' > $@",
96 compatible_with = DEFAULT_COMPATIBILITY,
99 JXL_CMS_EXPORT_H = INCLUDES_DIR + "/jxl/jxl_cms_export.h"
102 name = "create_jxl_cms_export",
103 outs = [JXL_CMS_EXPORT_H],
104 cmd = "echo '" + EXPORT_TEMPLATE.replace("@", "JXL_CMS") + "' > $@",
105 compatible_with = DEFAULT_COMPATIBILITY,
108 JXL_THREADS_EXPORT_H = INCLUDES_DIR + "/jxl/jxl_threads_export.h"
111 name = "create_jxl_threads_export",
112 outs = [JXL_THREADS_EXPORT_H],
113 cmd = "echo '" + EXPORT_TEMPLATE.replace("@", "JXL_THREADS") + "' > $@",
114 compatible_with = DEFAULT_COMPATIBILITY,
117 JXL_VERSION_H = INCLUDES_DIR + "/jxl/version.h"
120 name = "expand_jxl_version",
122 compatible_with = DEFAULT_COMPATIBILITY,
124 "@JPEGXL_MAJOR_VERSION@": str(libjxl_major_version),
125 "@JPEGXL_MINOR_VERSION@": str(libjxl_minor_version),
126 "@JPEGXL_PATCH_VERSION@": str(libjxl_patch_version),
128 template = "jxl/version.h.in",
132 name = "jxl_version",
133 hdrs = [JXL_VERSION_H],
134 compatible_with = DEFAULT_COMPATIBILITY,
135 strip_include_prefix = INCLUDES_DIR,
138 JPEGLI_JCONFIG_H = INCLUDES_DIR + "/jpegli/jconfig.h"
140 JPEGLI_JMORECFG_H = INCLUDES_DIR + "/jpegli/jmorecfg.h"
142 JPEGLI_JPEGLIB_H = INCLUDES_DIR + "/jpegli/jpeglib.h"
145 name = "expand_jconfig",
146 src = "@libjpeg_turbo//:jconfig.h",
147 out = JPEGLI_JCONFIG_H,
148 compatible_with = DEFAULT_COMPATIBILITY,
152 name = "copy_jmorecfg",
153 src = "@libjpeg_turbo//:jmorecfg.h",
154 out = JPEGLI_JMORECFG_H,
155 compatible_with = DEFAULT_COMPATIBILITY,
159 name = "copy_jpeglib",
160 src = "@libjpeg_turbo//:jpeglib.h",
161 out = JPEGLI_JPEGLIB_H,
162 compatible_with = DEFAULT_COMPATIBILITY,
167 hdrs = libjxl_public_headers + [
171 compatible_with = DEFAULT_COMPATIBILITY,
172 strip_include_prefix = INCLUDES_DIR,
173 deps = [":jxl_version"],
177 name = "libjpeg_includes",
183 compatible_with = DEFAULT_COMPATIBILITY,
184 strip_include_prefix = INCLUDES_DIR + "/jpegli",
189 srcs = [path for path in libjxl_base_sources if path.endswith(".cc")],
190 hdrs = [path for path in libjxl_base_sources if path.endswith(".h")],
191 compatible_with = DEFAULT_COMPATIBILITY,
199 srcs = libjxl_dec_sources + libjxl_dec_box_sources + libjxl_dec_jpeg_sources + libjxl_enc_sources + libjxl_cms_sources,
200 compatible_with = DEFAULT_COMPATIBILITY,
202 "JPEGXL_ENABLE_SKCMS=1",
207 ] + libjxl_deps_brotli + libjxl_deps_hwy + libjxl_deps_skcms,
211 name = "jpegxl_private",
214 for path in libjxl_dec_sources + libjxl_dec_box_sources + libjxl_dec_jpeg_sources + libjxl_enc_sources + libjxl_cms_sources
215 if path.endswith(".h") and not path.endswith("-inl.h")
217 compatible_with = DEFAULT_COMPATIBILITY,
222 name = "jpegxl_threads",
223 srcs = libjxl_threads_sources,
224 hdrs = libjxl_threads_public_headers + [JXL_THREADS_EXPORT_H],
225 compatible_with = DEFAULT_COMPATIBILITY,
226 strip_include_prefix = INCLUDES_DIR,
233 CODEC_FILES = libjxl_codec_apng_sources + libjxl_codec_exr_sources + libjxl_codec_gif_sources + libjxl_codec_jpegli_sources + libjxl_codec_jpg_sources + libjxl_codec_jxl_sources + libjxl_codec_npy_sources + libjxl_codec_pgx_sources + libjxl_codec_pnm_sources
235 CODEC_SRCS = [path for path in CODEC_FILES if path.endswith(".cc")]
237 CODEC_HDRS = [path for path in CODEC_FILES if path.endswith(".h")]
241 srcs = libjxl_jpegli_sources,
243 "jpegli/common_internal.h", # TODO(eustas): should not be here
245 compatible_with = DEFAULT_COMPATIBILITY,
252 # TODO(eustas): build codecs separately?
254 name = "jpegxl_extras",
255 srcs = libjxl_extras_sources + libjxl_extras_for_tools_sources + CODEC_SRCS,
257 compatible_with = DEFAULT_COMPATIBILITY,
259 "JPEGXL_ENABLE_APNG=1",
260 "JPEGXL_ENABLE_EXR=1",
261 "JPEGXL_ENABLE_GIF=1",
262 "JPEGXL_ENABLE_JPEG=1",
263 "JPEGXL_ENABLE_JPEGLI=1",
270 ] + libjxl_deps_exr + libjxl_deps_gif + libjxl_deps_jpeg + libjxl_deps_png,
273 TESTLIB_FILES = libjxl_testlib_files + libjxl_jpegli_testlib_files + libjxl_jpegli_libjpeg_helper_files
278 srcs = [path for path in TESTLIB_FILES if not path.endswith(".h")],
279 hdrs = [path for path in TESTLIB_FILES if path.endswith(".h")],
280 compatible_with = DEFAULT_COMPATIBILITY,
282 'JPEGXL_ROOT_PACKAGE=\'"' + libjxl_root_package + '"\'',
288 ] + libjxl_deps_runfiles,
291 TESTS = [path.partition(".")[0] for path in libjxl_tests + libjxl_jpegli_tests]
296 timeout = libjxl_test_timeouts.get(test, "moderate"),
302 data = ["//:testdata"],
303 shard_count = libjxl_test_shards.get(test, 1),
309 ] + libjxl_deps_gtest + libjxl_deps_hwy_test_util + libjxl_deps_hwy_nanobenchmark,