xref: /aosp_15_r20/external/pytorch/c10/BUCK.oss (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1load("//tools/build_defs:glob_defs.bzl", "subdir_glob")
2
3cxx_library(
4    name = "c10",
5    srcs = glob(
6        ["**/*.cpp"],
7        exclude = [
8            "test/**/*.cpp",
9            "benchmark/**/*.cpp",
10            "cuda/**/*.cpp",
11            "xpu/**/*.cpp",
12        ],
13    ),
14      deps = [
15        "//third_party:cpuinfo",
16        "//third_party:fmt",
17        "//third_party:glog",
18    ],
19    exported_deps = [],
20    compiler_flags = [
21        "-Werror",
22        "-Wno-global-constructors",
23        "-DDISABLE_NAMEDTENSOR",
24        "-DSUPPORTS_BACKTRACE=0"
25    ],
26    exported_headers = subdir_glob(
27        [
28            ("", "**/*.h"),
29        ],
30        exclude = [
31            "test/**/*.h",
32            "benchmark/**/*.h",
33            "cuda/**/*.h",
34            "xpu/**/*.h",
35        ],
36    ),
37    exported_linker_flags = [],
38    exported_preprocessor_flags = [
39        '-DC10_USING_CUSTOM_GENERATED_MACROS',
40        '-DC10_USE_GLOG',
41        '-DC10_USE_MINIMAL_GLOG',
42        '-DC10_MOBILE',
43        '-fexceptions',
44        '-Wno-global-constructors'
45    ],
46    header_namespace = "c10",
47    link_whole = True,
48    platform_preprocessor_flags = [['windows', ['-D_WINDOWS', '-D_WIN32', '-DWIN32', '-DNOMINMAX', '-D_CRT_SECURE_NO_WARNINGS', '-D_USE_MATH_DEFINES']], ['windows.*64$', ['-D_WIN64']]],
49    preprocessor_flags = ['-DC10_BUILD_MAIN_LIB'],
50    reexport_all_header_dependencies = True,
51    visibility = ['PUBLIC'],
52)
53