[bazel] Build and test wpical with bazel (#8155)

This pulls down the prebuilt ceres libraries and uses them with Bazel to
build and test wpical.

Do note that bazel looks up artifacts used for testing differently than
the other build systems.  It wants you to use its runfiles API to find
the dependencies reliably.  Add a function to look up the paths for
files, and use runfiles only when building with Bazel to maintain
compatibility with other languages.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
This commit is contained in:
Austin Schuh
2025-08-06 21:56:42 -07:00
committed by GitHub
parent c01f0c3d46
commit 6eba91bc04
12 changed files with 427 additions and 25 deletions

View File

@@ -189,6 +189,7 @@ def third_party_cc_lib_helper(
include_root,
src_root = None,
src_excludes = [],
defines = [],
visibility = None):
"""
Helper for src / headers pairs that aren't directly compiled, but rather pulled into a bigger library.
@@ -212,6 +213,7 @@ def third_party_cc_lib_helper(
include_root + "/**",
]),
includes = [include_root],
defines = defines,
strip_include_prefix = include_root,
visibility = visibility,
)
@@ -292,6 +294,7 @@ def wpilib_cc_library(
srcs = srcs + [lib + "-srcs" for lib in third_party_libraries],
deps = deps + [lib + "-headers" for lib in third_party_libraries + third_party_header_only_libraries],
strip_include_prefix = strip_include_prefix,
linkopts = linkopts,
**kwargs
)

View File

@@ -353,6 +353,7 @@ def package_binary_cc_project(
name,
maven_group_id,
maven_artifact_name,
extra_files = [],
architectures = None,
renames = None):
"""Packages the C++ binary targets for a project.
@@ -374,7 +375,7 @@ def package_binary_cc_project(
srcs = [
":{}-files".format(name),
"//:license_pkg_files",
],
] + extra_files,
architectures = architectures,
)