What's the difference between BUILD.bzl and cmake?

i want to know about the difference between ‘BUILD.bzl’ file and cmake.
What is ‘BUILD.bzl’ file for and what is PyTorch/cmake for?
I think both of them are necessary to build a pytorch, but if it’s wrong, please let me know.
Have a nice day.
Thank you.

If I understand correctly the BUILD.bazel file is for building with well, bazel. cmake builds seem to be more common in my experience (what most users use when building natively from souce) and do not depend on the BUILD.bazel file.

Why do cmake need if the PyTorch building with Bazel?
I want to know what Bazel builds and what cmake builds in PyTorch.

As far as I can tell they are not really for building different things, but rather for different build systems depending on which you use. And most users seem to use CMake. You can verify that you don’t need BUILD.bazel when building with cmake because you can just delete the file and it will build just fine. Both build the underlying implementation of PyTorch (kernels, implementation of the tensor representation, etc.)