xref: /aosp_15_r20/external/pytorch/c10/macros/build.bzl (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1def define_targets(rules):
2    rules.cc_library(
3        name = "macros",
4        srcs = [":cmake_macros_h"],
5        hdrs = [
6            "Macros.h",
7            # Despite the documentation in Macros.h, Export.h is included
8            # directly by many downstream files. Thus, we declare it as a
9            # public header in this file.
10            "Export.h",
11        ],
12        linkstatic = True,
13        local_defines = ["C10_BUILD_MAIN_LIB"],
14        visibility = ["//visibility:public"],
15    )
16
17    rules.cmake_configure_file(
18        name = "cmake_macros_h",
19        src = "cmake_macros.h.in",
20        out = "cmake_macros.h",
21        definitions = [
22            "C10_BUILD_SHARED_LIBS",
23            "C10_USE_MSVC_STATIC_RUNTIME",
24        ] + rules.select({
25            "//c10:using_gflags": ["C10_USE_GFLAGS"],
26            "//conditions:default": [],
27        }) + rules.select({
28            "//c10:using_glog": ["C10_USE_GLOG"],
29            "//conditions:default": [],
30        }),
31    )
32
33    rules.filegroup(
34        name = "headers",
35        srcs = rules.glob(
36            ["*.h"],
37            exclude = [
38            ],
39        ),
40        visibility = ["//:__pkg__"],
41    )
42