xref: /aosp_15_r20/external/skia/bazel/external/dng_sdk/BUILD.bazel (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1# This file will be copied into //third_party/externals/dng_sdk via the new_local_repository
2# rule in WORKSPACE.bazel, so all files should be relative to that path.
3load("@bazel_skylib//lib:selects.bzl", "selects")
4
5cc_library(
6    name = "dng_sdk",
7    srcs = [
8        "source/dng_1d_function.cpp",
9        "source/dng_1d_table.cpp",
10        "source/dng_abort_sniffer.cpp",
11        "source/dng_area_task.cpp",
12        "source/dng_bad_pixels.cpp",
13        "source/dng_bottlenecks.cpp",
14        "source/dng_camera_profile.cpp",
15        "source/dng_color_space.cpp",
16        "source/dng_color_spec.cpp",
17        "source/dng_date_time.cpp",
18        "source/dng_exceptions.cpp",
19        "source/dng_exif.cpp",
20        "source/dng_file_stream.cpp",
21        "source/dng_filter_task.cpp",
22        "source/dng_fingerprint.cpp",
23        "source/dng_gain_map.cpp",
24        "source/dng_globals.cpp",
25        "source/dng_host.cpp",
26        "source/dng_hue_sat_map.cpp",
27        "source/dng_ifd.cpp",
28        "source/dng_image.cpp",
29        "source/dng_image_writer.cpp",
30        "source/dng_info.cpp",
31        "source/dng_iptc.cpp",
32        "source/dng_jpeg_image.cpp",
33        "source/dng_jpeg_memory_source.cpp",
34        "source/dng_lens_correction.cpp",
35        "source/dng_linearization_info.cpp",
36        "source/dng_lossless_jpeg.cpp",
37        "source/dng_matrix.cpp",
38        "source/dng_memory.cpp",
39        "source/dng_memory_stream.cpp",
40        "source/dng_misc_opcodes.cpp",
41        "source/dng_mosaic_info.cpp",
42        "source/dng_mutex.cpp",
43        "source/dng_negative.cpp",
44        "source/dng_opcode_list.cpp",
45        "source/dng_opcodes.cpp",
46        "source/dng_orientation.cpp",
47        "source/dng_parse_utils.cpp",
48        "source/dng_pixel_buffer.cpp",
49        "source/dng_point.cpp",
50        "source/dng_preview.cpp",
51        "source/dng_pthread.cpp",
52        "source/dng_rational.cpp",
53        "source/dng_read_image.cpp",
54        "source/dng_rect.cpp",
55        "source/dng_ref_counted_block.cpp",
56        "source/dng_reference.cpp",
57        "source/dng_render.cpp",
58        "source/dng_resample.cpp",
59        "source/dng_safe_arithmetic.cpp",
60        "source/dng_shared.cpp",
61        "source/dng_simple_image.cpp",
62        "source/dng_spline.cpp",
63        "source/dng_stream.cpp",
64        "source/dng_string.cpp",
65        "source/dng_string_list.cpp",
66        "source/dng_tag_types.cpp",
67        "source/dng_temperature.cpp",
68        "source/dng_tile_iterator.cpp",
69        "source/dng_tone_curve.cpp",
70        "source/dng_utils.cpp",
71        "source/dng_xy_coord.cpp",
72    ],
73    hdrs = [
74        "source/RawEnvironment.h",
75        "source/dng_1d_function.h",
76        "source/dng_1d_table.h",
77        "source/dng_abort_sniffer.h",
78        "source/dng_area_task.h",
79        "source/dng_assertions.h",
80        "source/dng_auto_ptr.h",
81        "source/dng_bad_pixels.h",
82        "source/dng_bottlenecks.h",
83        "source/dng_camera_profile.h",
84        "source/dng_classes.h",
85        "source/dng_color_space.h",
86        "source/dng_color_spec.h",
87        "source/dng_date_time.h",
88        "source/dng_errors.h",
89        "source/dng_exceptions.h",
90        "source/dng_exif.h",
91        "source/dng_fast_module.h",
92        "source/dng_file_stream.h",
93        "source/dng_filter_task.h",
94        "source/dng_fingerprint.h",
95        "source/dng_flags.h",
96        "source/dng_gain_map.h",
97        "source/dng_globals.h",
98        "source/dng_host.h",
99        "source/dng_hue_sat_map.h",
100        "source/dng_ifd.h",
101        "source/dng_image.h",
102        "source/dng_image_writer.h",
103        "source/dng_info.h",
104        "source/dng_iptc.h",
105        "source/dng_jpeg_image.h",
106        "source/dng_jpeg_memory_source.h",
107        "source/dng_jpeglib.h",
108        "source/dng_lens_correction.h",
109        "source/dng_linearization_info.h",
110        "source/dng_lossless_jpeg.h",
111        "source/dng_matrix.h",
112        "source/dng_memory.h",
113        "source/dng_memory_stream.h",
114        "source/dng_misc_opcodes.h",
115        "source/dng_mosaic_info.h",
116        "source/dng_mutex.h",
117        "source/dng_negative.h",
118        "source/dng_opcode_list.h",
119        "source/dng_opcodes.h",
120        "source/dng_orientation.h",
121        "source/dng_parse_utils.h",
122        "source/dng_pixel_buffer.h",
123        "source/dng_point.h",
124        "source/dng_preview.h",
125        "source/dng_pthread.h",
126        "source/dng_rational.h",
127        "source/dng_read_image.h",
128        "source/dng_rect.h",
129        "source/dng_ref_counted_block.h",
130        "source/dng_reference.h",
131        "source/dng_render.h",
132        "source/dng_resample.h",
133        "source/dng_safe_arithmetic.h",
134        "source/dng_sdk_limits.h",
135        "source/dng_shared.h",
136        "source/dng_simple_image.h",
137        "source/dng_spline.h",
138        "source/dng_stream.h",
139        "source/dng_string.h",
140        "source/dng_string_list.h",
141        "source/dng_tag_codes.h",
142        "source/dng_tag_types.h",
143        "source/dng_tag_values.h",
144        "source/dng_temperature.h",
145        "source/dng_tile_iterator.h",
146        "source/dng_tone_curve.h",
147        "source/dng_types.h",
148        "source/dng_uncopyable.h",
149        "source/dng_utils.h",
150        "source/dng_xy_coord.h",
151    ],
152    defines = [
153        "qDNGBigEndian=0",  # The GN rules had this defined publicly
154    ] + selects.with_or({
155        ("@platforms//cpu:x86_64", "@platforms//cpu:arm"): [
156            # DNG SDK uses __builtin_smulll_overflow() to detect 64x64 bit multiply overflow.
157            # On some platforms, the compiler implements this with __mulodi4().
158            # I can't quite figure out how to link that here, so instead here's a shim for
159            # __builtin_smulll_overflow() that multiplies normally assuming no overflow.
160            # Previously tracked in b/29412086.
161            # Currently, without this define, we see:
162            # Error: cannot initialize a parameter of type 'long long *' with an rvalue of type 'std::int64_t *' (aka 'long *')
163            "__builtin_smulll_overflow(x,y,p)=(*(p)=(x)*(y),false)",
164        ],
165        "//conditions:default": [],
166    }),
167    includes = ["source"],
168    local_defines = [
169        "qDNGReportErrors=0",
170        "qDNGThreadSafe=1",
171        "qDNGUseLibJPEG=1",
172        "qDNGUseXMP=0",
173        "qDNGValidate=0",
174        "qDNGValidateTarget=1",
175        "UNIX_ENV=1",
176    ],
177    visibility = ["//visibility:public"],
178    deps = [
179        "@libjpeg_turbo",
180        "@zlib_skia//:zlib",
181    ],
182)
183