-
-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: windows toolchain for running clang tools #342
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
# Copyright 2021 The Bazel Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
# Some targets may need to directly depend on these files. | ||
exports_files(glob([ | ||
"bin/*", | ||
"lib/*", | ||
"include/*", | ||
])) | ||
|
||
## LLVM toolchain files | ||
|
||
ALL_DLLS = glob(["bin/*.dll"]) | ||
|
||
filegroup( | ||
name = "clang", | ||
srcs = [ | ||
"bin/clang.exe", | ||
"bin/clang++.exe", | ||
"bin/clang-cpp.exe", | ||
peakschris marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"bin/clang-cl.exe", | ||
] + ALL_DLLS, | ||
) | ||
|
||
filegroup( | ||
name = "clang-cl", | ||
srcs = [ | ||
"bin/clang-cl.exe", | ||
] + ALL_DLLS, | ||
) | ||
|
||
filegroup( | ||
name = "llvm-ml", | ||
srcs = [ | ||
"bin/llvm-ml.exe", | ||
] + ALL_DLLS, | ||
) | ||
|
||
filegroup( | ||
name = "ld", | ||
# a set of 4 identical binaries? | ||
srcs = ["bin/ld.lld.exe", "bin/ld64.lld.exe", "lld-link.exe", "lld.exe"] + ALL_DLLS, | ||
) | ||
|
||
filegroup( | ||
name = "lld-link", | ||
srcs = [ | ||
"bin/lld-link.exe", | ||
] + ALL_DLLS, | ||
) | ||
|
||
filegroup( | ||
name = "llvm-lib", | ||
srcs = [ | ||
"bin/llvm-lib.exe", | ||
] + ALL_DLLS, | ||
) | ||
|
||
filegroup( | ||
name = "include", | ||
srcs = glob([ | ||
"include/**/c++/**", | ||
"lib/clang/*/include/**", | ||
]), | ||
) | ||
|
||
filegroup( | ||
name = "all_includes", | ||
srcs = glob(["include/**"]), | ||
) | ||
|
||
filegroup( | ||
name = "bin", | ||
srcs = glob(["bin/**"]), | ||
) | ||
Comment on lines
+85
to
+88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not very familiar with Windows but IIUC the binaries require the DLLs in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't need the DLLs as I already have them installed via MSVC on our systems. But for others without MSVC this is a good point. Have a look at my fix, as I don't know how these filegroups will be consumed downstream I'm not sure if the DLLs should go in srcs or data or simply allow downstream to consume separately from the dlls filegroup. |
||
|
||
filegroup( | ||
name = "lib", | ||
srcs = glob( | ||
[ | ||
"lib/**/*.lib", | ||
], | ||
exclude = [ | ||
"lib/LLVM*.lib", | ||
"lib/clang*.lib", | ||
"lib/lld*.lib", | ||
], | ||
), | ||
) | ||
|
||
filegroup( | ||
name = "dll", | ||
srcs = ALL_DLLS, | ||
) | ||
|
||
filegroup( | ||
name = "ar", | ||
srcs = ["bin/llvm-ar.exe"] + ALL_DLLS, | ||
) | ||
|
||
filegroup( | ||
name = "as", | ||
srcs = [ | ||
"bin/clang.exe", | ||
"bin/llvm-as.exe", | ||
] + ALL_DLLS, | ||
) | ||
|
||
filegroup( | ||
name = "nm", | ||
srcs = ["bin/llvm-nm.exe"] + ALL_DLLS, | ||
) | ||
|
||
filegroup( | ||
name = "objcopy", | ||
srcs = ["bin/llvm-objcopy.exe"] + ALL_DLLS, | ||
) | ||
|
||
filegroup( | ||
name = "objdump", | ||
srcs = ["bin/llvm-objdump.exe"] + ALL_DLLS, | ||
) | ||
|
||
filegroup( | ||
name = "profdata", | ||
srcs = ["bin/llvm-profdata.exe"] + ALL_DLLS, | ||
) | ||
|
||
filegroup( | ||
name = "dwp", | ||
srcs = ["bin/llvm-dwp.exe"] + ALL_DLLS, | ||
) | ||
|
||
filegroup( | ||
name = "ranlib", | ||
srcs = ["bin/llvm-ranlib.exe"] + ALL_DLLS, | ||
) | ||
|
||
filegroup( | ||
name = "readelf", | ||
srcs = ["bin/llvm-readelf.exe"] + ALL_DLLS, | ||
) | ||
|
||
filegroup( | ||
name = "strip", | ||
srcs = ["bin/llvm-strip.exe"] + ALL_DLLS, | ||
) | ||
|
||
filegroup( | ||
name = "symbolizer", | ||
srcs = ["bin/llvm-symbolizer.exe"] + ALL_DLLS, | ||
) | ||
|
||
filegroup( | ||
name = "clang-tidy", | ||
srcs = ["bin/clang-tidy.exe"] + ALL_DLLS, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT about unifying this with
BUILD.llvm_repo
? It seems like the discrepancies are mostly just in the file extensions (.exe
,.lib
for Windows).Maybe something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds good but I'm not sure how the templating would work, could you elaborate?