• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# This file will be copied into //third_party/externals/wuffs via the new_local_repository
2# rule in WORKSPACE.bazel, so all files should be relative to that path.
3
4cc_library(
5    name = "wuffs",
6    # We list this file both as a source file and a header file because it will be
7    # compiled for symbols *and* included as a header file.
8    srcs = ["release/c/wuffs-v0.3.c"],
9    # Thankfully, Bazel doesn't mind a .c file being declared as a public "header".
10    hdrs = ["release/c/wuffs-v0.3.c"],
11    includes = ["release/c"],
12    local_defines = [
13        # Copy/pasting from "release/c/wuffs-*.c":
14        #
15        # ----
16        #
17        # Wuffs ships as a "single file C library" or "header file library" as per
18        # https://github.com/nothings/stb/blob/master/docs/stb_howto.txt
19        #
20        # To use that single file as a "foo.c"-like implementation, instead of a
21        # "foo.h"-like header, #define WUFFS_IMPLEMENTATION before #include'ing or
22        # compiling it.
23        #
24        # ----
25        "WUFFS_IMPLEMENTATION",
26
27        # Continuing to copy/paste:
28        #
29        # ----
30        #
31        # Defining the WUFFS_CONFIG__MODULE* macros are optional, but it lets users
32        # of Wuffs' .c file specify which parts of Wuffs to build. That file
33        # contains the entire Wuffs standard library, implementing a variety of
34        # codecs and file formats. Without this macro definition, an optimizing
35        # compiler or linker may very well discard Wuffs code for unused codecs,
36        # but listing the Wuffs modules we use makes that process explicit.
37        # Preprocessing means that such code simply isn't compiled.
38        #
39        # ----
40        #
41        # For Skia, we're only interested in particular image codes (e.g. GIF) and
42        # their dependencies (e.g. BASE, LZW).
43        "WUFFS_CONFIG__MODULES",
44        "WUFFS_CONFIG__MODULE__BASE",
45        "WUFFS_CONFIG__MODULE__GIF",
46        "WUFFS_CONFIG__MODULE__LZW",
47    ],
48    visibility = ["//visibility:public"],
49)
50