forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathminiz_target_definition.bzl
25 lines (24 loc) · 1.15 KB
/
miniz_target_definition.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load("//caffe2/tools:sgx_target_definitions.bzl", "is_sgx")
def add_miniz_lib():
cpp_library(
name = "miniz",
srcs = [
"third_party/miniz-2.0.8/fb/FollyCrcPlugin.cpp",
"third_party/miniz-2.0.8/fb/miniz-fb.c",
],
headers = {
"caffe2/third_party/miniz-2.0.8/miniz.c": "third_party/miniz-2.0.8/miniz.c",
"miniz-fb.h": "third_party/miniz-2.0.8/fb/miniz-fb.h",
"miniz.h": "third_party/miniz-2.0.8/miniz.h",
},
header_namespace = "",
# -fexceptions is required, otherwise, when we use @mode/opt-clang-thinlto,
# c functions become noexcept, and we may not be able to catch exceptions
# during model loading.
compiler_flags = ["-DUSE_EXTERNAL_MZCRC", "-fexceptions"] + (["-DMINIZ_NO_STDIO"] if is_sgx else []),
# folly is only required as a dependency if USE_EXTERNAL_MZCRC
# above is defined, and FollyCrcPlugin.cpp is added.
# Neither are strictly needed, but run significantly faster.
exported_deps = ["//folly/hash:checksum"],
)