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