mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
26 lines
1.1 KiB
Python
26 lines
1.1 KiB
Python
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"],
|
|
)
|