Skip to content

Commit

Permalink
Add system core compiler option (#21)
Browse files Browse the repository at this point in the history
* Try to get systemcore up

* Fixup

* Add build

* Bump version
  • Loading branch information
pjreiniger authored Jan 15, 2025
1 parent 3eca977 commit 5e15090
Show file tree
Hide file tree
Showing 13 changed files with 225 additions and 31 deletions.
24 changes: 14 additions & 10 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,48 @@ import .bazelrc-buildbuddy
build --test_env=LD_LIBRARY_PATH=.
build --test_env=DYLD_LIBRARY_PATH=.

# Roborio
# roborio
build:roborio --platforms=@rules_bzlmodrio_toolchains//platforms/roborio
build:roborio --build_tag_filters=-no-roborio
build:roborio --platform_suffix=roborio

# systemcore
build:systemcore --platforms=@rules_bzlmodrio_toolchains//platforms/systemcore
build:systemcore --build_tag_filters=-no-systemcore
build:systemcore --platform_suffix=systemcore

# bullseye32
build:bullseye32 --platforms=@rules_bzlmodrio_toolchains//platforms/bullseye32
build:bullseye32 --build_tag_filters=-no-bullseye
build:bullseye32 --build_tag_filters=-no-bullseye32
build:bullseye32 --platform_suffix=bullseye32

# bullseye64
build:bullseye64 --platforms=@rules_bzlmodrio_toolchains//platforms/bullseye64
build:bullseye64 --build_tag_filters=-no-bullseye
build:bullseye64 --build_tag_filters=-no-bullseye64
build:bullseye64 --platform_suffix=bullseye64

# bookworm32
build:bookworm32 --platforms=@rules_bzlmodrio_toolchains//platforms/bookworm32
build:bookworm32 --build_tag_filters=-no-bookworm
build:bookworm32 --build_tag_filters=-no-bookworm32
build:bookworm32 --platform_suffix=bookworm32

# bookworm64
build:bookworm64 --platforms=@rules_bzlmodrio_toolchains//platforms/bookworm64
build:bookworm64 --build_tag_filters=-no-bookworm
build:bookworm64 --build_tag_filters=-no-bookworm64
build:bookworm64 --platform_suffix=bookworm64

# rasppi bullseye
# raspibullseye32
build:raspibullseye32 --platforms=@rules_bzlmodrio_toolchains//platforms/raspibullseye32
build:raspibullseye32 --build_tag_filters=-no-raspi
build:raspibullseye32 --build_tag_filters=-no-raspibullseye32
build:raspibullseye32 --platform_suffix=raspibullseye32

# rasppi bookworm
# raspibookworm32
build:raspibookworm32 --platforms=@rules_bzlmodrio_toolchains//platforms/raspibookworm32
build:raspibookworm32 --build_tag_filters=-no-raspi
build:raspibookworm32 --build_tag_filters=-no-raspibookworm32
build:raspibookworm32 --platform_suffix=raspibookworm32

# Alias toolchain names to what wpilibsuite uses for CI/Artifact naming
build:athena --config=roborio
build:systemcore --config=bookworm64
build:linuxarm32 --config=raspibookworm32
build:linuxarm64 --config=bookworm64

Expand Down
11 changes: 8 additions & 3 deletions .bazelrc-cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,16 @@ build:macos --cxxopt=-Wno-error=deprecated-anon-enum-enum-conversion
build:macos --cxxopt=-Wno-error=inconsistent-missing-override
build:macos --cxxopt=-Wno-error=overloaded-virtual

# Roborio
# roborio
build:roborio --incompatible_enable_cc_toolchain_resolution
build:roborio --copt=-std=c++20
build:roborio --features=compiler_param_file

# systemcore
build:systemcore --incompatible_enable_cc_toolchain_resolution
build:systemcore --copt=-std=c++20
build:systemcore --features=compiler_param_file

# bullseye32
build:bullseye32 --incompatible_enable_cc_toolchain_resolution
build:bullseye32 --copt=-std=c++20
Expand All @@ -65,12 +70,12 @@ build:bookworm64 --incompatible_enable_cc_toolchain_resolution
build:bookworm64 --copt=-std=c++20
build:bookworm64 --features=compiler_param_file

# rasppi bullseye
# raspibullseye32
build:raspibullseye32 --incompatible_enable_cc_toolchain_resolution
build:raspibullseye32 --copt=-std=c++20
build:raspibullseye32 --features=compiler_param_file

# rasppi bookworm
# raspibookworm32
build:raspibookworm32 --incompatible_enable_cc_toolchain_resolution
build:raspibookworm32 --copt=-std=c++20
build:raspibookworm32 --features=compiler_param_file
38 changes: 37 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- { name: "macos - roborio", os: macos-14, java_arch: "aarch64", command: "build", config: "--noenable_bzlmod --config=roborio", bazel_options: "", }

# Build bzlmod, roborio
# - { name: "windows - bzlmod roborio", os: windows-2022, java_arch: "x64", command: "build", config: "--enable_bzlmod --config=roborio", bazel_options: "--output_user_root=C:\\bazelroot", }
# - { name: "windows - bzlmod roborio", os: windows-2022, java_arch: "x64", command: "build", config: "--enable_bzlmod --config=roborio", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bzlmod roborio", os: ubuntu-22.04, java_arch: "x64", command: "build", config: "--enable_bzlmod --config=roborio", bazel_options: "", }
- { name: "macos - bzlmod roborio", os: macos-14, java_arch: "aarch64", command: "build", config: "--enable_bzlmod --config=roborio", bazel_options: "", }
name: "Build - ${{ matrix.name }}"
Expand All @@ -84,6 +84,42 @@ jobs:
run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=ci
working-directory: tests

build_systemcore:
strategy:
fail-fast: false
matrix:
include:
# Build non-bzlmod, systemcore
- { name: "windows - systemcore", os: windows-2022, java_arch: "x64", command: "build", config: "--noenable_bzlmod --config=systemcore", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - systemcore", os: ubuntu-22.04, java_arch: "x64", command: "build", config: "--noenable_bzlmod --config=systemcore", bazel_options: "", }
- { name: "macos - systemcore", os: macos-14, java_arch: "aarch64", command: "build", config: "--noenable_bzlmod --config=systemcore", bazel_options: "", }

# Build bzlmod, systemcore
- { name: "windows - bzlmod systemcore", os: windows-2022, java_arch: "x64", command: "build", config: "--enable_bzlmod --config=systemcore", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bzlmod systemcore", os: ubuntu-22.04, java_arch: "x64", command: "build", config: "--enable_bzlmod --config=systemcore", bazel_options: "", }
- { name: "macos - bzlmod systemcore", os: macos-14, java_arch: "aarch64", command: "build", config: "--enable_bzlmod --config=systemcore", bazel_options: "", }
name: "Build - ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with: { python-version: '3.11' }
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
architecture: ${{ matrix.java_arch }}
- id: setup_build_buddy
uses: ./.github/actions/setup-build-buddy
with:
token: ${{ secrets.BUILDBUDDY_API_KEY }}
- name: Build and allow failure # TODO Sometimes symlinks don't get created correctly the first time around
run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=ci || true
working-directory: tests
- name: Build
run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=ci
working-directory: tests

build_linuxarm32:
strategy:
fail-fast: false
Expand Down
11 changes: 9 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module(
name = "rules_bzlmodrio_toolchains",
version = "2025-1.bcr1",
version = "2025-1.bcr2",
compatibility_level = 2025,
)

Expand Down Expand Up @@ -39,10 +39,14 @@ use_repo(
"bazelrio_roborio_toolchain_macos",
"bazelrio_roborio_toolchain_macosarm",
"bazelrio_roborio_toolchain_windows",
"bazelrio_systemcore_toolchain_linux",
"bazelrio_systemcore_toolchain_macos",
"bazelrio_systemcore_toolchain_macosarm",
"bazelrio_systemcore_toolchain_windows",
)

sh_configure = use_extension("@rules_bzlmodrio_toolchains//:extensions.bzl", "sh_configure")
use_repo(sh_configure, "local_bookworm_32", "local_bookworm_64", "local_bullseye_32", "local_bullseye_64", "local_raspi_bookworm_32", "local_raspi_bullseye_32", "local_roborio")
use_repo(sh_configure, "local_bookworm_32", "local_bookworm_64", "local_bullseye_32", "local_bullseye_64", "local_raspi_bookworm_32", "local_raspi_bullseye_32", "local_roborio", "local_systemcore")

register_toolchains(
"@local_bookworm_32//:macos",
Expand All @@ -66,4 +70,7 @@ register_toolchains(
"@local_roborio//:macos",
"@local_roborio//:linux",
"@local_roborio//:windows",
"@local_systemcore//:macos",
"@local_systemcore//:linux",
"@local_systemcore//:windows",
)
3 changes: 3 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ register_toolchains(
"@local_roborio//:macos",
"@local_roborio//:linux",
"@local_roborio//:windows",
"@local_systemcore//:macos",
"@local_systemcore//:linux",
"@local_systemcore//:windows",
)

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
Expand Down
30 changes: 30 additions & 0 deletions constraints/is_systemcore/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
constraint_setting(
name = "is_systemcore",
default_constraint_value = ":false",
)

constraint_value(
name = "true",
constraint_setting = ":is_systemcore",
visibility = ["//visibility:public"],
)

constraint_value(
name = "false",
constraint_setting = ":is_systemcore",
)

config_setting(
name = "systemcore",
constraint_values = [":true"],
visibility = ["//visibility:public"],
)

config_setting(
name = "systemcore_debug",
constraint_values = [":true"],
values = {
"compilation_mode": "dbg",
},
visibility = ["//visibility:public"],
)
30 changes: 30 additions & 0 deletions maven_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,36 @@ def __setup_toolchains_dependencies(mctx):
build_file_content = filegroup_all,
)

# systemcore
maybe(
http_archive,
"bazelrio_systemcore_toolchain_macosarm",
url = "https://github.com/wpilibsuite/opensdk/releases/download/v2025-1/arm64-bookworm-2025-arm64-apple-darwin-Toolchain-12.2.0.tgz",
sha256 = "e29fa2433cee667d75ff106543d88d3d4154e2f450c79d86d316d5b8015d11e4",
build_file_content = filegroup_all,
)
maybe(
http_archive,
"bazelrio_systemcore_toolchain_macos",
url = "https://github.com/wpilibsuite/opensdk/releases/download/v2025-1/arm64-bookworm-2025-x86_64-apple-darwin-Toolchain-12.2.0.tgz",
sha256 = "34af7c9b601bbce1fe5c5e07f70fe8abd7ed3985cc603dbc12ef7f3d8c2f0b9d",
build_file_content = filegroup_all,
)
maybe(
http_archive,
"bazelrio_systemcore_toolchain_linux",
url = "https://github.com/wpilibsuite/opensdk/releases/download/v2025-1/arm64-bookworm-2025-x86_64-linux-gnu-Toolchain-12.2.0.tgz",
sha256 = "d94005ae516bb43fc85a07ed89cb51bec96ed931ca5c084427f1432a1dbf71e9",
build_file_content = filegroup_all,
)
maybe(
http_archive,
"bazelrio_systemcore_toolchain_windows",
url = "https://github.com/wpilibsuite/opensdk/releases/download/v2025-1/arm64-bookworm-2025-x86_64-w64-mingw32-Toolchain-12.2.0.zip",
sha256 = "50f26a9b0ae595bd536f5b7003a465b04871005cbe57c18e84f657e83df13f4c",
build_file_content = filegroup_all,
)

def setup_legacy_setup_toolchains_dependencies():
__setup_toolchains_dependencies(None)

Expand Down
8 changes: 8 additions & 0 deletions platforms/systemcore/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
platform(
name = "systemcore",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:armv7",
"//constraints/is_systemcore:true",
],
)
24 changes: 14 additions & 10 deletions tests/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,48 @@ import .bazelrc-buildbuddy
build --test_env=LD_LIBRARY_PATH=.
build --test_env=DYLD_LIBRARY_PATH=.

# Roborio
# roborio
build:roborio --platforms=@rules_bzlmodrio_toolchains//platforms/roborio
build:roborio --build_tag_filters=-no-roborio
build:roborio --platform_suffix=roborio

# systemcore
build:systemcore --platforms=@rules_bzlmodrio_toolchains//platforms/systemcore
build:systemcore --build_tag_filters=-no-systemcore
build:systemcore --platform_suffix=systemcore

# bullseye32
build:bullseye32 --platforms=@rules_bzlmodrio_toolchains//platforms/bullseye32
build:bullseye32 --build_tag_filters=-no-bullseye
build:bullseye32 --build_tag_filters=-no-bullseye32
build:bullseye32 --platform_suffix=bullseye32

# bullseye64
build:bullseye64 --platforms=@rules_bzlmodrio_toolchains//platforms/bullseye64
build:bullseye64 --build_tag_filters=-no-bullseye
build:bullseye64 --build_tag_filters=-no-bullseye64
build:bullseye64 --platform_suffix=bullseye64

# bookworm32
build:bookworm32 --platforms=@rules_bzlmodrio_toolchains//platforms/bookworm32
build:bookworm32 --build_tag_filters=-no-bookworm
build:bookworm32 --build_tag_filters=-no-bookworm32
build:bookworm32 --platform_suffix=bookworm32

# bookworm64
build:bookworm64 --platforms=@rules_bzlmodrio_toolchains//platforms/bookworm64
build:bookworm64 --build_tag_filters=-no-bookworm
build:bookworm64 --build_tag_filters=-no-bookworm64
build:bookworm64 --platform_suffix=bookworm64

# rasppi bullseye
# raspibullseye32
build:raspibullseye32 --platforms=@rules_bzlmodrio_toolchains//platforms/raspibullseye32
build:raspibullseye32 --build_tag_filters=-no-raspi
build:raspibullseye32 --build_tag_filters=-no-raspibullseye32
build:raspibullseye32 --platform_suffix=raspibullseye32

# rasppi bookworm
# raspibookworm32
build:raspibookworm32 --platforms=@rules_bzlmodrio_toolchains//platforms/raspibookworm32
build:raspibookworm32 --build_tag_filters=-no-raspi
build:raspibookworm32 --build_tag_filters=-no-raspibookworm32
build:raspibookworm32 --platform_suffix=raspibookworm32

# Alias toolchain names to what wpilibsuite uses for CI/Artifact naming
build:athena --config=roborio
build:systemcore --config=bookworm64
build:linuxarm32 --config=raspibookworm32
build:linuxarm64 --config=bookworm64

Expand Down
11 changes: 8 additions & 3 deletions tests/.bazelrc-cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,16 @@ build:macos --cxxopt=-Wno-error=deprecated-anon-enum-enum-conversion
build:macos --cxxopt=-Wno-error=inconsistent-missing-override
build:macos --cxxopt=-Wno-error=overloaded-virtual

# Roborio
# roborio
build:roborio --incompatible_enable_cc_toolchain_resolution
build:roborio --copt=-std=c++20
build:roborio --features=compiler_param_file

# systemcore
build:systemcore --incompatible_enable_cc_toolchain_resolution
build:systemcore --copt=-std=c++20
build:systemcore --features=compiler_param_file

# bullseye32
build:bullseye32 --incompatible_enable_cc_toolchain_resolution
build:bullseye32 --copt=-std=c++20
Expand All @@ -65,12 +70,12 @@ build:bookworm64 --incompatible_enable_cc_toolchain_resolution
build:bookworm64 --copt=-std=c++20
build:bookworm64 --features=compiler_param_file

# rasppi bullseye
# raspibullseye32
build:raspibullseye32 --incompatible_enable_cc_toolchain_resolution
build:raspibullseye32 --copt=-std=c++20
build:raspibullseye32 --features=compiler_param_file

# rasppi bookworm
# raspibookworm32
build:raspibookworm32 --incompatible_enable_cc_toolchain_resolution
build:raspibookworm32 --copt=-std=c++20
build:raspibookworm32 --features=compiler_param_file
Loading

0 comments on commit 5e15090

Please sign in to comment.