@@ -2,7 +2,7 @@ load("@bazel_skylib//lib:paths.bzl", "paths")
22load ("@pybind11_bazel//:build_defs.bzl" , "pybind_extension" )
33load ("@rules_proto//proto:defs.bzl" , "proto_library" )
44load ("@rules_cc//cc:defs.bzl" , "cc_binary" , "cc_library" , "cc_proto_library" , "cc_test" )
5- load ("//third_party:substitution.bzl" , "template_rule " )
5+ load ("//third_party:substitution.bzl" , "header_template_rule " )
66load ("//:tools/build_variables.bzl" , "torch_cpp_srcs" , "libtorch_python_core_sources" , "libtorch_core_sources" , "libtorch_distributed_sources" , "libtorch_extra_sources" , "jit_core_sources" )
77load ("//tools/rules:cu.bzl" , "cu_library" )
88load ("//tools/config:defs.bzl" , "if_cuda" )
@@ -27,19 +27,18 @@ COMMON_COPTS = [
2727])
2828
2929# c10
30- template_rule (
30+ header_template_rule (
3131 name = "cmake_macros_h" ,
3232 src = "c10/macros/cmake_macros.h.in" ,
3333 out = "c10/macros/cmake_macros.h" ,
3434 substitutions = {
3535 "cmakedefine" : "define" ,
3636 "#define FEATURE_TORCH_MOBILE" : "/* #undef FEATURE_TORCH_MOBILE */" ,
37- "#define USE_STATIC_DISPATCH" : "/* #undef USE_STATIC_DISPATCH */" ,
3837 "#define C10_USE_NUMA" : "/* #undef C10_USE_NUMA */" ,
3938 },
4039)
4140
42- template_rule (
41+ header_template_rule (
4342 name = "cuda_cmake_macros_h" ,
4443 src = "c10/cuda/impl/cuda_cmake_macros.h.in" ,
4544 out = "c10/cuda/impl/cuda_cmake_macros.h" ,
@@ -58,13 +57,12 @@ cc_library(
5857 "c10/macros/*.h" ,
5958 "c10/util/*.h" ,
6059 "c10/util/*.hpp" ,
61- ]) + [
62- "c10/macros/cmake_macros.h" ,
63- "c10/cuda/impl/cuda_cmake_macros.h" ,
64- ],
60+ ]),
6561 deps = [
6662 "@com_github_gflags_gflags//:gflags" ,
6763 "@com_github_glog//:glog" ,
64+ ":cmake_macros_h" ,
65+ ":cuda_cmake_macros_h" ,
6866 ],
6967)
7068
@@ -531,7 +529,7 @@ filegroup(
531529 ],
532530)
533531
534- template_rule (
532+ header_template_rule (
535533 name = "aten_src_ATen_config" ,
536534 src = "aten/src/ATen/Config.h.in" ,
537535 out = "aten/src/ATen/Config.h" ,
@@ -547,7 +545,7 @@ template_rule(
547545 },
548546)
549547
550- template_rule (
548+ header_template_rule (
551549 name = "aten_src_ATen_cuda_config" ,
552550 src = "aten/src/ATen/cuda/CUDAConfig.h.in" ,
553551 out = "aten/src/ATen/cuda/CUDAConfig.h" ,
@@ -558,7 +556,7 @@ template_rule(
558556 },
559557)
560558
561- template_rule (
559+ header_template_rule (
562560 name = "aten_src_TH_THGeneral" ,
563561 src = "aten/src/TH/THGeneral.h.in" ,
564562 out = "aten/src/TH/THGeneral.h" ,
@@ -570,7 +568,7 @@ template_rule(
570568 },
571569)
572570
573- template_rule (
571+ header_template_rule (
574572 name = "aten_src_THC_THCGeneral" ,
575573 src = "aten/src/THC/THCGeneral.h.in" ,
576574 out = "aten/src/THC/THCGeneral.h" ,
@@ -582,8 +580,6 @@ template_rule(
582580cc_library (
583581 name = "aten_headers" ,
584582 hdrs = [
585- "aten/src/TH/THGeneral.h" ,
586- "aten/src/THC/THCGeneral.h" ,
587583 "torch/csrc/WindowsTorchApiMacro.h" ,
588584 "torch/csrc/jit/frontend/function_schema_parser.h" ,
589585 ] + glob ([
@@ -605,6 +601,8 @@ cc_library(
605601 ],
606602 deps = [
607603 ":c10_headers" ,
604+ ":aten_src_TH_THGeneral" ,
605+ ":aten_src_THC_THCGeneral" ,
608606 ],
609607)
610608
@@ -766,7 +764,7 @@ cc_proto_library(
766764 deps = [":caffe2_proto_source" ],
767765)
768766
769- template_rule (
767+ header_template_rule (
770768 name = "caffe2_core_macros_h" ,
771769 src = "caffe2/core/macros.h.in" ,
772770 out = "caffe2/core/macros.h" ,
@@ -1586,7 +1584,6 @@ filegroup(
15861584cc_library (
15871585 name = "caffe2_for_aten_headers" ,
15881586 hdrs = [
1589- "caffe2/core/macros.h" ,
15901587 "caffe2/core/common.h" ,
15911588 "caffe2/core/logging.h" ,
15921589 "caffe2/core/types.h" ,
@@ -1604,6 +1601,7 @@ cc_library(
16041601 deps = [
16051602 ":c10_headers" ,
16061603 ":caffe2_protos" ,
1604+ ":caffe2_core_macros_h" ,
16071605 ],
16081606)
16091607
0 commit comments