mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Using MrcLib on the robot is going to be the plan for the future, to make things easier. MrcLib is how sim is supported going forward. The desktop version of mrclib can act as a robot server. This is set up where the mrclib interface is in shared code. On robot, that is the only backend used. On desktop, a default sim backend is used. However, the sim plugin can switch that to the real robot backend, so the robot code will exactly look like a real robot.
162 lines
4.7 KiB
Python
162 lines
4.7 KiB
Python
load("@allwpilib_pip_deps//:requirements.bzl", "requirement")
|
|
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test")
|
|
load("@rules_java//java:defs.bzl", "java_binary")
|
|
load("//shared/bazel/rules:cc_rules.bzl", "wpilib_cc_library", "wpilib_cc_shared_library", "wpilib_cc_static_library")
|
|
load("//shared/bazel/rules:java_rules.bzl", "wpilib_java_library")
|
|
load("//shared/bazel/rules:packaging.bzl", "package_default_cc_project")
|
|
load("//shared/bazel/rules/robotpy:build_info_gen.bzl", "generate_robotpy_native_wrapper_build_info", "generate_robotpy_pybind_build_info")
|
|
load("//shared/bazel/rules/robotpy:pytest_util.bzl", "robotpy_py_test")
|
|
load("//xrpVendordep:robotpy_native_build_info.bzl", "define_native_wrapper")
|
|
load("//xrpVendordep:robotpy_pybind_build_info.bzl", "define_pybind_library", "xrp_extension")
|
|
|
|
filegroup(
|
|
name = "doxygen-files",
|
|
srcs = glob([
|
|
"src/main/native/include/**/*",
|
|
]),
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
wpilib_cc_library(
|
|
name = "xrpVendordep",
|
|
srcs = glob([
|
|
"src/main/native/cpp/**",
|
|
]),
|
|
hdrs = glob(["src/main/native/include/**"]),
|
|
strip_include_prefix = "src/main/native/include",
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"//ntcore",
|
|
"//wpilibc",
|
|
"//wpinet",
|
|
],
|
|
)
|
|
|
|
wpilib_cc_shared_library(
|
|
name = "shared/xrpVendordep",
|
|
dynamic_deps = [
|
|
"//ntcore:shared/ntcore",
|
|
"//wpilibc:shared/wpilibc",
|
|
"//wpinet:shared/wpinet",
|
|
"//wpiutil:shared/wpiutil",
|
|
"//wpimath:shared/wpimath",
|
|
"//hal:shared/wpiHal",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
deps = [":xrpVendordep"],
|
|
)
|
|
|
|
wpilib_cc_static_library(
|
|
name = "static/xrpVendordep",
|
|
static_deps = [
|
|
"//ntcore:static/ntcore",
|
|
"//wpilibc:static/wpilibc",
|
|
"//wpinet:static/wpinet",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
deps = [":xrpVendordep"],
|
|
)
|
|
|
|
wpilib_java_library(
|
|
name = "xrpVendordep-java",
|
|
srcs = glob(["src/main/java/**/*.java"]),
|
|
maven_artifact_name = "xrpVendordep-java",
|
|
maven_group_id = "org.wpilib.xrpVendordep",
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"//hal:hal-java",
|
|
"//wpilibj:wpilibj-java",
|
|
"//wpimath:wpimath-java",
|
|
],
|
|
)
|
|
|
|
cc_test(
|
|
name = "xrp-cpp-test",
|
|
size = "small",
|
|
srcs = glob(["src/test/native/cpp/**"]),
|
|
deps = [
|
|
":xrpVendordep",
|
|
"//thirdparty/googletest",
|
|
],
|
|
)
|
|
|
|
cc_binary(
|
|
name = "DevMain-Cpp",
|
|
srcs = ["src/dev/native/cpp/main.cpp"],
|
|
deps = [
|
|
"//wpiutil",
|
|
],
|
|
)
|
|
|
|
java_binary(
|
|
name = "DevMain-Java",
|
|
srcs = ["src/dev/java/org/wpilib/xrp/DevMain.java"],
|
|
main_class = "org.wpilib.xrp.DevMain",
|
|
deps = [
|
|
"//hal:hal-java",
|
|
"//ntcore:ntcore-java",
|
|
"//wpiutil:wpiutil-java",
|
|
],
|
|
)
|
|
|
|
package_default_cc_project(
|
|
name = "xrpVendordep",
|
|
maven_artifact_name = "xrpVendordep-cpp",
|
|
maven_group_id = "org.wpilib.xrpVendordep",
|
|
)
|
|
|
|
generate_robotpy_native_wrapper_build_info(
|
|
name = "robotpy-native-xrp-generator",
|
|
pyproject_toml = "src/main/python/native-pyproject.toml",
|
|
)
|
|
|
|
define_native_wrapper(
|
|
name = "robotpy-native-xrp",
|
|
pyproject_toml = "src/main/python/native-pyproject.toml",
|
|
)
|
|
|
|
PKG_CONFIG_DEPS = [
|
|
"//datalog:native/datalog/robotpy-native-datalog.pc",
|
|
"//datalog:robotpy-wpilog.generated_pkgcfg_files",
|
|
"//hal:native/wpihal/robotpy-native-mrclib.pc",
|
|
"//hal:native/wpihal/robotpy-native-wpihal.pc",
|
|
"//hal:robotpy-hal.generated_pkgcfg_files",
|
|
"//ntcore:native/ntcore/robotpy-native-ntcore.pc",
|
|
"//ntcore:pyntcore.generated_pkgcfg_files",
|
|
"//wpilibc:native/wpilib/robotpy-native-wpilib.pc",
|
|
"//wpilibc:robotpy-wpilib.generated_pkgcfg_files",
|
|
"//wpimath:native/wpimath/robotpy-native-wpimath.pc",
|
|
"//wpimath:robotpy-wpimath.generated_pkgcfg_files",
|
|
"//wpinet:native/wpinet/robotpy-native-wpinet.pc",
|
|
"//wpinet:robotpy-wpinet.generated_pkgcfg_files",
|
|
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
|
|
"//wpiutil:robotpy-wpiutil.generated_pkgcfg_files",
|
|
"//xrpVendordep:native/xrp/robotpy-native-xrp.pc",
|
|
]
|
|
|
|
generate_robotpy_pybind_build_info(
|
|
name = "robotpy-xrp-generator",
|
|
additional_srcs = [":robotpy-native-xrp.copy_headers"],
|
|
package_root_file = "src/main/python/xrp/__init__.py",
|
|
pkgcfgs = PKG_CONFIG_DEPS,
|
|
yaml_files = glob(["src/main/python/semiwrap/**/*.yml"]),
|
|
)
|
|
|
|
xrp_extension(
|
|
srcs = ["src/main/python/xrp/src/main.cpp"],
|
|
)
|
|
|
|
define_pybind_library(
|
|
name = "robotpy-xrp",
|
|
pkgcfgs = PKG_CONFIG_DEPS,
|
|
)
|
|
|
|
robotpy_py_test(
|
|
"python_tests",
|
|
srcs = glob(["src/test/python/*.py"]),
|
|
deps = [
|
|
":robotpy-xrp",
|
|
requirement("pytest"),
|
|
],
|
|
)
|