mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[bazel] Move the easy pieces of the build over to bzlmod (#8542)
bzlmod is the future, and makes it easier to depend on AOS. --------- Signed-off-by: Austin Schuh <austin.linux@gmail.com>
This commit is contained in:
66
shared/bazel/BUILD.bazel
Normal file
66
shared/bazel/BUILD.bazel
Normal file
@@ -0,0 +1,66 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
platform(
|
||||
name = "systemcore",
|
||||
flags = [
|
||||
],
|
||||
parents = [
|
||||
"@rules_bzlmodrio_toolchains//platforms/systemcore",
|
||||
],
|
||||
)
|
||||
|
||||
windows_flags = [
|
||||
"--host_copt=/wd4141",
|
||||
"--host_copt=/wd4715",
|
||||
"--host_per_file_copt=external/.*\\.c$,external/.*\\.cc$@/wd4047,/wd4267,/wd4244,/wd4334,/wd4646,/wd4018,/wd4200,/wd5287",
|
||||
"--per_file_copt=external/.*\\.c$,external/.*\\.cc$@/wd4047,/wd4267,/wd4244,/wd4334,/wd4646,/wd4018,/wd4200,/wd5287",
|
||||
]
|
||||
|
||||
platform(
|
||||
name = "windows_arm64",
|
||||
flags = [
|
||||
"--platform_suffix=winarm64",
|
||||
] + windows_flags,
|
||||
parents = [
|
||||
"@rules_bzlmodrio_toolchains//platforms/windows_arm64",
|
||||
],
|
||||
)
|
||||
|
||||
platform(
|
||||
name = "windows_x86_64",
|
||||
flags = [
|
||||
"--platform_suffix=winx64",
|
||||
] + windows_flags,
|
||||
parents = [
|
||||
"@rules_bzlmodrio_toolchains//platforms/windows_x86_64",
|
||||
],
|
||||
)
|
||||
|
||||
platform(
|
||||
name = "windows_host",
|
||||
flags = [
|
||||
] + windows_flags,
|
||||
parents = [
|
||||
"@platforms//host",
|
||||
],
|
||||
)
|
||||
|
||||
platform(
|
||||
name = "linux_x86_64",
|
||||
flags = [
|
||||
"--per_file_copt=external/.*@-Wno-pedantic,-Wno-format-nonliteral,-Wno-sign-compare,-Wno-type-limits,-Wno-maybe-uninitialized,-Wno-missing-field-initializers,-Wno-trigraphs,-Wno-attributes,-Wno-return-type,-Wno-unused-function,-Wno-format-y2k,-Wno-deprecated-declarations",
|
||||
"--per_file_copt=external/.*\\.cpp$,external/.*\\.cc$@-Wno-missing-requires,-Wno-volatile,-Wno-redundant-move,-Wno-class-memaccess,-Wno-ignored-qualifiers,-Wno-stringop-overflow,-Wno-extra",
|
||||
],
|
||||
parents = [
|
||||
"@rules_bzlmodrio_toolchains//platforms/linux_x86_64",
|
||||
],
|
||||
)
|
||||
|
||||
platform(
|
||||
name = "osx",
|
||||
flags = [
|
||||
],
|
||||
parents = [
|
||||
"@rules_bzlmodrio_toolchains//platforms/osx",
|
||||
],
|
||||
)
|
||||
@@ -29,7 +29,12 @@ build:linux --host_cxxopt=-Wno-missing-requires
|
||||
build:linux --host_cxxopt=-Wno-implicit-fallthrough
|
||||
|
||||
build:linux --host_per_file_copt=external/zlib/.*\.c@-Wno-deprecated-non-prototype
|
||||
build:linux --host_per_file_copt=external/.*@-Wno-pedantic,-Wno-implicit-fallthrough,-Wno-format-nonliteral,-Wno-sign-compare,-Wno-sign-compare,-Wno-type-limits,-Wno-maybe-uninitialized,-Wno-missing-field-initializers,-Wno-trigraphs,-Wno-attributes,-Wno-return-type,-Wno-unused-function,-Wno-format-y2k,-Wno-deprecated-declarations
|
||||
build:linux --host_per_file_copt=external/.*\.cpp$,external/.*\.cc$@-Wno-missing-requires,-Wno-volatile,-Wno-redundant-move,-Wno-class-memaccess,-Wno-ignored-qualifiers,-Wno-stringop-overflow,-Wno-extra
|
||||
|
||||
# Set soname. Needed for robotpy
|
||||
build:linux --features=set_soname
|
||||
build:linux --host_features=set_soname
|
||||
|
||||
build:linux --host_platform=//shared/bazel:linux_x86_64
|
||||
build:linux --platforms=//shared/bazel:linux_x86_64
|
||||
|
||||
@@ -8,3 +8,9 @@ common:macos --repo_env=BAZEL_CXXOPTS="-std=c++20:-pedantic:-fPIC:-Wno-unused-pa
|
||||
common:macos --repo_env=BAZEL_CONLYOPTS="-pedantic:-fPIC:-Wno-unused-parameter:-Wno-missing-field-initializers:-Wno-unused-private-field:-Wno-fixed-enum-extension"
|
||||
|
||||
common:macos --repo_env=BAZEL_LINKOPTS="-Wl,-rpath,'@loader_path'"
|
||||
|
||||
common:macos --host_per_file_copt=external/.*@-Wno-pedantic,-Wno-deprecated-declarations
|
||||
common:macos --per_file_copt=external/.*@-Wno-pedantic,-Wno-deprecated-declarations
|
||||
|
||||
common:macos --host_per_file_copt=external/.*\.c$@-Wno-c11-extensions
|
||||
common:macos --per_file_copt=external/.*\.c$@-Wno-c11-extensions
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
###############################
|
||||
# Systemcore
|
||||
###############################
|
||||
build:systemcore --platforms=@rules_bzlmodrio_toolchains//platforms/systemcore
|
||||
build:systemcore --platforms=//shared/bazel:systemcore
|
||||
build:systemcore --build_tag_filters=-no-systemcore
|
||||
build:systemcore --platform_suffix=systemcore
|
||||
|
||||
@@ -21,7 +21,7 @@ build:windows --repo_env="BAZEL_LINKOPTS=/DEPENDENTLOADFLAG%:0x1100"
|
||||
################################
|
||||
# ARM Windows Flags
|
||||
################################
|
||||
build:windows_arm --platforms="@rules_bzlmodrio_toolchains//platforms/windows_arm64" --platform_suffix=winarm64
|
||||
build:windows_arm --platforms="@allwpilib//shared/bazel:windows_arm64" --platform_suffix=winarm64
|
||||
|
||||
# Ignore duplicate inline statment in tools
|
||||
build:windows --host_copt=/wd4141
|
||||
@@ -30,3 +30,4 @@ build:windows --host_copt=/wd4715
|
||||
|
||||
# Disable the C++17 feature in the windows compiler
|
||||
build:windows --features=-default_cpp_std --host_features=-default_cpp_std
|
||||
build:windows --host_platform=//shared/bazel:windows_host
|
||||
|
||||
@@ -71,10 +71,10 @@ publish_all = rule(
|
||||
)
|
||||
|
||||
host_architectures = {
|
||||
"@rules_bzlmodrio_toolchains//platforms/linux_x86_64": "linux-x86-64",
|
||||
"@rules_bzlmodrio_toolchains//platforms/osx": "osxuniversal",
|
||||
"@rules_bzlmodrio_toolchains//platforms/windows_arm64": "windows-arm64",
|
||||
"@rules_bzlmodrio_toolchains//platforms/windows_x86_64": "windows-x86-64",
|
||||
"@allwpilib//shared/bazel:linux_x86_64": "linux-x86-64",
|
||||
"@allwpilib//shared/bazel:osx": "osxuniversal",
|
||||
"@allwpilib//shared/bazel:windows_arm64": "windows-arm64",
|
||||
"@allwpilib//shared/bazel:windows_x86_64": "windows-x86-64",
|
||||
}
|
||||
|
||||
# Unfortunately, rules_jvm_external really wants each of the classifier
|
||||
@@ -87,11 +87,11 @@ def architectures_pkg_zip(
|
||||
**kwargs):
|
||||
if architectures == None:
|
||||
architectures = {
|
||||
"@rules_bzlmodrio_toolchains//platforms/linux_x86_64": "linux-x86-64",
|
||||
"@rules_bzlmodrio_toolchains//platforms/osx": "osxuniversal",
|
||||
"@rules_bzlmodrio_toolchains//platforms/systemcore": "systemcore",
|
||||
"@rules_bzlmodrio_toolchains//platforms/windows_arm64": "windows-arm64",
|
||||
"@rules_bzlmodrio_toolchains//platforms/windows_x86_64": "windows-x86-64",
|
||||
"@allwpilib//shared/bazel:linux_x86_64": "linux-x86-64",
|
||||
"@allwpilib//shared/bazel:osx": "osxuniversal",
|
||||
"@allwpilib//shared/bazel:systemcore": "systemcore",
|
||||
"@allwpilib//shared/bazel:windows_arm64": "windows-arm64",
|
||||
"@allwpilib//shared/bazel:windows_x86_64": "windows-x86-64",
|
||||
}
|
||||
|
||||
architectures_target_compatible_with = {
|
||||
|
||||
Reference in New Issue
Block a user