mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[bazel] MVP for building wpilibc + commands framework (#7231)
This commit is contained in:
27
WORKSPACE
27
WORKSPACE
@@ -35,8 +35,8 @@ maven_install(
|
||||
# Download toolchains
|
||||
http_archive(
|
||||
name = "rules_bzlmodrio_toolchains",
|
||||
sha256 = "2ef1cafce7f4fd4e909bb5de8b0dc771a934646afd55d5f100ff31f6b500df98",
|
||||
url = "https://github.com/wpilibsuite/rules_bzlmodRio_toolchains/releases/download/2024-1.bcr1/rules_bzlmodRio_toolchains-2024-1.bcr1.tar.gz",
|
||||
sha256 = "fe267e2af53c1def1e962700a9aeda9e8fdfa9fb46b72167c615ec0e25447dd6",
|
||||
url = "https://github.com/wpilibsuite/rules_bzlmodRio_toolchains/releases/download/2025-1/rules_bzlmodRio_toolchains-2025-1.tar.gz",
|
||||
)
|
||||
|
||||
load("@rules_bzlmodrio_toolchains//:maven_deps.bzl", "setup_legacy_setup_toolchains_dependencies")
|
||||
@@ -71,6 +71,12 @@ register_toolchains(
|
||||
"@local_bullseye_64//:macos",
|
||||
"@local_bullseye_64//:linux",
|
||||
"@local_bullseye_64//:windows",
|
||||
"@local_bookworm_32//:macos",
|
||||
"@local_bookworm_32//:linux",
|
||||
"@local_bookworm_32//:windows",
|
||||
"@local_bookworm_64//:macos",
|
||||
"@local_bookworm_64//:linux",
|
||||
"@local_bookworm_64//:windows",
|
||||
)
|
||||
|
||||
setup_legacy_setup_jdk_dependencies()
|
||||
@@ -87,8 +93,8 @@ setup_legacy_bzlmodrio_ni_cpp_dependencies()
|
||||
|
||||
http_archive(
|
||||
name = "bzlmodrio-opencv",
|
||||
sha256 = "5314cce05b49451a46bf3e3140fc401342e53d5f3357612ed4473e59bb616cba",
|
||||
url = "https://github.com/wpilibsuite/bzlmodRio-opencv/releases/download/2024.4.8.0-4.bcr1/bzlmodRio-opencv-2024.4.8.0-4.bcr1.tar.gz",
|
||||
sha256 = "4f4a607956ca8555618736c3058dd96e09d02df19e95088c1e352d2319fd70c7",
|
||||
url = "https://github.com/wpilibsuite/bzlmodRio-opencv/releases/download/2025.4.10.0-2/bzlmodRio-opencv-2025.4.10.0-2.tar.gz",
|
||||
)
|
||||
|
||||
load("@bzlmodrio-opencv//:maven_cpp_deps.bzl", "setup_legacy_bzlmodrio_opencv_cpp_dependencies")
|
||||
@@ -98,3 +104,16 @@ setup_legacy_bzlmodrio_opencv_cpp_dependencies()
|
||||
load("@bzlmodrio-opencv//:maven_java_deps.bzl", "setup_legacy_bzlmodrio_opencv_java_dependencies")
|
||||
|
||||
setup_legacy_bzlmodrio_opencv_java_dependencies()
|
||||
|
||||
http_archive(
|
||||
name = "build_bazel_apple_support",
|
||||
sha256 = "c4bb2b7367c484382300aee75be598b92f847896fb31bbd22f3a2346adf66a80",
|
||||
url = "https://github.com/bazelbuild/apple_support/releases/download/1.15.1/apple_support.1.15.1.tar.gz",
|
||||
)
|
||||
|
||||
load(
|
||||
"@build_bazel_apple_support//lib:repositories.bzl",
|
||||
"apple_support_dependencies",
|
||||
)
|
||||
|
||||
apple_support_dependencies()
|
||||
|
||||
112
apriltag/BUILD.bazel
Normal file
112
apriltag/BUILD.bazel
Normal file
@@ -0,0 +1,112 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary", "java_library")
|
||||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
load("//shared/bazel/rules/gen:gen-resources.bzl", "generate_resources")
|
||||
|
||||
cc_library(
|
||||
name = "thirdparty-apriltag",
|
||||
srcs = glob(["src/main/native/thirdparty/apriltag/src/**"]),
|
||||
hdrs = glob(["src/main/native/thirdparty/apriltag/include/**"]),
|
||||
copts = select({
|
||||
"@bazel_tools//src/conditions:darwin": [
|
||||
"-Wno-format-nonliteral",
|
||||
"-Wno-gnu-zero-variadic-macro-arguments",
|
||||
"-Wno-uninitialized",
|
||||
"-Wno-sign-compare",
|
||||
"-Wno-type-limits",
|
||||
],
|
||||
"@bazel_tools//src/conditions:windows": [
|
||||
"/wd4005",
|
||||
"/wd4018",
|
||||
"/wd4244",
|
||||
"/wd4267",
|
||||
"/wd4996",
|
||||
],
|
||||
"@rules_bzlmodrio_toolchains//constraints/combined:is_linux": [
|
||||
"-Wno-format-nonliteral",
|
||||
"-Wno-maybe-uninitialized",
|
||||
"-Wno-sign-compare",
|
||||
"-Wno-type-limits",
|
||||
],
|
||||
}),
|
||||
includes = ["src/main/native/thirdparty/apriltag/include/common"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/apriltag/include",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
generate_resources(
|
||||
name = "generate-resources",
|
||||
namespace = "frc",
|
||||
prefix = "APRILTAG",
|
||||
resource_files = glob(["src/main/native/resources/**"]),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "apriltag.static",
|
||||
srcs = [":generate-resources"] + glob(
|
||||
["src/main/native/cpp/**"],
|
||||
exclude = ["src/main/native/cpp/jni/**"],
|
||||
),
|
||||
hdrs = glob(["src/main/native/include/**/*"]),
|
||||
defines = ["WPILIB_EXPORTS"],
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":thirdparty-apriltag",
|
||||
"//wpimath:wpimath.static",
|
||||
"//wpiutil:wpiutil.static",
|
||||
],
|
||||
)
|
||||
|
||||
java_library(
|
||||
name = "apriltag-java",
|
||||
srcs = glob(["src/main/java/**/*.java"]),
|
||||
resource_strip_prefix = "apriltag/src/main/native/resources",
|
||||
resources = glob(["src/main/native/resources/**"]),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//wpimath:wpimath-java",
|
||||
"//wpiutil:wpiutil-java",
|
||||
"@bzlmodrio-opencv//libraries/java/opencv",
|
||||
"@maven//:com_fasterxml_jackson_core_jackson_annotations",
|
||||
"@maven//:com_fasterxml_jackson_core_jackson_core",
|
||||
"@maven//:com_fasterxml_jackson_core_jackson_databind",
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "apriltag-cpp-test",
|
||||
size = "small",
|
||||
srcs = glob(["src/test/native/cpp/**"]),
|
||||
tags = [
|
||||
"no-asan",
|
||||
],
|
||||
deps = [
|
||||
":apriltag.static",
|
||||
"//thirdparty/googletest:googletest.static",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "DevMain-Cpp",
|
||||
srcs = ["src/dev/native/cpp/main.cpp"],
|
||||
deps = [
|
||||
":apriltag.static",
|
||||
],
|
||||
)
|
||||
|
||||
java_binary(
|
||||
name = "DevMain-Java",
|
||||
srcs = ["src/dev/java/edu/wpi/first/apriltag/DevMain.java"],
|
||||
main_class = "edu.wpi.first.apriltag.DevMain",
|
||||
deps = [
|
||||
":apriltag-java",
|
||||
],
|
||||
)
|
||||
|
||||
py_binary(
|
||||
name = "convert_apriltag_layouts",
|
||||
srcs = ["convert_apriltag_layouts.py"],
|
||||
tags = ["manual"],
|
||||
)
|
||||
@@ -1,6 +1,22 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary", "java_library")
|
||||
|
||||
cc_library(
|
||||
name = "cameraserver.static",
|
||||
srcs = glob(["src/main/native/cpp/**"]),
|
||||
hdrs = glob(["src/main/native/include/**/*"]),
|
||||
includes = [
|
||||
"cpp",
|
||||
"src/main/native/include",
|
||||
],
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//cscore:cscore.static",
|
||||
"//ntcore:ntcore.static",
|
||||
],
|
||||
)
|
||||
|
||||
java_library(
|
||||
name = "cameraserver-java",
|
||||
srcs = glob(["src/main/java/**/*.java"]),
|
||||
@@ -16,10 +32,21 @@ java_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "cameraserver-cpp-test",
|
||||
size = "small",
|
||||
srcs = glob(["src/test/native/**"]),
|
||||
deps = [
|
||||
":cameraserver.static",
|
||||
"//thirdparty/googletest:googletest.static",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "DevMain-Cpp",
|
||||
srcs = ["src/dev/native/cpp/main.cpp"],
|
||||
deps = [
|
||||
":cameraserver.static",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -1,5 +1,76 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test", "objc_library")
|
||||
load("@rules_java//java:defs.bzl", "java_binary", "java_library")
|
||||
|
||||
WIN_SRCS = glob([
|
||||
"src/main/native/windows/**/*.cpp",
|
||||
"src/main/native/windows/**/*.h",
|
||||
])
|
||||
|
||||
LINUX_SRCS = glob([
|
||||
"src/main/native/linux/**/*.cpp",
|
||||
"src/main/native/linux/**/*.h",
|
||||
])
|
||||
|
||||
MAC_SRCS = glob(["src/main/native/osx/**/*.cpp"])
|
||||
|
||||
filegroup(
|
||||
name = "native-srcs",
|
||||
srcs = select({
|
||||
"@bazel_tools//src/conditions:darwin": MAC_SRCS,
|
||||
"@bazel_tools//src/conditions:windows": WIN_SRCS,
|
||||
"@rules_bzlmodrio_toolchains//constraints/combined:is_linux": LINUX_SRCS,
|
||||
}),
|
||||
)
|
||||
|
||||
objc_library(
|
||||
name = "cscore-mac",
|
||||
srcs = glob([
|
||||
"src/main/native/objcpp/**/*.mm",
|
||||
"src/main/native/cpp/*.h",
|
||||
]),
|
||||
hdrs = glob([
|
||||
"src/main/native/include/**/*",
|
||||
"src/main/native/objcpp/**/*.h",
|
||||
]),
|
||||
copts = [
|
||||
"-std=c++20",
|
||||
],
|
||||
includes = [
|
||||
"src/main/native/cpp",
|
||||
"src/main/native/include",
|
||||
"src/main/native/objcpp",
|
||||
],
|
||||
tags = ["manual"],
|
||||
deps = [
|
||||
"//wpinet:wpinet.static",
|
||||
"//wpiutil:wpiutil.static",
|
||||
"@bzlmodrio-opencv//libraries/cpp/opencv",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "cscore.static",
|
||||
srcs = [":native-srcs"] + glob(
|
||||
["src/main/native/cpp/**"],
|
||||
exclude = ["src/main/native/cpp/jni/**"],
|
||||
),
|
||||
hdrs = glob(["src/main/native/include/**/*"]),
|
||||
includes = [
|
||||
"src/main/native/cpp",
|
||||
"src/main/native/include",
|
||||
],
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//wpinet:wpinet.static",
|
||||
"//wpiutil:wpiutil.static",
|
||||
"@bzlmodrio-opencv//libraries/cpp/opencv",
|
||||
] + select({
|
||||
"@bazel_tools//src/conditions:darwin": [":cscore-mac"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)
|
||||
|
||||
java_library(
|
||||
name = "cscore-java",
|
||||
srcs = glob(["src/main/java/**/*.java"]),
|
||||
@@ -10,6 +81,24 @@ java_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "cscore-cpp-test",
|
||||
size = "small",
|
||||
srcs = glob(["src/test/native/**"]),
|
||||
deps = [
|
||||
":cscore.static",
|
||||
"//thirdparty/googletest:googletest.static",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "DevMain-Cpp",
|
||||
srcs = ["src/dev/native/cpp/main.cpp"],
|
||||
deps = [
|
||||
":cscore.static",
|
||||
],
|
||||
)
|
||||
|
||||
java_binary(
|
||||
name = "DevMain-Java",
|
||||
srcs = ["src/dev/java/edu/wpi/first/cscore/DevMain.java"],
|
||||
|
||||
22
epilogue-processor/BUILD.bazel
Normal file
22
epilogue-processor/BUILD.bazel
Normal file
@@ -0,0 +1,22 @@
|
||||
load("@rules_java//java:defs.bzl", "java_library", "java_plugin")
|
||||
|
||||
java_library(
|
||||
name = "processor",
|
||||
srcs = glob(["src/main/java/**/*.java"]),
|
||||
visibility = ["//visibility:public"],
|
||||
runtime_deps = [
|
||||
"//wpilibNewCommands:wpilibNewCommands-java",
|
||||
],
|
||||
deps = [
|
||||
"//epilogue-runtime:epilogue",
|
||||
],
|
||||
)
|
||||
|
||||
java_plugin(
|
||||
name = "plugin",
|
||||
processor_class = "edu.wpi.first.epilogue.processor.AnnotationProcessor",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":processor",
|
||||
],
|
||||
)
|
||||
@@ -43,6 +43,8 @@ public class LoggerGenerator {
|
||||
LoggerGenerator::isBuiltInJavaMethod;
|
||||
private final ProcessingEnvironment m_processingEnv;
|
||||
private final List<ElementHandler> m_handlers;
|
||||
|
||||
@SuppressWarnings("BadAnnotationImplementation")
|
||||
private final Logged m_defaultConfig =
|
||||
new Logged() {
|
||||
@Override
|
||||
|
||||
12
epilogue-runtime/BUILD.bazel
Normal file
12
epilogue-runtime/BUILD.bazel
Normal file
@@ -0,0 +1,12 @@
|
||||
load("@rules_java//java:defs.bzl", "java_library")
|
||||
|
||||
java_library(
|
||||
name = "epilogue",
|
||||
srcs = glob(["src/main/java/**/*.java"]),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//ntcore:networktables-java",
|
||||
"//wpiunits",
|
||||
"//wpiutil:wpiutil-java",
|
||||
],
|
||||
)
|
||||
31
fieldImages/BUILD.bazel
Normal file
31
fieldImages/BUILD.bazel
Normal file
@@ -0,0 +1,31 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load("@rules_java//java:defs.bzl", "java_library")
|
||||
load("//shared/bazel/rules/gen:gen-resources.bzl", "generate_resources")
|
||||
|
||||
generate_resources(
|
||||
name = "generate-resources",
|
||||
namespace = "fields",
|
||||
prefix = "FIELDS",
|
||||
resource_files = glob(["src/main/native/resources/**"]),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "fieldImages",
|
||||
srcs = [":generate-resources"] + glob(["src/main/native/cpp/**"]),
|
||||
hdrs = glob(["src/main/native/include/**/*"]),
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
java_library(
|
||||
name = "fieldImages-java",
|
||||
srcs = glob(["src/main/java/**/*.java"]),
|
||||
resource_strip_prefix = "fieldImages/src/main/native/resources",
|
||||
resources = glob(["src/main/native/resources/**"]),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"@maven//:com_fasterxml_jackson_core_jackson_annotations",
|
||||
"@maven//:com_fasterxml_jackson_core_jackson_databind",
|
||||
],
|
||||
)
|
||||
53
romiVendordep/BUILD.bazel
Normal file
53
romiVendordep/BUILD.bazel
Normal file
@@ -0,0 +1,53 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary", "java_library")
|
||||
|
||||
cc_library(
|
||||
name = "romi-cpp.static",
|
||||
srcs = glob([
|
||||
"src/main/native/cpp/**",
|
||||
]),
|
||||
hdrs = glob(["src/main/native/include/**"]),
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//wpilibc:wpilibc.static",
|
||||
],
|
||||
)
|
||||
|
||||
java_library(
|
||||
name = "romi-java",
|
||||
srcs = glob(["src/main/java/**/*.java"]),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//hal:hal-java",
|
||||
"//wpilibj",
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "romi-test",
|
||||
size = "small",
|
||||
srcs = glob(["src/test/native/cpp/**"]),
|
||||
deps = [
|
||||
"//thirdparty/googletest:googletest.static",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "DevMain-Cpp",
|
||||
srcs = ["src/dev/native/cpp/main.cpp"],
|
||||
deps = [
|
||||
":romi-cpp.static",
|
||||
],
|
||||
)
|
||||
|
||||
java_binary(
|
||||
name = "DevMain-Java",
|
||||
srcs = ["src/dev/java/edu/wpi/first/wpilibj/romi/DevMain.java"],
|
||||
main_class = "edu.wpi.first.wpilibj.romi.DevMain",
|
||||
deps = [
|
||||
"//hal:hal-java",
|
||||
"//ntcore:networktables-java",
|
||||
"//wpiutil:wpiutil-java",
|
||||
],
|
||||
)
|
||||
@@ -42,3 +42,6 @@ build:macos --linkopt=-Wl,-rpath,'@loader_path'"
|
||||
|
||||
# Things not in nativetools
|
||||
build:macos --copt=-Wno-shorten-64-to-32
|
||||
|
||||
build:macos --host_per_file_copt=external/zlib/.*\.c@-Wno-deprecated-non-prototype
|
||||
build:macos --host_per_file_copt=external/com_google_protobuf/.*\.cc@-Wno-unused-function
|
||||
|
||||
@@ -14,3 +14,5 @@ build:roborio --cxxopt=-Wno-error=deprecated-declarations
|
||||
|
||||
# Extra 11
|
||||
build:roborio --cxxopt=-Wno-error=deprecated-enum-enum-conversion
|
||||
|
||||
build:roborio --host_per_file_copt=external/zlib/.*\.c@-Wno-deprecated-non-prototype
|
||||
|
||||
87
wpilibNewCommands/BUILD.bazel
Normal file
87
wpilibNewCommands/BUILD.bazel
Normal file
@@ -0,0 +1,87 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary", "java_library")
|
||||
|
||||
cc_library(
|
||||
name = "generated_cc_headers",
|
||||
hdrs = glob(["src/generated/main/native/include/**"]),
|
||||
includes = ["src/generated/main/native/include"],
|
||||
strip_include_prefix = "src/generated/main/native/include",
|
||||
visibility = ["//wpilibNewCommands:__subpackages__"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "generated_cc_source",
|
||||
srcs = glob(["src/generated/main/native/cpp/**"]),
|
||||
visibility = ["//wpilibNewCommands:__subpackages__"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "generated_java",
|
||||
srcs = glob(["src/generated/main/java/**/*.java"]),
|
||||
visibility = ["//wpilibNewCommands:__subpackages__"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "wpilibNewCommands.static",
|
||||
srcs = glob(["src/main/native/cpp/**"]) + [":generated_cc_source"],
|
||||
hdrs = glob(["src/main/native/include/**"]),
|
||||
includes = ["src/main/native/include"],
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":generated_cc_headers",
|
||||
"//wpilibc:wpilibc.static",
|
||||
],
|
||||
)
|
||||
|
||||
java_library(
|
||||
name = "wpilibNewCommands-java",
|
||||
srcs = glob(["src/main/java/**/*.java"]) + [":generated_java"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//cscore:cscore-java",
|
||||
"//hal:hal-java",
|
||||
"//ntcore:networktables-java",
|
||||
"//wpilibj",
|
||||
"//wpimath:wpimath-java",
|
||||
"//wpinet:wpinet-java",
|
||||
"//wpiunits",
|
||||
"//wpiutil:wpiutil-java",
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "wpilibNewCommands-cpp-test",
|
||||
size = "small",
|
||||
srcs = glob([
|
||||
"src/test/native/**/*.cpp",
|
||||
"src/test/native/**/*.h",
|
||||
]),
|
||||
tags = [
|
||||
"no-tsan",
|
||||
"no-ubsan",
|
||||
],
|
||||
deps = [
|
||||
":wpilibNewCommands.static",
|
||||
"//thirdparty/googletest:googletest.static",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "DevMain-Cpp",
|
||||
srcs = ["src/dev/native/cpp/main.cpp"],
|
||||
deps = [
|
||||
],
|
||||
)
|
||||
|
||||
java_binary(
|
||||
name = "DevMain-Java",
|
||||
srcs = ["src/dev/java/edu/wpi/first/wpilibj2/commands/DevMain.java"],
|
||||
main_class = "edu.wpi.first.wpilibj2.commands.DevMain",
|
||||
deps = [
|
||||
"//hal:hal-java",
|
||||
"//ntcore:networktables-java",
|
||||
"//wpimath:wpimath-java",
|
||||
"//wpiutil:wpiutil-java",
|
||||
],
|
||||
)
|
||||
80
wpilibc/BUILD.bazel
Normal file
80
wpilibc/BUILD.bazel
Normal file
@@ -0,0 +1,80 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file")
|
||||
|
||||
generate_version_file(
|
||||
name = "generate-version",
|
||||
output_file = "WPILibVersion.cpp",
|
||||
template = "src/generate/WPILibVersion.cpp.in",
|
||||
visibility = ["//wpilibc:__subpackages__"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "generated_cc_headers",
|
||||
hdrs = glob(["src/generated/main/native/include/**"]),
|
||||
includes = ["src/generated/main/native/include"],
|
||||
strip_include_prefix = "src/generated/main/native/include",
|
||||
visibility = ["//wpilibc:__subpackages__"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "generated_cc_source",
|
||||
srcs = glob(
|
||||
["src/generated/main/native/cpp/**"],
|
||||
exclude = ["src/generated/main/native/cpp/jni/**"],
|
||||
),
|
||||
visibility = ["//wpilibc:__subpackages__"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "wpilibc.static",
|
||||
srcs = [
|
||||
":generate-version",
|
||||
] + glob([
|
||||
"src/main/native/cppcs/**",
|
||||
"src/main/native/cpp/**",
|
||||
]) + [":generated_cc_source"],
|
||||
hdrs = glob(["src/main/native/include/**"]),
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":generated_cc_headers",
|
||||
"//cameraserver:cameraserver.static",
|
||||
"//cscore:cscore.static",
|
||||
"//hal:wpiHal.static",
|
||||
"//ntcore:ntcore.static",
|
||||
"//wpimath:wpimath.static",
|
||||
"//wpinet:wpinet.static",
|
||||
"//wpiutil:wpiutil.static",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "test-headers",
|
||||
testonly = True,
|
||||
hdrs = glob(["src/test/native/include/**"]),
|
||||
includes = ["src/test/native/include"],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "wpilibc-test",
|
||||
size = "small",
|
||||
srcs = glob(["src/test/native/cpp/**"]),
|
||||
tags = [
|
||||
"no-asan",
|
||||
"no-tsan",
|
||||
"no-ubsan",
|
||||
],
|
||||
deps = [
|
||||
":test-headers",
|
||||
":wpilibc.static",
|
||||
"//thirdparty/googletest:googletest.static",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "DevMain-Cpp",
|
||||
srcs = ["src/dev/native/cpp/main.cpp"],
|
||||
deps = [
|
||||
":wpilibc.static",
|
||||
],
|
||||
)
|
||||
24
wpilibcIntegrationTests/BUILD.bazel
Normal file
24
wpilibcIntegrationTests/BUILD.bazel
Normal file
@@ -0,0 +1,24 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
|
||||
|
||||
ATHENA_SOURCES = glob(["src/main/native/cpp/**"])
|
||||
|
||||
NON_ATHENA_SOURCES = glob(["src/main/native/dt/**"])
|
||||
|
||||
cc_library(
|
||||
name = "test_headers",
|
||||
hdrs = glob(["src/main/native/include/**"]),
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "wpilibcIntegrationTests",
|
||||
srcs = select({
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ATHENA_SOURCES,
|
||||
"//conditions:default": NON_ATHENA_SOURCES,
|
||||
}),
|
||||
deps = [
|
||||
":test_headers",
|
||||
"//thirdparty/googletest:googletest.static",
|
||||
"//wpilibc:wpilibc.static",
|
||||
],
|
||||
)
|
||||
@@ -1,3 +1,4 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary", "java_library")
|
||||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
|
||||
@@ -7,6 +8,76 @@ filegroup(
|
||||
visibility = ["//wpimath:__subpackages__"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "eigen-headers",
|
||||
hdrs = glob([
|
||||
"src/main/native/thirdparty/eigen/include/**",
|
||||
]),
|
||||
includes = ["src/main/native/thirdparty/eigen/include"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/eigen/include",
|
||||
visibility = ["//wpimath:__subpackages__"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "gcem",
|
||||
hdrs = glob([
|
||||
"src/main/native/thirdparty/gcem/include/**",
|
||||
]),
|
||||
includes = ["src/main/native/thirdparty/gcem/include"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/gcem/include",
|
||||
visibility = ["//wpimath:__subpackages__"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "sleipnir-headers",
|
||||
hdrs = glob([
|
||||
"src/main/native/thirdparty/sleipnir/include/**/*.hpp",
|
||||
]),
|
||||
includes = ["src/main/native/thirdparty/sleipnir/include"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/sleipnir/include",
|
||||
visibility = ["//wpimath:__subpackages__"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "sleipnir-srcs",
|
||||
srcs = glob(["src/main/native/thirdparty/sleipnir/src/**"]),
|
||||
visibility = ["//wpimath:__subpackages__"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "nanopb-generated-headers",
|
||||
hdrs = glob(["src/generated/main/native/cpp/**/*.h"]),
|
||||
includes = ["src/generated/main/native/cpp"],
|
||||
strip_include_prefix = "src/generated/main/native/cpp",
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "wpimath.static",
|
||||
srcs = glob(
|
||||
[
|
||||
"src/main/native/cpp/**",
|
||||
"src/generated/main/native/cpp/**/*.cpp",
|
||||
],
|
||||
exclude = ["src/main/native/cpp/jni/**"],
|
||||
) + [":sleipnir-srcs"],
|
||||
hdrs = glob(["src/main/native/include/**"]),
|
||||
defines = ["WPILIB_EXPORTS"],
|
||||
includes = [
|
||||
"src/main/native/include",
|
||||
"src/main/native/thirdparty/sleipnir/src",
|
||||
],
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":eigen-headers",
|
||||
":gcem",
|
||||
":nanopb-generated-headers",
|
||||
":sleipnir-headers",
|
||||
"//wpiutil:wpiutil.static",
|
||||
],
|
||||
)
|
||||
|
||||
java_library(
|
||||
name = "wpimath-java",
|
||||
srcs = [":generated_java"] + glob(["src/main/java/**/*.java"]),
|
||||
@@ -24,6 +95,40 @@ java_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "test_headers",
|
||||
hdrs = glob([
|
||||
"src/test/native/include/**",
|
||||
]),
|
||||
strip_include_prefix = "src/test/native/include",
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "wpimath-cpp-test",
|
||||
size = "small",
|
||||
srcs = glob([
|
||||
"src/test/native/cpp/**/*.cpp",
|
||||
"src/test/native/cpp/**/*.h",
|
||||
]),
|
||||
tags = [
|
||||
"no-bullseye",
|
||||
"no-raspi",
|
||||
],
|
||||
deps = [
|
||||
":test_headers",
|
||||
":wpimath.static",
|
||||
"//thirdparty/googletest:googletest.static",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "DevMain-Cpp",
|
||||
srcs = ["src/dev/native/cpp/main.cpp"],
|
||||
deps = [
|
||||
":wpimath.static",
|
||||
],
|
||||
)
|
||||
|
||||
java_binary(
|
||||
name = "DevMain-Java",
|
||||
srcs = ["src/dev/java/edu/wpi/first/math/DevMain.java"],
|
||||
|
||||
@@ -197,9 +197,9 @@ cc_library(
|
||||
":llvm-srcs",
|
||||
":memory-srcs",
|
||||
":mpack-srcs",
|
||||
":nanopb-srcs",
|
||||
":native-srcs",
|
||||
":protobuf-srcs",
|
||||
":nanopb-srcs",
|
||||
],
|
||||
hdrs = glob(["src/main/native/include/**/*"]),
|
||||
includes = ["src/main/native/include"],
|
||||
@@ -215,8 +215,8 @@ cc_library(
|
||||
":llvm-headers",
|
||||
":memory-headers",
|
||||
":mpack-headers",
|
||||
":protobuf-headers",
|
||||
":nanopb-headers",
|
||||
":protobuf-headers",
|
||||
":sigslot-headers",
|
||||
] + select({
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@bzlmodrio-ni//libraries/cpp/ni:shared"],
|
||||
|
||||
54
xrpVendordep/BUILD.bazel
Normal file
54
xrpVendordep/BUILD.bazel
Normal file
@@ -0,0 +1,54 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary", "java_library")
|
||||
|
||||
cc_library(
|
||||
name = "xrp-cpp",
|
||||
srcs = glob([
|
||||
"src/main/native/cpp/**",
|
||||
]),
|
||||
hdrs = glob(["src/main/native/include/**"]),
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//wpilibc:wpilibc.static",
|
||||
],
|
||||
)
|
||||
|
||||
java_library(
|
||||
name = "xrp-java",
|
||||
srcs = glob(["src/main/java/**/*.java"]),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//hal:hal-java",
|
||||
"//wpilibj",
|
||||
"//wpimath:wpimath-java",
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "xrp-cpp-test",
|
||||
size = "small",
|
||||
srcs = glob(["src/test/native/cpp/**"]),
|
||||
deps = [
|
||||
"//thirdparty/googletest:googletest.static",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "DevMain-Cpp",
|
||||
srcs = ["src/dev/native/cpp/main.cpp"],
|
||||
deps = [
|
||||
"//wpiutil:wpiutil.static",
|
||||
],
|
||||
)
|
||||
|
||||
java_binary(
|
||||
name = "DevMain-Java",
|
||||
srcs = ["src/dev/java/edu/wpi/first/wpilibj/xrp/DevMain.java"],
|
||||
main_class = "edu.wpi.first.wpilibj.xrp.DevMain",
|
||||
deps = [
|
||||
"//hal:hal-java",
|
||||
"//ntcore:networktables-java",
|
||||
"//wpiutil:wpiutil-java",
|
||||
],
|
||||
)
|
||||
Reference in New Issue
Block a user