generate caffe2/core/macros.h in shared build structure (#98131)

This is only used by Bazel for now.

Differential Revision: [D44604078](https://our.internmc.facebook.com/intern/diff/D44604078/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D44604078/)!
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98131
Approved by: https://github.com/ezyang, https://github.com/PaliC
This commit is contained in:
mikey dagitses 2023-04-03 17:42:57 -07:00 committed by PyTorch MergeBot
parent d47a4bf53f
commit 301f00f350
2 changed files with 18 additions and 22 deletions

View File

@ -450,28 +450,6 @@ CAFFE2_COPTS = COMMON_COPTS + [
"-fno-trapping-math",
]
header_template_rule(
name = "caffe2_core_macros_h",
src = "caffe2/core/macros.h.in",
out = "caffe2/core/macros.h",
substitutions = {
"cmakedefine": "define",
"#define CAFFE2_FORCE_FALLBACK_CUDA_MPI": "/* #undef CAFFE2_FORCE_FALLBACK_CUDA_MPI */",
"#define CAFFE2_HAS_MKL_DNN": "/* #undef CAFFE2_HAS_MKL_DNN */",
"#define CAFFE2_HAS_MKL_SGEMM_PACK": "/* #undef CAFFE2_HAS_MKL_SGEMM_PACK */",
"#define CAFFE2_THREADPOOL_MAIN_IMBALANCE": "/* #undef CAFFE2_THREADPOOL_MAIN_IMBALANCE */",
"#define CAFFE2_THREADPOOL_STATS": "/* #undef CAFFE2_THREADPOOL_STATS */",
"#define CAFFE2_USE_ACCELERATE": "/* #undef CAFFE2_USE_ACCELERATE */",
"#define CAFFE2_USE_EIGEN_FOR_BLAS": "/* #undef CAFFE2_USE_EIGEN_FOR_BLAS */",
"#define CAFFE2_USE_FBCODE": "/* #undef CAFFE2_USE_FBCODE */",
"#define CAFFE2_USE_GOOGLE_GLOG": "/* #undef CAFFE2_USE_GOOGLE_GLOG */",
"#define CAFFE2_USE_LITE_PROTO": "/* #undef CAFFE2_USE_LITE_PROTO */",
"#define CAFFE2_USE_MKL\n": "/* #undef CAFFE2_USE_MKL */\n",
"#define CAFFE2_USE_NVTX": "/* #undef CAFFE2_USE_NVTX */",
"#define CAFFE2_USE_TRT": "/* #undef CAFFE2_USE_TRT */",
},
)
filegroup(
name = "caffe2_contrib_srcs",
srcs = [

View File

@ -6,6 +6,24 @@ load(
)
def define_targets(rules):
rules.cmake_configure_file(
name = "caffe2_core_macros_h",
src = "caffe2/core/macros.h.in",
out = "caffe2/core/macros.h",
definitions = [
"CAFFE2_BUILD_SHARED_LIBS",
"CAFFE2_PERF_WITH_AVX",
"CAFFE2_PERF_WITH_AVX2",
"CAFFE2_PERF_WITH_AVX512",
"CAFFE2_USE_EXCEPTION_PTR",
"CAFFE2_USE_CUDNN",
"USE_MKLDNN",
"CAFFE2_USE_ITT",
"TORCH_DISABLE_GPU_ASSERTS",
"EIGEN_MPL2_ONLY",
],
)
rules.cc_library(
name = "caffe2_serialize",
srcs = [