Skip to content

Commit

Permalink
Update toolchain version to allow building with systemcore (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjreiniger authored Jan 16, 2025
1 parent 4eb6a3e commit 810747d
Show file tree
Hide file tree
Showing 12 changed files with 262 additions and 43 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
72 changes: 72 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 Expand Up @@ -119,3 +155,39 @@ jobs:
- name: Build
run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=ci
working-directory: tests

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

# Build bzlmod, linuxarm64
- { name: "windows - bzlmod linuxarm64", os: windows-2022, java_arch: "x64", command: "build", config: "--enable_bzlmod --config=linuxarm64", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bzlmod linuxarm64", os: ubuntu-22.04, java_arch: "x64", command: "build", config: "--enable_bzlmod --config=linuxarm64", bazel_options: "", }
- { name: "macos - bzlmod linuxarm64", os: macos-14, java_arch: "aarch64", command: "build", config: "--enable_bzlmod --config=linuxarm64", 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
4 changes: 2 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module(
name = "bzlmodrio-opencv",
version = "2025.4.10.0-3",
version = "2025.4.10.0-3.bcr1",
compatibility_level = 2025,
)

bazel_dep(name = "platforms", version = "0.0.9")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_java", version = "7.6.5")
bazel_dep(name = "rules_bzlmodrio_toolchains", version = "2025-1.bcr1")
bazel_dep(name = "rules_bzlmodrio_toolchains", version = "2025-1.bcr2")

setup_bzlmodrio_opencv_cpp_dependencies = use_extension("//:maven_cpp_deps.bzl", "setup_bzlmodrio_opencv_cpp_dependencies")
use_repo(
Expand Down
5 changes: 2 additions & 3 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions private/cpp/opencv/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ filegroup(
"@rules_bzlmodrio_toolchains//constraints/is_raspibookworm32:raspibookworm32_debug": ["@bazelrio_edu_wpi_first_thirdparty_frc_opencv_opencv-cpp_linuxarm32debug//:shared"],
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@bazelrio_edu_wpi_first_thirdparty_frc_opencv_opencv-cpp_linuxathena//:shared"],
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio_debug": ["@bazelrio_edu_wpi_first_thirdparty_frc_opencv_opencv-cpp_linuxathenadebug//:shared"],
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@bazelrio_edu_wpi_first_thirdparty_frc_opencv_opencv-cpp_linuxsystemcore//:shared"],
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore_debug": ["@bazelrio_edu_wpi_first_thirdparty_frc_opencv_opencv-cpp_linuxsystemcoredebug//:shared"],
"//conditions:default": [],
}),
visibility = ["@bzlmodrio-opencv//:__subpackages__"],
Expand Down Expand Up @@ -72,6 +74,8 @@ cc_library(
"@rules_bzlmodrio_toolchains//constraints/is_raspibookworm32:raspibookworm32_debug": ["@bazelrio_edu_wpi_first_thirdparty_frc_opencv_opencv-cpp_linuxarm32staticdebug//:static_libs"],
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@bazelrio_edu_wpi_first_thirdparty_frc_opencv_opencv-cpp_linuxathenastatic//:static_libs"],
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio_debug": ["@bazelrio_edu_wpi_first_thirdparty_frc_opencv_opencv-cpp_linuxathenastaticdebug//:static_libs"],
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@bazelrio_edu_wpi_first_thirdparty_frc_opencv_opencv-cpp_linuxsystemcorestatic//:static_libs"],
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore_debug": ["@bazelrio_edu_wpi_first_thirdparty_frc_opencv_opencv-cpp_linuxsystemcorestaticdebug//:static_libs"],
}),
)

Expand All @@ -92,6 +96,8 @@ cc_library(
"@rules_bzlmodrio_toolchains//constraints/is_raspibookworm32:raspibookworm32_debug": ["@bazelrio_edu_wpi_first_thirdparty_frc_opencv_opencv-cpp_linuxarm32debug//:jni"],
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@bazelrio_edu_wpi_first_thirdparty_frc_opencv_opencv-cpp_linuxathena//:jni"],
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio_debug": ["@bazelrio_edu_wpi_first_thirdparty_frc_opencv_opencv-cpp_linuxathenadebug//:jni"],
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@bazelrio_edu_wpi_first_thirdparty_frc_opencv_opencv-cpp_linuxsystemcore//:jni"],
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore_debug": ["@bazelrio_edu_wpi_first_thirdparty_frc_opencv_opencv-cpp_linuxsystemcoredebug//:jni"],
}),
linkstatic = 1,
visibility = ["@bzlmodrio-opencv//:__subpackages__"],
Expand Down
4 changes: 2 additions & 2 deletions private/non_bzlmod_dependencies/download_dependencies.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def download_dependencies():
# Roborio Toolchain
http_archive(
name = "rules_bzlmodrio_toolchains",
sha256 = "559ff5ddc402dca6266a765770c3a65db23e2060c45355c57612737bcc592b78",
url = "https://github.com/wpilibsuite/rules_bzlmodRio_toolchains/releases/download/2025-1.bcr1/rules_bzlmodRio_toolchains-2025-1.bcr1.tar.gz",
sha256 = "ff25b5f9445cbd43759be4c6582b987d1065cf817c593eedc7ada1a699298c84",
url = "https://github.com/wpilibsuite/rules_bzlmodRio_toolchains/releases/download/2025-1.bcr2/rules_bzlmodRio_toolchains-2025-1.bcr2.tar.gz",
)

########################
Expand Down
9 changes: 6 additions & 3 deletions private/non_bzlmod_dependencies/setup_dependencies.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ def _setup_toolchains():
"@local_roborio//:macos",
"@local_roborio//:linux",
"@local_roborio//:windows",
"@local_raspi_bookworm_32//:macos",
"@local_raspi_bookworm_32//:linux",
"@local_raspi_bookworm_32//:windows",
"@local_systemcore//:macos",
"@local_systemcore//:linux",
"@local_systemcore//:windows",
"@local_raspi_bullseye_32//:macos",
"@local_raspi_bullseye_32//:linux",
"@local_raspi_bullseye_32//:windows",
"@local_raspi_bookworm_32//:macos",
"@local_raspi_bookworm_32//:linux",
"@local_raspi_bookworm_32//:windows",
Expand Down
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
Loading

0 comments on commit 810747d

Please sign in to comment.