mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[robotpy] Add build scripts for wpilib and dependencies (#8348)
This gets the majority of projects from mostrobotpy building in this mirror. Projects missing still are cscore and the halsim wrappers.
This commit is contained in:
33
.github/workflows/bazel.yml
vendored
33
.github/workflows/bazel.yml
vendored
@@ -121,3 +121,36 @@ jobs:
|
||||
name: ${{ matrix.platform }}-bazel-lint-fixes
|
||||
path: bazel-lint-fixes.patch
|
||||
if: ${{ failure() }}
|
||||
|
||||
robotpy_pregeneration:
|
||||
name: "Robotpy Pregeneration"
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with: { fetch-depth: 0 }
|
||||
|
||||
- id: Setup_build_buddy
|
||||
uses: ./.github/actions/setup-build-buddy
|
||||
with:
|
||||
token: ${{ secrets.BUILDBUDDY_API_KEY }}
|
||||
|
||||
# You should ensure the headers are correct before trying to pregen files
|
||||
- name: Test Scan Headers
|
||||
run: bazel test //... -k --test_tag_filters=robotpy_scan_headers --build_tests_only
|
||||
shell: bash
|
||||
|
||||
- name: Run robotpy pregeneration
|
||||
run: bazel run //:write_robotpy_files
|
||||
|
||||
- name: Check Output
|
||||
run: git --no-pager diff --exit-code HEAD
|
||||
|
||||
- name: Generate diff
|
||||
run: git diff HEAD > robotpy-pregeneration.patch
|
||||
if: ${{ failure() }}
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.platform }}-robotpy-pregeneration-fixes
|
||||
path: robotpy-pregeneration-fixes.patch
|
||||
if: ${{ failure() }}
|
||||
|
||||
135
BUILD.bazel
135
BUILD.bazel
@@ -2,6 +2,7 @@ load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")
|
||||
load("@rules_pkg//:mappings.bzl", "pkg_files")
|
||||
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
|
||||
load("//shared/bazel/rules:publishing.bzl", "publish_all")
|
||||
load("//shared/bazel/rules/robotpy:compatibility_select.bzl", "robotpy_compatibility_select")
|
||||
|
||||
exports_files([
|
||||
"LICENSE.md",
|
||||
@@ -42,7 +43,7 @@ alias(
|
||||
|
||||
# This is a helper to run all of the pregeneration scripts at once.
|
||||
write_source_files(
|
||||
name = "write_all",
|
||||
name = "write_pregenerated_files",
|
||||
additional_update_targets = [
|
||||
"//hal:write_hal",
|
||||
"//ntcore:write_ntcore",
|
||||
@@ -126,3 +127,135 @@ publish_all(
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)
|
||||
|
||||
write_source_files(
|
||||
name = "write_robotpy_generated_native_files",
|
||||
additional_update_targets = [
|
||||
"//apriltag:robotpy-native-apriltag-generator.generate_build_info",
|
||||
"//datalog:robotpy-native-datalog-generator.generate_build_info",
|
||||
"//hal:robotpy-native-wpihal-generator.generate_build_info",
|
||||
"//ntcore:robotpy-native-ntcore-generator.generate_build_info",
|
||||
"//romiVendordep:robotpy-native-xrp-generator.generate_build_info",
|
||||
"//wpilibc:robotpy-native-wpilib-generator.generate_build_info",
|
||||
"//wpinet:robotpy-native-wpinet-generator.generate_build_info",
|
||||
"//wpimath:robotpy-native-wpimath-generator.generate_build_info",
|
||||
"//wpiutil:robotpy-native-wpiutil-generator.generate_build_info",
|
||||
"//xrpVendordep:robotpy-native-xrp-generator.generate_build_info",
|
||||
],
|
||||
tags = [
|
||||
"pregeneration",
|
||||
"robotpy",
|
||||
],
|
||||
target_compatible_with = robotpy_compatibility_select(),
|
||||
)
|
||||
|
||||
write_source_files(
|
||||
name = "write_robotpy_generated_pybind_files",
|
||||
additional_update_targets = [
|
||||
"//apriltag:robotpy-apriltag-generator.generate_build_info",
|
||||
"//datalog:robotpy-datalog-generator.generate_build_info",
|
||||
"//hal:robotpy-hal-generator.generate_build_info",
|
||||
"//ntcore:pyntcore-generator.generate_build_info",
|
||||
"//romiVendordep:robotpy-romi-generator.generate_build_info",
|
||||
"//wpilibc:robotpy-wpilib-generator.generate_build_info",
|
||||
"//wpinet:robotpy-wpinet-generator.generate_build_info",
|
||||
"//wpimath:robotpy-wpimath-generator.generate_build_info",
|
||||
"//wpimath:robotpy-wpimath_test-generator.generate_build_info",
|
||||
"//wpiutil:robotpy-wpiutil-generator.generate_build_info",
|
||||
"//xrpVendordep:robotpy-xrp-generator.generate_build_info",
|
||||
],
|
||||
tags = [
|
||||
"pregeneration",
|
||||
"robotpy",
|
||||
],
|
||||
target_compatible_with = robotpy_compatibility_select(),
|
||||
)
|
||||
|
||||
write_source_files(
|
||||
name = "write_robotpy_update_yaml_files",
|
||||
additional_update_targets = [
|
||||
"//apriltag:write_robotpy-apriltag-update-yaml",
|
||||
"//datalog:write_robotpy-wpilog-update-yaml",
|
||||
"//hal:write_robotpy-hal-update-yaml",
|
||||
"//ntcore:write_pyntcore-update-yaml",
|
||||
"//romiVendordep:write_robotpy-romi-update-yaml",
|
||||
"//wpilibc:write_robotpy-wpilib-update-yaml",
|
||||
"//wpinet:write_robotpy-wpinet-update-yaml",
|
||||
"//wpimath:write_robotpy-wpimath-update-yaml",
|
||||
"//wpimath:write_robotpy-wpimath-test-update-yaml",
|
||||
"//wpiutil:write_robotpy-wpiutil-update-yaml",
|
||||
"//xrpVendordep:write_robotpy-xrp-update-yaml",
|
||||
],
|
||||
tags = [
|
||||
"manual",
|
||||
"pregeneration",
|
||||
"robotpy",
|
||||
],
|
||||
target_compatible_with = robotpy_compatibility_select(),
|
||||
)
|
||||
|
||||
write_source_files(
|
||||
name = "write_robotpy_create_imports",
|
||||
additional_update_targets = [
|
||||
"//apriltag:robotpy-apriltag-create-imports",
|
||||
"//datalog:robotpy-wpilog-create-imports",
|
||||
"//hal:robotpy-hal-create-imports",
|
||||
"//ntcore:pyntcore-create-imports",
|
||||
"//romiVendordep:robotpy-romi-create-imports",
|
||||
"//wpilibc:robotpy-wpilib-create-imports",
|
||||
"//wpinet:robotpy-wpinet-create-imports",
|
||||
"//wpimath:robotpy-wpimath-create-imports",
|
||||
"//wpimath:robotpy-wpimath-test-create-imports",
|
||||
"//wpiutil:robotpy-wpiutil-create-imports",
|
||||
"//xrpVendordep:robotpy-xrp-create-imports",
|
||||
],
|
||||
tags = [
|
||||
"manual",
|
||||
"pregeneration",
|
||||
"robotpy",
|
||||
],
|
||||
target_compatible_with = robotpy_compatibility_select(),
|
||||
)
|
||||
|
||||
write_source_files(
|
||||
name = "write_robotpy_files",
|
||||
additional_update_targets = [
|
||||
":write_robotpy_generated_native_files",
|
||||
":write_robotpy_generated_pybind_files",
|
||||
":write_robotpy_update_yaml_files",
|
||||
],
|
||||
tags = [
|
||||
"manual",
|
||||
"pregeneration",
|
||||
],
|
||||
)
|
||||
|
||||
write_source_files(
|
||||
name = "write_all",
|
||||
additional_update_targets = [
|
||||
":write_pregenerated_files",
|
||||
":write_robotpy_files",
|
||||
],
|
||||
tags = [
|
||||
"manual",
|
||||
"pregeneration",
|
||||
],
|
||||
)
|
||||
|
||||
# Helper easily run the semiwrap parsing tools on all of the robotpy projects.
|
||||
filegroup(
|
||||
name = "robotpy_generated_files",
|
||||
srcs = [
|
||||
"//apriltag:robotpy-apriltag.generated_files",
|
||||
"//datalog:robotpy-wpilog.generated_files",
|
||||
"//hal:robotpy-hal.generated_files",
|
||||
"//ntcore:pyntcore.generated_files",
|
||||
"//wpilibc:robotpy-wpilib.generated_files",
|
||||
"//wpimath:robotpy-wpimath.generated_files",
|
||||
"//wpimath:robotpy-wpimath-test.generated_files",
|
||||
"//wpinet:robotpy-wpinet.generated_files",
|
||||
"//wpiutil:robotpy-wpiutil.generated_files",
|
||||
],
|
||||
tags = ["manual"],
|
||||
target_compatible_with = robotpy_compatibility_select(),
|
||||
)
|
||||
|
||||
@@ -11,3 +11,55 @@ Building the robotpy software on top of the standard C++/Java software can resul
|
||||
NOTE: This process is currently unlanded while robotpy gets the 2027 branch stable
|
||||
|
||||
[Copybara](https://github.com/google/copybara) is used to maintin synchronization between the upstream robotpy repositories and the allwpilib mirror. Github actions can be manually run which will create pull requests that will update all of the robotpy files between the two repositories. The ideal process is that the allwpilib mirror is always building in CI, and once a release is created the RobotPy team can run the `wpilib -> robotpy` copybara task, make any fine tuned adjustements and create their release. In the event that additional changes are made on the robotpy side, they can run the `robotpy -> wpilib` task to push the updates back to the mirror. However the goal of the mirroring the software here is to be able to more rapidly test changes and will hopefully overwhelmingly eliminate the need for syncs this direction.
|
||||
|
||||
|
||||
# Debugging Build Errors
|
||||
The build process is highly automated and automatically parses C++ header files to generate pybind11 bindings. Some of these steps here are considered "pregeneration" steps, and the bazel build system will update build files as necessary. If a new header is added, or if the contents of a header file has changed, some of the pregeneration scripts might need to be run. If you encounter an error building `robotpy` code, it is recommended that you go through these steps to make sure everything is set up correctly. The examples are for `wpilibc`, but similar build tasks and tests exist for each wrapped project
|
||||
|
||||
## 1. scan-headers
|
||||
This can be the first source of problems if a new header file has been added. `semiwrap` will look through all of the headers for a library and notify you if a file is not covered by the projects `pyproject.toml` file. Bazel has a test case to ensure the files are up to date.
|
||||
|
||||
An example test failure when a new header being introduced. You can run the test with the following command
|
||||
|
||||
bazel run //wpilibc:robotpy-wpilib-scan-headers
|
||||
|
||||
```
|
||||
# wpi
|
||||
ExpansionHub = "wpi/ExpansionHub.hpp"
|
||||
ExpansionHubMotor = "wpi/ExpansionHubMotor.hpp"
|
||||
ExpansionHubPidConstants = "wpi/ExpansionHubPidConstants.hpp"
|
||||
ExpansionHubServo = "wpi/ExpansionHubServo.hpp"
|
||||
|
||||
```
|
||||
|
||||
To fix this, you can copy the lines from the console, and add them to the pyproject.toml file, located here `wpilibc/src/main/python/pyproject.toml`
|
||||
|
||||
## 2. update-yaml
|
||||
This process parses all of the header files, and creates a representation of the classes / enums / etc in yaml. Occasionally some functions might be ignored or need custom pybind code, which can be added to these files by the user.
|
||||
|
||||
There is a bazel task that you can run to automatically update the files:
|
||||
|
||||
`bazel run //wpilibc:write_robotpy-wpilib-update-yaml`
|
||||
|
||||
|
||||
## 3. generate-build-info
|
||||
This step takes the yaml files, and auto generates a bazel build script for the library.
|
||||
|
||||
There is a bazel task that you can run to automatically update the files:
|
||||
|
||||
`bazel run //wpilibc:robotpy-wpilib-generator.generate_build_info`
|
||||
|
||||
## semiwrap errors
|
||||
If all of these steps above go smoothly and have their tests pass, but the generated cpp files still won't compile, it is possible that either an update needs to be made to the semiwrap tool to handle the new complex functionality, the new functionality can be ignored, or the new functionality might be better handled with a custom pybind11 implementation. In any case, it is best to reach out to the robotpy team for guidance.
|
||||
|
||||
## Running multiple projects at once
|
||||
Each project has its own `scan-headers` and various pregeneration tools, but you can run all of them at once with the following commands. Note: Sometimes if something in the dependency chain for a library fails, these amalgamation commands will also fail. If that happens, fix your way up the dependency chain project by project.
|
||||
|
||||
```
|
||||
# Scan Headers
|
||||
bazel test //... -k --test_tag_filters=robotpy_scan_headers --build_tests_only
|
||||
|
||||
# All pregen
|
||||
bazel run //:write_robotpy_files
|
||||
|
||||
```
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
load("@allwpilib_pip_deps//:requirements.bzl", "requirement")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary")
|
||||
load("@rules_pkg//:mappings.bzl", "pkg_files")
|
||||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
load("//apriltag:robotpy_native_build_info.bzl", "define_native_wrapper")
|
||||
load("//apriltag:robotpy_pybind_build_info.bzl", "apriltag_extension", "define_pybind_library")
|
||||
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_junit5_test")
|
||||
load("//shared/bazel/rules:jni_rules.bzl", "wpilib_jni_cc_library", "wpilib_jni_java_library")
|
||||
load("//shared/bazel/rules:packaging.bzl", "package_minimal_jni_project")
|
||||
load("//shared/bazel/rules/gen:gen-resources.bzl", "generate_resources")
|
||||
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")
|
||||
|
||||
filegroup(
|
||||
name = "doxygen-files",
|
||||
@@ -212,3 +217,56 @@ package_minimal_jni_project(
|
||||
maven_artifact_name = "apriltag-cpp",
|
||||
maven_group_id = "org.wpilib.apriltag",
|
||||
)
|
||||
|
||||
generate_robotpy_native_wrapper_build_info(
|
||||
name = "robotpy-native-apriltag-generator",
|
||||
pyproject_toml = "src/main/python/native-pyproject.toml",
|
||||
third_party_dirs = ["apriltag"],
|
||||
)
|
||||
|
||||
define_native_wrapper(
|
||||
name = "robotpy-native-apriltag",
|
||||
pyproject_toml = "src/main/python/native-pyproject.toml",
|
||||
)
|
||||
|
||||
PYBIND_PKGCFG_DEPS = [
|
||||
"//apriltag:native/apriltag/robotpy-native-apriltag.pc",
|
||||
"//wpimath:native/wpimath/robotpy-native-wpimath.pc",
|
||||
"//wpimath:robotpy-wpimath.generated_pkgcfg_files",
|
||||
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
|
||||
"//wpiutil:robotpy-wpiutil.generated_pkgcfg_files",
|
||||
]
|
||||
|
||||
generate_robotpy_pybind_build_info(
|
||||
name = "robotpy-apriltag-generator",
|
||||
additional_srcs = [":robotpy-native-apriltag.copy_headers"],
|
||||
package_root_file = "src/main/python/robotpy_apriltag/__init__.py",
|
||||
pkgcfgs = PYBIND_PKGCFG_DEPS,
|
||||
yaml_files = glob(["src/main/python/semiwrap/*.yml"]),
|
||||
)
|
||||
|
||||
apriltag_extension(
|
||||
srcs = ["src/main/python/robotpy_apriltag/src/main.cpp"],
|
||||
includes = [
|
||||
"src/main/python/datalog/",
|
||||
],
|
||||
)
|
||||
|
||||
define_pybind_library(
|
||||
name = "robotpy-apriltag",
|
||||
pkgcfgs = PYBIND_PKGCFG_DEPS,
|
||||
)
|
||||
|
||||
robotpy_py_test(
|
||||
"python_tests",
|
||||
srcs = glob(["src/test/python/**/*.py"]),
|
||||
data = glob([
|
||||
"src/test/python/*.png",
|
||||
"src/test/python/*.jpg",
|
||||
]),
|
||||
deps = [
|
||||
":robotpy-apriltag",
|
||||
requirement("pytest"),
|
||||
requirement("opencv-python"),
|
||||
],
|
||||
)
|
||||
|
||||
39
apriltag/robotpy_native_build_info.bzl
generated
Normal file
39
apriltag/robotpy_native_build_info.bzl
generated
Normal file
@@ -0,0 +1,39 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "native_wrappery_library")
|
||||
|
||||
def define_native_wrapper(name, pyproject_toml = None):
|
||||
copy_to_directory(
|
||||
name = "{}.copy_headers".format(name),
|
||||
srcs = native.glob(["src/main/native/include/**"]) + native.glob(["src/generated/main/native/include/**"], allow_empty = True) + native.glob([
|
||||
"src/main/native/thirdparty/apriltag/include/**",
|
||||
]),
|
||||
out = "native/apriltag/include",
|
||||
root_paths = ["src/main/native/include/"],
|
||||
replace_prefixes = {
|
||||
"apriltag/src/generated/main/native/include": "",
|
||||
"apriltag/src/main/native/include": "",
|
||||
"apriltag/src/main/native/thirdparty/apriltag/include": "",
|
||||
},
|
||||
verbose = False,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
native_wrappery_library(
|
||||
name = name,
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml",
|
||||
libinit_file = "native/apriltag/_init_robotpy_native_apriltag.py",
|
||||
pc_file = "native/apriltag/robotpy-native-apriltag.pc",
|
||||
pc_deps = [
|
||||
"//wpimath:native/wpimath/robotpy-native-wpimath.pc",
|
||||
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
|
||||
],
|
||||
deps = [
|
||||
"//wpimath:robotpy-native-wpimath",
|
||||
"//wpiutil:robotpy-native-wpiutil",
|
||||
],
|
||||
headers = "{}.copy_headers".format(name),
|
||||
native_shared_library = "shared/apriltag",
|
||||
install_path = "native/apriltag/",
|
||||
)
|
||||
242
apriltag/robotpy_pybind_build_info.bzl
generated
Normal file
242
apriltag/robotpy_pybind_build_info.bzl
generated
Normal file
@@ -0,0 +1,242 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
|
||||
def apriltag_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
APRILTAG_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "AprilTag",
|
||||
yml_file = "semiwrap/AprilTag.yml",
|
||||
header_root = "$(execpath :robotpy-native-apriltag.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-apriltag.copy_headers)/wpi/apriltag/AprilTag.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::apriltag::AprilTag", "wpi__apriltag__AprilTag.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "AprilTagDetection",
|
||||
yml_file = "semiwrap/AprilTagDetection.yml",
|
||||
header_root = "$(execpath :robotpy-native-apriltag.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-apriltag.copy_headers)/wpi/apriltag/AprilTagDetection.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::apriltag::AprilTagDetection", "wpi__apriltag__AprilTagDetection.hpp"),
|
||||
("wpi::apriltag::AprilTagDetection::Point", "wpi__apriltag__AprilTagDetection__Point.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "AprilTagDetector",
|
||||
yml_file = "semiwrap/AprilTagDetector.yml",
|
||||
header_root = "$(execpath :robotpy-native-apriltag.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-apriltag.copy_headers)/wpi/apriltag/AprilTagDetector.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::apriltag::AprilTagDetector", "wpi__apriltag__AprilTagDetector.hpp"),
|
||||
("wpi::apriltag::AprilTagDetector::Config", "wpi__apriltag__AprilTagDetector__Config.hpp"),
|
||||
("wpi::apriltag::AprilTagDetector::QuadThresholdParameters", "wpi__apriltag__AprilTagDetector__QuadThresholdParameters.hpp"),
|
||||
("wpi::apriltag::AprilTagDetector::Results", "wpi__apriltag__AprilTagDetector__Results.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "AprilTagFieldLayout",
|
||||
yml_file = "semiwrap/AprilTagFieldLayout.yml",
|
||||
header_root = "$(execpath :robotpy-native-apriltag.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-apriltag.copy_headers)/wpi/apriltag/AprilTagFieldLayout.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::apriltag::AprilTagFieldLayout", "wpi__apriltag__AprilTagFieldLayout.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "AprilTagFields",
|
||||
yml_file = "semiwrap/AprilTagFields.yml",
|
||||
header_root = "$(execpath :robotpy-native-apriltag.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-apriltag.copy_headers)/wpi/apriltag/AprilTagFields.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "AprilTagPoseEstimate",
|
||||
yml_file = "semiwrap/AprilTagPoseEstimate.yml",
|
||||
header_root = "$(execpath :robotpy-native-apriltag.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-apriltag.copy_headers)/wpi/apriltag/AprilTagPoseEstimate.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::apriltag::AprilTagPoseEstimate", "wpi__apriltag__AprilTagPoseEstimate.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "AprilTagPoseEstimator",
|
||||
yml_file = "semiwrap/AprilTagPoseEstimator.yml",
|
||||
header_root = "$(execpath :robotpy-native-apriltag.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-apriltag.copy_headers)/wpi/apriltag/AprilTagPoseEstimator.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::apriltag::AprilTagPoseEstimator", "wpi__apriltag__AprilTagPoseEstimator.hpp"),
|
||||
("wpi::apriltag::AprilTagPoseEstimator::Config", "wpi__apriltag__AprilTagPoseEstimator__Config.hpp"),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
resolve_casters(
|
||||
name = "apriltag.resolve_casters",
|
||||
caster_deps = ["//wpimath:src/main/python/wpimath/wpimath-casters.pybind11.json", "//wpiutil:src/main/python/wpiutil/wpiutil-casters.pybind11.json"],
|
||||
casters_pkl_file = "apriltag.casters.pkl",
|
||||
dep_file = "apriltag.casters.d",
|
||||
)
|
||||
|
||||
gen_libinit(
|
||||
name = "apriltag.gen_lib_init",
|
||||
output_file = "src/main/python/robotpy_apriltag/_init__apriltag.py",
|
||||
modules = ["native.apriltag._init_robotpy_native_apriltag", "wpiutil._init__wpiutil", "wpimath._init__wpimath"],
|
||||
)
|
||||
|
||||
gen_pkgconf(
|
||||
name = "apriltag.gen_pkgconf",
|
||||
libinit_py = "robotpy_apriltag._init__apriltag",
|
||||
module_pkg_name = "robotpy_apriltag._apriltag",
|
||||
output_file = "apriltag.pc",
|
||||
pkg_name = "apriltag",
|
||||
install_path = "src/main/python/robotpy_apriltag",
|
||||
project_file = "src/main/python/pyproject.toml",
|
||||
package_root = "src/main/python/robotpy_apriltag/__init__.py",
|
||||
)
|
||||
|
||||
gen_modinit_hpp(
|
||||
name = "apriltag.gen_modinit_hpp",
|
||||
input_dats = [x.class_name for x in APRILTAG_HEADER_GEN],
|
||||
libname = "_apriltag",
|
||||
output_file = "semiwrap_init.robotpy_apriltag._apriltag.hpp",
|
||||
)
|
||||
|
||||
run_header_gen(
|
||||
name = "apriltag",
|
||||
casters_pickle = "apriltag.casters.pkl",
|
||||
header_gen_config = APRILTAG_HEADER_GEN,
|
||||
trampoline_subpath = "src/main/python/robotpy_apriltag",
|
||||
deps = header_to_dat_deps,
|
||||
local_native_libraries = [
|
||||
"//apriltag:robotpy-native-apriltag.copy_headers",
|
||||
"//wpimath:robotpy-native-wpimath.copy_headers",
|
||||
"//wpiutil:robotpy-native-wpiutil.copy_headers",
|
||||
],
|
||||
)
|
||||
|
||||
create_pybind_library(
|
||||
name = "apriltag",
|
||||
install_path = "src/main/python/robotpy_apriltag/",
|
||||
extension_name = "_apriltag",
|
||||
generated_srcs = [":apriltag.generated_srcs"],
|
||||
semiwrap_header = [":apriltag.gen_modinit_hpp"],
|
||||
deps = [
|
||||
":apriltag.tmpl_hdrs",
|
||||
":apriltag.trampoline_hdrs",
|
||||
"//apriltag:apriltag",
|
||||
"//wpimath:wpimath",
|
||||
"//wpimath:wpimath_pybind_library",
|
||||
"//wpiutil:wpiutil",
|
||||
"//wpiutil:wpiutil_pybind_library",
|
||||
],
|
||||
dynamic_deps = [
|
||||
"//apriltag:shared/apriltag",
|
||||
"//wpimath:shared/wpimath",
|
||||
"//wpiutil:shared/wpiutil",
|
||||
],
|
||||
extra_hdrs = extra_hdrs,
|
||||
extra_srcs = srcs,
|
||||
includes = includes,
|
||||
)
|
||||
|
||||
native.filegroup(
|
||||
name = "apriltag.generated_files",
|
||||
srcs = [
|
||||
"apriltag.gen_modinit_hpp.gen",
|
||||
"apriltag.header_gen_files",
|
||||
"apriltag.gen_pkgconf",
|
||||
"apriltag.gen_lib_init",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
)
|
||||
|
||||
def define_pybind_library(name, pkgcfgs = []):
|
||||
# Helper used to generate all files with one target.
|
||||
native.filegroup(
|
||||
name = "{}.generated_files".format(name),
|
||||
srcs = [
|
||||
"apriltag.generated_files",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Files that will be included in the wheel as data deps
|
||||
native.filegroup(
|
||||
name = "{}.generated_pkgcfg_files".format(name),
|
||||
srcs = [
|
||||
"src/main/python/robotpy_apriltag/apriltag.pc",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Contains all of the non-python files that need to be included in the wheel
|
||||
native.filegroup(
|
||||
name = "{}.extra_files".format(name),
|
||||
srcs = native.glob(["src/main/python/robotpy_apriltag/**"], exclude = ["src/main/python/robotpy_apriltag/**/*.py"], allow_empty = True),
|
||||
tags = ["manual", "robotpy"],
|
||||
)
|
||||
|
||||
generate_version_file(
|
||||
name = "{}.generate_version".format(name),
|
||||
output_file = "src/main/python/robotpy_apriltag/version.py",
|
||||
template = "//shared/bazel/rules/robotpy:version_template.in",
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
srcs = native.glob(["src/main/python/robotpy_apriltag/**/*.py"]) + [
|
||||
"src/main/python/robotpy_apriltag/_init__apriltag.py",
|
||||
"{}.generate_version".format(name),
|
||||
],
|
||||
data = [
|
||||
"{}.generated_pkgcfg_files".format(name),
|
||||
"{}.extra_files".format(name),
|
||||
":src/main/python/robotpy_apriltag/_apriltag",
|
||||
":apriltag.trampoline_hdr_files",
|
||||
],
|
||||
imports = ["src/main/python"],
|
||||
deps = [
|
||||
"//apriltag:robotpy-native-apriltag",
|
||||
"//wpimath:robotpy-wpimath",
|
||||
"//wpiutil:robotpy-wpiutil",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
update_yaml_files(
|
||||
name = "{}-update-yaml".format(name),
|
||||
yaml_output_directory = "src/main/python/semiwrap",
|
||||
extra_hdrs = native.glob(["src/main/python/**/*.h"], allow_empty = True) + [
|
||||
"//apriltag:robotpy-native-apriltag.copy_headers",
|
||||
"//wpimath:robotpy-native-wpimath.copy_headers",
|
||||
"//wpiutil:robotpy-native-wpiutil.copy_headers",
|
||||
],
|
||||
package_root_file = "src/main/python/robotpy_apriltag/__init__.py",
|
||||
pkgcfgs = pkgcfgs,
|
||||
pyproject_toml = "src/main/python/pyproject.toml",
|
||||
yaml_files = native.glob(["src/main/python/semiwrap/**"]),
|
||||
)
|
||||
|
||||
scan_headers(
|
||||
name = "{}-scan-headers".format(name),
|
||||
extra_hdrs = native.glob(["src/main/python/**/*.h"], allow_empty = True) + [
|
||||
"//apriltag:robotpy-native-apriltag.copy_headers",
|
||||
],
|
||||
package_root_file = "src/main/python/robotpy_apriltag/__init__.py",
|
||||
pkgcfgs = pkgcfgs,
|
||||
pyproject_toml = "src/main/python/pyproject.toml",
|
||||
)
|
||||
@@ -1,10 +1,15 @@
|
||||
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("@rules_python//python:defs.bzl", "py_binary")
|
||||
load("//datalog:robotpy_native_build_info.bzl", "define_native_wrapper")
|
||||
load("//datalog:robotpy_pybind_build_info.bzl", "define_pybind_library", "wpilog_extension")
|
||||
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_junit5_test")
|
||||
load("//shared/bazel/rules:jni_rules.bzl", "wpilib_jni_cc_library", "wpilib_jni_java_library")
|
||||
load("//shared/bazel/rules:packaging.bzl", "package_minimal_jni_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")
|
||||
|
||||
wpilib_cc_library(
|
||||
name = "datalog",
|
||||
@@ -146,3 +151,48 @@ package_minimal_jni_project(
|
||||
maven_artifact_name = "datalog-cpp",
|
||||
maven_group_id = "org.wpilib.datalog",
|
||||
)
|
||||
|
||||
generate_robotpy_native_wrapper_build_info(
|
||||
name = "robotpy-native-datalog-generator",
|
||||
pyproject_toml = "src/main/python/native-pyproject.toml",
|
||||
)
|
||||
|
||||
define_native_wrapper(
|
||||
name = "robotpy-native-datalog",
|
||||
pyproject_toml = "src/main/python/native-pyproject.toml",
|
||||
)
|
||||
|
||||
PYBIND_PKGCFG_DEPS = [
|
||||
"//datalog:native/datalog/robotpy-native-datalog.pc",
|
||||
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
|
||||
"//wpiutil:robotpy-wpiutil.generated_pkgcfg_files",
|
||||
]
|
||||
|
||||
generate_robotpy_pybind_build_info(
|
||||
name = "robotpy-datalog-generator",
|
||||
additional_srcs = [":robotpy-native-datalog.copy_headers"],
|
||||
package_root_file = "src/main/python/wpilog/__init__.py",
|
||||
pkgcfgs = PYBIND_PKGCFG_DEPS,
|
||||
yaml_files = glob(["src/main/python/semiwrap/*.yml"]),
|
||||
)
|
||||
|
||||
wpilog_extension(
|
||||
srcs = ["src/main/python/src/main.cpp"],
|
||||
includes = [
|
||||
"src/main/python/datalog/",
|
||||
],
|
||||
)
|
||||
|
||||
define_pybind_library(
|
||||
name = "robotpy-wpilog",
|
||||
pkgcfgs = PYBIND_PKGCFG_DEPS,
|
||||
)
|
||||
|
||||
robotpy_py_test(
|
||||
"datalog_tests",
|
||||
srcs = glob(["src/test/python/**/*.py"]),
|
||||
deps = [
|
||||
":robotpy-wpilog",
|
||||
requirement("pytest"),
|
||||
],
|
||||
)
|
||||
|
||||
34
datalog/robotpy_native_build_info.bzl
generated
Normal file
34
datalog/robotpy_native_build_info.bzl
generated
Normal file
@@ -0,0 +1,34 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "native_wrappery_library")
|
||||
|
||||
def define_native_wrapper(name, pyproject_toml = None):
|
||||
copy_to_directory(
|
||||
name = "{}.copy_headers".format(name),
|
||||
srcs = native.glob(["src/main/native/include/**"]) + native.glob(["src/generated/main/native/include/**"], allow_empty = True),
|
||||
out = "native/datalog/include",
|
||||
root_paths = ["src/main/native/include/"],
|
||||
replace_prefixes = {
|
||||
"datalog/src/generated/main/native/include": "",
|
||||
"datalog/src/main/native/include": "",
|
||||
},
|
||||
verbose = False,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
native_wrappery_library(
|
||||
name = name,
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml",
|
||||
libinit_file = "native/datalog/_init_robotpy_native_datalog.py",
|
||||
pc_file = "native/datalog/robotpy-native-datalog.pc",
|
||||
pc_deps = [
|
||||
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
|
||||
],
|
||||
deps = [
|
||||
"//wpiutil:robotpy-native-wpiutil",
|
||||
],
|
||||
headers = "{}.copy_headers".format(name),
|
||||
native_shared_library = "shared/datalog",
|
||||
install_path = "native/datalog/",
|
||||
)
|
||||
235
datalog/robotpy_pybind_build_info.bzl
generated
Normal file
235
datalog/robotpy_pybind_build_info.bzl
generated
Normal file
@@ -0,0 +1,235 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
|
||||
def wpilog_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
WPILOG_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "DataLog",
|
||||
yml_file = "semiwrap/DataLog.yml",
|
||||
header_root = "$(execpath :robotpy-native-datalog.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-datalog.copy_headers)/wpi/datalog/DataLog.hpp",
|
||||
tmpl_class_names = [
|
||||
("DataLog_tmpl1", "StructLogEntry"),
|
||||
("DataLog_tmpl2", "StructArrayLogEntry"),
|
||||
("DataLog_tmpl3", "_RawLogEntryImpl"),
|
||||
("DataLog_tmpl4", "_BooleanLogEntryImpl"),
|
||||
("DataLog_tmpl5", "_IntegerLogEntryImpl"),
|
||||
("DataLog_tmpl6", "_FloatLogEntryImpl"),
|
||||
("DataLog_tmpl7", "_DoubleLogEntryImpl"),
|
||||
("DataLog_tmpl8", "_StringLogEntryImpl"),
|
||||
("DataLog_tmpl9", "_BooleanArrayLogEntryImpl"),
|
||||
("DataLog_tmpl10", "_IntegerArrayLogEntryImpl"),
|
||||
("DataLog_tmpl11", "_FloatArrayLogEntryImpl"),
|
||||
("DataLog_tmpl12", "_DoubleArrayLogEntryImpl"),
|
||||
("DataLog_tmpl13", "_StringArrayLogEntryImpl"),
|
||||
],
|
||||
trampolines = [
|
||||
("wpi::log::DataLog", "wpi__log__DataLog.hpp"),
|
||||
("wpi::log::DataLogEntry", "wpi__log__DataLogEntry.hpp"),
|
||||
("wpi::log::DataLogValueEntryImpl", "wpi__log__DataLogValueEntryImpl.hpp"),
|
||||
("wpi::log::RawLogEntry", "wpi__log__RawLogEntry.hpp"),
|
||||
("wpi::log::BooleanLogEntry", "wpi__log__BooleanLogEntry.hpp"),
|
||||
("wpi::log::IntegerLogEntry", "wpi__log__IntegerLogEntry.hpp"),
|
||||
("wpi::log::FloatLogEntry", "wpi__log__FloatLogEntry.hpp"),
|
||||
("wpi::log::DoubleLogEntry", "wpi__log__DoubleLogEntry.hpp"),
|
||||
("wpi::log::StringLogEntry", "wpi__log__StringLogEntry.hpp"),
|
||||
("wpi::log::BooleanArrayLogEntry", "wpi__log__BooleanArrayLogEntry.hpp"),
|
||||
("wpi::log::IntegerArrayLogEntry", "wpi__log__IntegerArrayLogEntry.hpp"),
|
||||
("wpi::log::FloatArrayLogEntry", "wpi__log__FloatArrayLogEntry.hpp"),
|
||||
("wpi::log::DoubleArrayLogEntry", "wpi__log__DoubleArrayLogEntry.hpp"),
|
||||
("wpi::log::StringArrayLogEntry", "wpi__log__StringArrayLogEntry.hpp"),
|
||||
("wpi::log::StructLogEntry", "wpi__log__StructLogEntry.hpp"),
|
||||
("wpi::log::StructArrayLogEntry", "wpi__log__StructArrayLogEntry.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "DataLogBackgroundWriter",
|
||||
yml_file = "semiwrap/DataLogBackgroundWriter.yml",
|
||||
header_root = "$(execpath :robotpy-native-datalog.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-datalog.copy_headers)/wpi/datalog/DataLogBackgroundWriter.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::log::DataLogBackgroundWriter", "wpi__log__DataLogBackgroundWriter.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "DataLogReader",
|
||||
yml_file = "semiwrap/DataLogReader.yml",
|
||||
header_root = "$(execpath :robotpy-native-datalog.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-datalog.copy_headers)/wpi/datalog/DataLogReader.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::log::StartRecordData", "wpi__log__StartRecordData.hpp"),
|
||||
("wpi::log::MetadataRecordData", "wpi__log__MetadataRecordData.hpp"),
|
||||
("wpi::log::DataLogRecord", "wpi__log__DataLogRecord.hpp"),
|
||||
("wpi::log::DataLogReader", "wpi__log__DataLogReader.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "DataLogWriter",
|
||||
yml_file = "semiwrap/DataLogWriter.yml",
|
||||
header_root = "$(execpath :robotpy-native-datalog.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-datalog.copy_headers)/wpi/datalog/DataLogWriter.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::log::DataLogWriter", "wpi__log__DataLogWriter.hpp"),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
resolve_casters(
|
||||
name = "wpilog.resolve_casters",
|
||||
caster_deps = ["//wpiutil:src/main/python/wpiutil/wpiutil-casters.pybind11.json"],
|
||||
casters_pkl_file = "wpilog.casters.pkl",
|
||||
dep_file = "wpilog.casters.d",
|
||||
)
|
||||
|
||||
gen_libinit(
|
||||
name = "wpilog.gen_lib_init",
|
||||
output_file = "src/main/python/wpilog/_init__wpilog.py",
|
||||
modules = ["native.datalog._init_robotpy_native_datalog", "wpiutil._init__wpiutil"],
|
||||
)
|
||||
|
||||
gen_pkgconf(
|
||||
name = "wpilog.gen_pkgconf",
|
||||
libinit_py = "wpilog._init__wpilog",
|
||||
module_pkg_name = "wpilog._wpilog",
|
||||
output_file = "wpilog.pc",
|
||||
pkg_name = "wpilog",
|
||||
install_path = "src/main/python/wpilog",
|
||||
project_file = "src/main/python/pyproject.toml",
|
||||
package_root = "src/main/python/wpilog/__init__.py",
|
||||
)
|
||||
|
||||
gen_modinit_hpp(
|
||||
name = "wpilog.gen_modinit_hpp",
|
||||
input_dats = [x.class_name for x in WPILOG_HEADER_GEN],
|
||||
libname = "_wpilog",
|
||||
output_file = "semiwrap_init.wpilog._wpilog.hpp",
|
||||
)
|
||||
|
||||
run_header_gen(
|
||||
name = "wpilog",
|
||||
casters_pickle = "wpilog.casters.pkl",
|
||||
header_gen_config = WPILOG_HEADER_GEN,
|
||||
trampoline_subpath = "src/main/python/wpilog",
|
||||
deps = header_to_dat_deps,
|
||||
local_native_libraries = [
|
||||
"//datalog:robotpy-native-datalog.copy_headers",
|
||||
"//wpiutil:robotpy-native-wpiutil.copy_headers",
|
||||
],
|
||||
)
|
||||
|
||||
create_pybind_library(
|
||||
name = "wpilog",
|
||||
install_path = "src/main/python/wpilog/",
|
||||
extension_name = "_wpilog",
|
||||
generated_srcs = [":wpilog.generated_srcs"],
|
||||
semiwrap_header = [":wpilog.gen_modinit_hpp"],
|
||||
deps = [
|
||||
":wpilog.tmpl_hdrs",
|
||||
":wpilog.trampoline_hdrs",
|
||||
"//datalog:datalog",
|
||||
"//wpiutil:wpiutil",
|
||||
"//wpiutil:wpiutil_pybind_library",
|
||||
],
|
||||
dynamic_deps = [
|
||||
"//datalog:shared/datalog",
|
||||
"//wpiutil:shared/wpiutil",
|
||||
],
|
||||
extra_hdrs = extra_hdrs,
|
||||
extra_srcs = srcs,
|
||||
includes = includes,
|
||||
)
|
||||
|
||||
native.filegroup(
|
||||
name = "wpilog.generated_files",
|
||||
srcs = [
|
||||
"wpilog.gen_modinit_hpp.gen",
|
||||
"wpilog.header_gen_files",
|
||||
"wpilog.gen_pkgconf",
|
||||
"wpilog.gen_lib_init",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
)
|
||||
|
||||
def define_pybind_library(name, pkgcfgs = []):
|
||||
# Helper used to generate all files with one target.
|
||||
native.filegroup(
|
||||
name = "{}.generated_files".format(name),
|
||||
srcs = [
|
||||
"wpilog.generated_files",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Files that will be included in the wheel as data deps
|
||||
native.filegroup(
|
||||
name = "{}.generated_pkgcfg_files".format(name),
|
||||
srcs = [
|
||||
"src/main/python/wpilog/wpilog.pc",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Contains all of the non-python files that need to be included in the wheel
|
||||
native.filegroup(
|
||||
name = "{}.extra_files".format(name),
|
||||
srcs = native.glob(["src/main/python/wpilog/**"], exclude = ["src/main/python/wpilog/**/*.py"], allow_empty = True),
|
||||
tags = ["manual", "robotpy"],
|
||||
)
|
||||
|
||||
generate_version_file(
|
||||
name = "{}.generate_version".format(name),
|
||||
output_file = "src/main/python/wpilog/version.py",
|
||||
template = "//shared/bazel/rules/robotpy:version_template.in",
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
srcs = native.glob(["src/main/python/wpilog/**/*.py"]) + [
|
||||
"src/main/python/wpilog/_init__wpilog.py",
|
||||
"{}.generate_version".format(name),
|
||||
],
|
||||
data = [
|
||||
"{}.generated_pkgcfg_files".format(name),
|
||||
"{}.extra_files".format(name),
|
||||
":src/main/python/wpilog/_wpilog",
|
||||
":wpilog.trampoline_hdr_files",
|
||||
],
|
||||
imports = ["src/main/python"],
|
||||
deps = [
|
||||
"//datalog:robotpy-native-datalog",
|
||||
"//wpiutil:robotpy-wpiutil",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
update_yaml_files(
|
||||
name = "{}-update-yaml".format(name),
|
||||
yaml_output_directory = "src/main/python/semiwrap",
|
||||
extra_hdrs = native.glob(["src/main/python/**/*.h"], allow_empty = True) + [
|
||||
"//datalog:robotpy-native-datalog.copy_headers",
|
||||
"//wpiutil:robotpy-native-wpiutil.copy_headers",
|
||||
],
|
||||
package_root_file = "src/main/python/wpilog/__init__.py",
|
||||
pkgcfgs = pkgcfgs,
|
||||
pyproject_toml = "src/main/python/pyproject.toml",
|
||||
yaml_files = native.glob(["src/main/python/semiwrap/**"]),
|
||||
)
|
||||
|
||||
scan_headers(
|
||||
name = "{}-scan-headers".format(name),
|
||||
extra_hdrs = native.glob(["src/main/python/**/*.h"], allow_empty = True) + [
|
||||
"//datalog:robotpy-native-datalog.copy_headers",
|
||||
],
|
||||
package_root_file = "src/main/python/wpilog/__init__.py",
|
||||
pkgcfgs = pkgcfgs,
|
||||
pyproject_toml = "src/main/python/pyproject.toml",
|
||||
)
|
||||
@@ -1,13 +1,18 @@
|
||||
load("@allwpilib_pip_deps//:requirements.bzl", "requirement")
|
||||
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary")
|
||||
load("@rules_pkg//:mappings.bzl", "pkg_files")
|
||||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
load("//hal:generate.bzl", "generate_hal")
|
||||
load("//hal:robotpy_native_build_info.bzl", "define_native_wrapper")
|
||||
load("//hal:robotpy_pybind_build_info.bzl", "define_pybind_library", "hal_simulation_extension", "wpihal_extension")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "third_party_cc_lib_helper", "wpilib_cc_library", "wpilib_cc_shared_library", "wpilib_cc_static_library")
|
||||
load("//shared/bazel/rules:java_rules.bzl", "wpilib_java_junit5_test")
|
||||
load("//shared/bazel/rules:jni_rules.bzl", "wpilib_jni_cc_library", "wpilib_jni_java_library")
|
||||
load("//shared/bazel/rules:packaging.bzl", "package_minimal_jni_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")
|
||||
|
||||
filegroup(
|
||||
name = "doxygen-files",
|
||||
@@ -232,3 +237,60 @@ package_minimal_jni_project(
|
||||
maven_artifact_name = "hal-cpp",
|
||||
maven_group_id = "org.wpilib.hal",
|
||||
)
|
||||
|
||||
generate_robotpy_native_wrapper_build_info(
|
||||
name = "robotpy-native-wpihal-generator",
|
||||
pyproject_toml = "src/main/python/native-pyproject.toml",
|
||||
)
|
||||
|
||||
define_native_wrapper(
|
||||
name = "robotpy-native-wpihal",
|
||||
)
|
||||
|
||||
PYBIND_PKGCFG_DEPS = [
|
||||
"//datalog:native/datalog/robotpy-native-datalog.pc",
|
||||
"//datalog:robotpy-wpilog.generated_pkgcfg_files",
|
||||
"//hal:native/wpihal/robotpy-native-wpihal.pc",
|
||||
"//ntcore:native/ntcore/robotpy-native-ntcore.pc",
|
||||
"//ntcore:pyntcore.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",
|
||||
]
|
||||
|
||||
generate_robotpy_pybind_build_info(
|
||||
name = "robotpy-hal-generator",
|
||||
additional_srcs = [":robotpy-native-wpihal.copy_headers"],
|
||||
package_root_file = "src/main/python/hal/__init__.py",
|
||||
pkgcfgs = PYBIND_PKGCFG_DEPS,
|
||||
yaml_files = glob(["src/main/python/semiwrap/**/*.yml"]),
|
||||
)
|
||||
|
||||
hal_simulation_extension(
|
||||
srcs = glob(["src/main/python/hal/simulation/*.cpp"]),
|
||||
extra_hdrs = glob(["src/main/python/hal/simulation/*.h"]),
|
||||
includes = ["src/main/python/hal/simulation"],
|
||||
)
|
||||
|
||||
wpihal_extension(
|
||||
srcs = ["src/main/python/hal/src/hal.cpp"],
|
||||
extra_hdrs = ["src/main/python/hal/src/ds_types_fmt.h"],
|
||||
includes = [
|
||||
"src/main/python/hal",
|
||||
],
|
||||
)
|
||||
|
||||
define_pybind_library(
|
||||
name = "robotpy-hal",
|
||||
pkgcfgs = PYBIND_PKGCFG_DEPS,
|
||||
)
|
||||
|
||||
robotpy_py_test(
|
||||
"python_tests",
|
||||
srcs = glob(["src/test/python/**/*.py"]),
|
||||
deps = [
|
||||
":robotpy-hal",
|
||||
requirement("pytest"),
|
||||
],
|
||||
)
|
||||
|
||||
36
hal/robotpy_native_build_info.bzl
generated
Normal file
36
hal/robotpy_native_build_info.bzl
generated
Normal file
@@ -0,0 +1,36 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "native_wrappery_library")
|
||||
|
||||
def define_native_wrapper(name, pyproject_toml = None):
|
||||
copy_to_directory(
|
||||
name = "{}.copy_headers".format(name),
|
||||
srcs = native.glob(["src/main/native/include/**"]) + native.glob(["src/generated/main/native/include/**"], allow_empty = True),
|
||||
out = "native/wpihal/include",
|
||||
root_paths = ["src/main/native/include/"],
|
||||
replace_prefixes = {
|
||||
"hal/src/generated/main/native/include": "",
|
||||
"hal/src/main/native/include": "",
|
||||
},
|
||||
verbose = False,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
native_wrappery_library(
|
||||
name = name,
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml",
|
||||
libinit_file = "native/wpihal/_init_robotpy_native_wpihal.py",
|
||||
pc_file = "native/wpihal/robotpy-native-wpihal.pc",
|
||||
pc_deps = [
|
||||
"//ntcore:native/ntcore/robotpy-native-ntcore.pc",
|
||||
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
|
||||
],
|
||||
deps = [
|
||||
"//ntcore:robotpy-native-ntcore",
|
||||
"//wpiutil:robotpy-native-wpiutil",
|
||||
],
|
||||
headers = "{}.copy_headers".format(name),
|
||||
native_shared_library = "shared/wpiHal",
|
||||
install_path = "native/wpihal/",
|
||||
)
|
||||
665
hal/robotpy_pybind_build_info.bzl
generated
Normal file
665
hal/robotpy_pybind_build_info.bzl
generated
Normal file
@@ -0,0 +1,665 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
|
||||
def hal_simulation_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
HAL_SIMULATION_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "AddressableLEDData",
|
||||
yml_file = "semiwrap/simulation/AddressableLEDData.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/AddressableLEDData.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "AnalogInData",
|
||||
yml_file = "semiwrap/simulation/AnalogInData.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/AnalogInData.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "CTREPCMData",
|
||||
yml_file = "semiwrap/simulation/CTREPCMData.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/CTREPCMData.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "DIOData",
|
||||
yml_file = "semiwrap/simulation/DIOData.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/DIOData.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "DigitalPWMData",
|
||||
yml_file = "semiwrap/simulation/DigitalPWMData.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/DigitalPWMData.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "DriverStationData",
|
||||
yml_file = "semiwrap/simulation/DriverStationData.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/DriverStationData.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "DutyCycleData",
|
||||
yml_file = "semiwrap/simulation/DutyCycleData.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/DutyCycleData.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "EncoderData",
|
||||
yml_file = "semiwrap/simulation/EncoderData.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/EncoderData.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "MockHooks",
|
||||
yml_file = "semiwrap/simulation/MockHooks.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/MockHooks.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "NotifierData",
|
||||
yml_file = "semiwrap/simulation/NotifierData.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/NotifierData.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("HALSIM_NotifierInfo", "__HALSIM_NotifierInfo.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "PWMData",
|
||||
yml_file = "semiwrap/simulation/PWMData.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/PWMData.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "PowerDistributionData",
|
||||
yml_file = "semiwrap/simulation/PowerDistributionData.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/PowerDistributionData.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "REVPHData",
|
||||
yml_file = "semiwrap/simulation/REVPHData.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/REVPHData.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "Reset",
|
||||
yml_file = "semiwrap/simulation/Reset.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/Reset.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "RoboRioData",
|
||||
yml_file = "semiwrap/simulation/RoboRioData.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/RoboRioData.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "SimDeviceData",
|
||||
yml_file = "semiwrap/simulation/SimDeviceData.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/SimDeviceData.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
]
|
||||
|
||||
resolve_casters(
|
||||
name = "hal_simulation.resolve_casters",
|
||||
caster_deps = ["//wpiutil:src/main/python/wpiutil/wpiutil-casters.pybind11.json"],
|
||||
casters_pkl_file = "hal_simulation.casters.pkl",
|
||||
dep_file = "hal_simulation.casters.d",
|
||||
)
|
||||
|
||||
gen_libinit(
|
||||
name = "hal_simulation.gen_lib_init",
|
||||
output_file = "src/main/python/hal/simulation/_init__simulation.py",
|
||||
modules = ["native.wpihal._init_robotpy_native_wpihal", "wpiutil._init__wpiutil", "ntcore._init__ntcore"],
|
||||
)
|
||||
|
||||
gen_pkgconf(
|
||||
name = "hal_simulation.gen_pkgconf",
|
||||
libinit_py = "hal.simulation._init__simulation",
|
||||
module_pkg_name = "hal.simulation._simulation",
|
||||
output_file = "hal_simulation.pc",
|
||||
pkg_name = "hal_simulation",
|
||||
install_path = "src/main/python/hal/simulation",
|
||||
project_file = "src/main/python/pyproject.toml",
|
||||
package_root = "src/main/python/hal/__init__.py",
|
||||
)
|
||||
|
||||
gen_modinit_hpp(
|
||||
name = "hal_simulation.gen_modinit_hpp",
|
||||
input_dats = [x.class_name for x in HAL_SIMULATION_HEADER_GEN],
|
||||
libname = "_simulation",
|
||||
output_file = "semiwrap_init.hal.simulation._simulation.hpp",
|
||||
)
|
||||
|
||||
run_header_gen(
|
||||
name = "hal_simulation",
|
||||
casters_pickle = "hal_simulation.casters.pkl",
|
||||
header_gen_config = HAL_SIMULATION_HEADER_GEN,
|
||||
trampoline_subpath = "src/main/python/hal/simulation",
|
||||
deps = header_to_dat_deps,
|
||||
local_native_libraries = [
|
||||
"//datalog:robotpy-native-datalog.copy_headers",
|
||||
"//hal:robotpy-native-wpihal.copy_headers",
|
||||
"//ntcore:robotpy-native-ntcore.copy_headers",
|
||||
"//wpinet:robotpy-native-wpinet.copy_headers",
|
||||
"//wpiutil:robotpy-native-wpiutil.copy_headers",
|
||||
],
|
||||
)
|
||||
|
||||
create_pybind_library(
|
||||
name = "hal_simulation",
|
||||
install_path = "src/main/python/hal/simulation/",
|
||||
extension_name = "_simulation",
|
||||
generated_srcs = [":hal_simulation.generated_srcs"],
|
||||
semiwrap_header = [":hal_simulation.gen_modinit_hpp"],
|
||||
deps = [
|
||||
":hal_simulation.tmpl_hdrs",
|
||||
":hal_simulation.trampoline_hdrs",
|
||||
"//hal:wpiHal",
|
||||
"//ntcore:ntcore",
|
||||
"//ntcore:ntcore_pybind_library",
|
||||
"//wpiutil:wpiutil",
|
||||
"//wpiutil:wpiutil_pybind_library",
|
||||
],
|
||||
dynamic_deps = [
|
||||
"//hal:shared/wpiHal",
|
||||
"//ntcore:shared/ntcore",
|
||||
"//wpiutil:shared/wpiutil",
|
||||
],
|
||||
extra_hdrs = extra_hdrs,
|
||||
extra_srcs = srcs,
|
||||
includes = includes,
|
||||
)
|
||||
|
||||
native.filegroup(
|
||||
name = "hal_simulation.generated_files",
|
||||
srcs = [
|
||||
"hal_simulation.gen_modinit_hpp.gen",
|
||||
"hal_simulation.header_gen_files",
|
||||
"hal_simulation.gen_pkgconf",
|
||||
"hal_simulation.gen_lib_init",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
)
|
||||
|
||||
def wpihal_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
WPIHAL_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "AddressableLED",
|
||||
yml_file = "semiwrap/AddressableLED.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/AddressableLED.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "AddressableLEDTypes",
|
||||
yml_file = "semiwrap/AddressableLEDTypes.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/AddressableLEDTypes.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("HAL_AddressableLEDData", "__HAL_AddressableLEDData.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "AnalogInput",
|
||||
yml_file = "semiwrap/AnalogInput.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/AnalogInput.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "CAN",
|
||||
yml_file = "semiwrap/CAN.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/CAN.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("HAL_CANStreamMessage", "__HAL_CANStreamMessage.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "CANAPI",
|
||||
yml_file = "semiwrap/CANAPI.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/CANAPI.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "CANAPITypes",
|
||||
yml_file = "semiwrap/CANAPITypes.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/CANAPITypes.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("HAL_CANMessage", "__HAL_CANMessage.hpp"),
|
||||
("HAL_CANReceiveMessage", "__HAL_CANReceiveMessage.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "CTREPCM",
|
||||
yml_file = "semiwrap/CTREPCM.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/CTREPCM.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "Constants",
|
||||
yml_file = "semiwrap/Constants.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/Constants.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "Counter",
|
||||
yml_file = "semiwrap/Counter.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/Counter.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "DIO",
|
||||
yml_file = "semiwrap/DIO.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/DIO.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "DriverStation",
|
||||
yml_file = "semiwrap/DriverStation.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/DriverStation.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "DriverStationTypes",
|
||||
yml_file = "semiwrap/DriverStationTypes.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/DriverStationTypes.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("HAL_ControlWord", "__HAL_ControlWord.hpp"),
|
||||
("HAL_JoystickAxes", "__HAL_JoystickAxes.hpp"),
|
||||
("HAL_JoystickPOVs", "__HAL_JoystickPOVs.hpp"),
|
||||
("HAL_JoystickButtons", "__HAL_JoystickButtons.hpp"),
|
||||
("HAL_JoystickDescriptor", "__HAL_JoystickDescriptor.hpp"),
|
||||
("HAL_MatchInfo", "__HAL_MatchInfo.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "DutyCycle",
|
||||
yml_file = "semiwrap/DutyCycle.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/DutyCycle.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "Encoder",
|
||||
yml_file = "semiwrap/Encoder.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/Encoder.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "Extensions",
|
||||
yml_file = "semiwrap/Extensions.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/Extensions.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "HALBase",
|
||||
yml_file = "semiwrap/HALBase.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/HALBase.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "I2C",
|
||||
yml_file = "semiwrap/I2C.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/I2C.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "I2CTypes",
|
||||
yml_file = "semiwrap/I2CTypes.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/I2CTypes.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "Main",
|
||||
yml_file = "semiwrap/Main.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/Main.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "Notifier",
|
||||
yml_file = "semiwrap/Notifier.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/Notifier.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "PWM",
|
||||
yml_file = "semiwrap/PWM.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/PWM.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "Ports",
|
||||
yml_file = "semiwrap/Ports.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/Ports.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "Power",
|
||||
yml_file = "semiwrap/Power.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/Power.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "PowerDistribution",
|
||||
yml_file = "semiwrap/PowerDistribution.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/PowerDistribution.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("HAL_PowerDistributionVersion", "__HAL_PowerDistributionVersion.hpp"),
|
||||
("HAL_PowerDistributionFaults", "__HAL_PowerDistributionFaults.hpp"),
|
||||
("HAL_PowerDistributionStickyFaults", "__HAL_PowerDistributionStickyFaults.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "REVPH",
|
||||
yml_file = "semiwrap/REVPH.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/REVPH.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("HAL_REVPHVersion", "__HAL_REVPHVersion.hpp"),
|
||||
("HAL_REVPHCompressorConfig", "__HAL_REVPHCompressorConfig.hpp"),
|
||||
("HAL_REVPHFaults", "__HAL_REVPHFaults.hpp"),
|
||||
("HAL_REVPHStickyFaults", "__HAL_REVPHStickyFaults.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "SerialPort",
|
||||
yml_file = "semiwrap/SerialPort.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/SerialPort.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "SimDevice",
|
||||
yml_file = "semiwrap/SimDevice.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/SimDevice.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::hal::SimValue", "wpi__hal__SimValue.hpp"),
|
||||
("wpi::hal::SimInt", "wpi__hal__SimInt.hpp"),
|
||||
("wpi::hal::SimLong", "wpi__hal__SimLong.hpp"),
|
||||
("wpi::hal::SimDouble", "wpi__hal__SimDouble.hpp"),
|
||||
("wpi::hal::SimEnum", "wpi__hal__SimEnum.hpp"),
|
||||
("wpi::hal::SimBoolean", "wpi__hal__SimBoolean.hpp"),
|
||||
("wpi::hal::SimDevice", "wpi__hal__SimDevice.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "UsageReporting",
|
||||
yml_file = "semiwrap/UsageReporting.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/UsageReporting.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "Threads",
|
||||
yml_file = "semiwrap/Threads.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/Threads.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "HandlesInternal",
|
||||
yml_file = "semiwrap/HandlesInternal.yml",
|
||||
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/handles/HandlesInternal.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
]
|
||||
|
||||
resolve_casters(
|
||||
name = "wpihal.resolve_casters",
|
||||
caster_deps = ["//wpiutil:src/main/python/wpiutil/wpiutil-casters.pybind11.json"],
|
||||
casters_pkl_file = "wpihal.casters.pkl",
|
||||
dep_file = "wpihal.casters.d",
|
||||
)
|
||||
|
||||
gen_libinit(
|
||||
name = "wpihal.gen_lib_init",
|
||||
output_file = "src/main/python/hal/_init__wpiHal.py",
|
||||
modules = ["native.wpihal._init_robotpy_native_wpihal", "wpiutil._init__wpiutil", "ntcore._init__ntcore"],
|
||||
)
|
||||
|
||||
gen_pkgconf(
|
||||
name = "wpihal.gen_pkgconf",
|
||||
libinit_py = "hal._init__wpiHal",
|
||||
module_pkg_name = "hal._wpiHal",
|
||||
output_file = "wpihal.pc",
|
||||
pkg_name = "wpihal",
|
||||
install_path = "src/main/python/hal",
|
||||
project_file = "src/main/python/pyproject.toml",
|
||||
package_root = "src/main/python/hal/__init__.py",
|
||||
)
|
||||
|
||||
gen_modinit_hpp(
|
||||
name = "wpihal.gen_modinit_hpp",
|
||||
input_dats = [x.class_name for x in WPIHAL_HEADER_GEN],
|
||||
libname = "_wpiHal",
|
||||
output_file = "semiwrap_init.hal._wpiHal.hpp",
|
||||
)
|
||||
|
||||
run_header_gen(
|
||||
name = "wpihal",
|
||||
casters_pickle = "wpihal.casters.pkl",
|
||||
header_gen_config = WPIHAL_HEADER_GEN,
|
||||
trampoline_subpath = "src/main/python/hal",
|
||||
deps = header_to_dat_deps,
|
||||
local_native_libraries = [
|
||||
"//datalog:robotpy-native-datalog.copy_headers",
|
||||
"//hal:robotpy-native-wpihal.copy_headers",
|
||||
"//ntcore:robotpy-native-ntcore.copy_headers",
|
||||
"//wpinet:robotpy-native-wpinet.copy_headers",
|
||||
"//wpiutil:robotpy-native-wpiutil.copy_headers",
|
||||
],
|
||||
)
|
||||
|
||||
create_pybind_library(
|
||||
name = "wpihal",
|
||||
install_path = "src/main/python/hal/",
|
||||
extension_name = "_wpiHal",
|
||||
generated_srcs = [":wpihal.generated_srcs"],
|
||||
semiwrap_header = [":wpihal.gen_modinit_hpp"],
|
||||
deps = [
|
||||
":wpihal.tmpl_hdrs",
|
||||
":wpihal.trampoline_hdrs",
|
||||
"//hal:wpiHal",
|
||||
"//ntcore:ntcore",
|
||||
"//ntcore:ntcore_pybind_library",
|
||||
"//wpiutil:wpiutil",
|
||||
"//wpiutil:wpiutil_pybind_library",
|
||||
],
|
||||
dynamic_deps = [
|
||||
"//hal:shared/wpiHal",
|
||||
"//ntcore:shared/ntcore",
|
||||
"//wpiutil:shared/wpiutil",
|
||||
],
|
||||
extra_hdrs = extra_hdrs,
|
||||
extra_srcs = srcs,
|
||||
includes = includes,
|
||||
)
|
||||
|
||||
native.filegroup(
|
||||
name = "wpihal.generated_files",
|
||||
srcs = [
|
||||
"wpihal.gen_modinit_hpp.gen",
|
||||
"wpihal.header_gen_files",
|
||||
"wpihal.gen_pkgconf",
|
||||
"wpihal.gen_lib_init",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
)
|
||||
|
||||
def define_pybind_library(name, pkgcfgs = []):
|
||||
# Helper used to generate all files with one target.
|
||||
native.filegroup(
|
||||
name = "{}.generated_files".format(name),
|
||||
srcs = [
|
||||
"hal_simulation.generated_files",
|
||||
"wpihal.generated_files",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Files that will be included in the wheel as data deps
|
||||
native.filegroup(
|
||||
name = "{}.generated_pkgcfg_files".format(name),
|
||||
srcs = [
|
||||
"src/main/python/hal/simulation/hal_simulation.pc",
|
||||
"src/main/python/hal/wpihal.pc",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Contains all of the non-python files that need to be included in the wheel
|
||||
native.filegroup(
|
||||
name = "{}.extra_files".format(name),
|
||||
srcs = native.glob(["src/main/python/hal/**"], exclude = ["src/main/python/hal/**/*.py"], allow_empty = True),
|
||||
tags = ["manual", "robotpy"],
|
||||
)
|
||||
|
||||
generate_version_file(
|
||||
name = "{}.generate_version".format(name),
|
||||
output_file = "src/main/python/hal/version.py",
|
||||
template = "//shared/bazel/rules/robotpy:version_template.in",
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
srcs = native.glob(["src/main/python/hal/**/*.py"]) + [
|
||||
"src/main/python/hal/simulation/_init__simulation.py",
|
||||
"src/main/python/hal/_init__wpiHal.py",
|
||||
"{}.generate_version".format(name),
|
||||
],
|
||||
data = [
|
||||
"{}.generated_pkgcfg_files".format(name),
|
||||
"{}.extra_files".format(name),
|
||||
":src/main/python/hal/simulation/_simulation",
|
||||
":src/main/python/hal/_wpiHal",
|
||||
":hal_simulation.trampoline_hdr_files",
|
||||
":wpihal.trampoline_hdr_files",
|
||||
],
|
||||
imports = ["src/main/python"],
|
||||
deps = [
|
||||
"//hal:robotpy-native-wpihal",
|
||||
"//ntcore:pyntcore",
|
||||
"//wpiutil:robotpy-wpiutil",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
update_yaml_files(
|
||||
name = "{}-update-yaml".format(name),
|
||||
yaml_output_directory = "src/main/python/semiwrap",
|
||||
extra_hdrs = native.glob(["src/main/python/**/*.h"], allow_empty = True) + [
|
||||
"//datalog:robotpy-native-datalog.copy_headers",
|
||||
"//hal:robotpy-native-wpihal.copy_headers",
|
||||
"//ntcore:robotpy-native-ntcore.copy_headers",
|
||||
"//wpinet:robotpy-native-wpinet.copy_headers",
|
||||
"//wpiutil:robotpy-native-wpiutil.copy_headers",
|
||||
],
|
||||
package_root_file = "src/main/python/hal/__init__.py",
|
||||
pkgcfgs = pkgcfgs,
|
||||
pyproject_toml = "src/main/python/pyproject.toml",
|
||||
yaml_files = native.glob(["src/main/python/semiwrap/**"]),
|
||||
)
|
||||
|
||||
scan_headers(
|
||||
name = "{}-scan-headers".format(name),
|
||||
extra_hdrs = native.glob(["src/main/python/**/*.h"], allow_empty = True) + [
|
||||
"//hal:robotpy-native-wpihal.copy_headers",
|
||||
],
|
||||
package_root_file = "src/main/python/hal/__init__.py",
|
||||
pkgcfgs = pkgcfgs,
|
||||
pyproject_toml = "src/main/python/pyproject.toml",
|
||||
)
|
||||
@@ -4,10 +4,14 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary")
|
||||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
load("//ntcore:generate_ntcore.bzl", "generate_ntcore")
|
||||
load("//ntcore:robotpy_native_build_info.bzl", "define_native_wrapper")
|
||||
load("//ntcore:robotpy_pybind_build_info.bzl", "define_pybind_library", "ntcore_extension")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "third_party_cc_lib_helper", "wpilib_cc_library", "wpilib_cc_shared_library", "wpilib_cc_static_library")
|
||||
load("//shared/bazel/rules:java_rules.bzl", "wpilib_java_junit5_test")
|
||||
load("//shared/bazel/rules:jni_rules.bzl", "wpilib_jni_cc_library", "wpilib_jni_java_library")
|
||||
load("//shared/bazel/rules:packaging.bzl", "package_default_jni_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")
|
||||
|
||||
filegroup(
|
||||
name = "doxygen-files",
|
||||
@@ -224,3 +228,56 @@ package_default_jni_project(
|
||||
maven_artifact_name = "ntcore-cpp",
|
||||
maven_group_id = "org.wpilib.ntcore",
|
||||
)
|
||||
|
||||
generate_robotpy_native_wrapper_build_info(
|
||||
name = "robotpy-native-ntcore-generator",
|
||||
pyproject_toml = "src/main/python/native-pyproject.toml",
|
||||
)
|
||||
|
||||
define_native_wrapper(
|
||||
name = "robotpy-native-ntcore",
|
||||
pyproject_toml = "src/main/python/native-pyproject.toml",
|
||||
)
|
||||
|
||||
PYBIND_PKGCFG_DEPS = [
|
||||
"//datalog:native/datalog/robotpy-native-datalog.pc",
|
||||
"//datalog:robotpy-wpilog.generated_pkgcfg_files",
|
||||
"//ntcore:native/ntcore/robotpy-native-ntcore.pc",
|
||||
"//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",
|
||||
]
|
||||
|
||||
generate_robotpy_pybind_build_info(
|
||||
name = "pyntcore-generator",
|
||||
additional_srcs = [":robotpy-native-ntcore.copy_headers"],
|
||||
package_root_file = "src/main/python/ntcore/__init__.py",
|
||||
pkgcfgs = PYBIND_PKGCFG_DEPS,
|
||||
yaml_files = glob(["src/main/python/semiwrap/*.yml"]),
|
||||
)
|
||||
|
||||
ntcore_extension(
|
||||
srcs = glob(["src/main/python/ntcore/src/*.cpp"]),
|
||||
extra_hdrs = glob([
|
||||
"src/main/python/ntcore/src/*.h",
|
||||
"src/main/python/ntcore/src/*.inl",
|
||||
]),
|
||||
includes = [
|
||||
"src/main/python/ntcore/",
|
||||
],
|
||||
)
|
||||
|
||||
define_pybind_library(
|
||||
name = "pyntcore",
|
||||
pkgcfgs = PYBIND_PKGCFG_DEPS,
|
||||
)
|
||||
|
||||
robotpy_py_test(
|
||||
"python_tests",
|
||||
srcs = glob(["src/test/python/**/*.py"]),
|
||||
deps = [
|
||||
":pyntcore",
|
||||
requirement("pytest"),
|
||||
],
|
||||
)
|
||||
|
||||
38
ntcore/robotpy_native_build_info.bzl
generated
Normal file
38
ntcore/robotpy_native_build_info.bzl
generated
Normal file
@@ -0,0 +1,38 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "native_wrappery_library")
|
||||
|
||||
def define_native_wrapper(name, pyproject_toml = None):
|
||||
copy_to_directory(
|
||||
name = "{}.copy_headers".format(name),
|
||||
srcs = native.glob(["src/main/native/include/**"]) + native.glob(["src/generated/main/native/include/**"], allow_empty = True),
|
||||
out = "native/ntcore/include",
|
||||
root_paths = ["src/main/native/include/"],
|
||||
replace_prefixes = {
|
||||
"ntcore/src/generated/main/native/include": "",
|
||||
"ntcore/src/main/native/include": "",
|
||||
},
|
||||
verbose = False,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
native_wrappery_library(
|
||||
name = name,
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml",
|
||||
libinit_file = "native/ntcore/_init_robotpy_native_ntcore.py",
|
||||
pc_file = "native/ntcore/robotpy-native-ntcore.pc",
|
||||
pc_deps = [
|
||||
"//datalog:native/datalog/robotpy-native-datalog.pc",
|
||||
"//wpinet:native/wpinet/robotpy-native-wpinet.pc",
|
||||
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
|
||||
],
|
||||
deps = [
|
||||
"//datalog:robotpy-native-datalog",
|
||||
"//wpinet:robotpy-native-wpinet",
|
||||
"//wpiutil:robotpy-native-wpiutil",
|
||||
],
|
||||
headers = "{}.copy_headers".format(name),
|
||||
native_shared_library = "shared/ntcore",
|
||||
install_path = "native/ntcore/",
|
||||
)
|
||||
514
ntcore/robotpy_pybind_build_info.bzl
generated
Normal file
514
ntcore/robotpy_pybind_build_info.bzl
generated
Normal file
@@ -0,0 +1,514 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
|
||||
def ntcore_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
NTCORE_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "BooleanArrayTopic",
|
||||
yml_file = "semiwrap/BooleanArrayTopic.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/BooleanArrayTopic.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::BooleanArraySubscriber", "wpi__nt__BooleanArraySubscriber.hpp"),
|
||||
("wpi::nt::BooleanArrayPublisher", "wpi__nt__BooleanArrayPublisher.hpp"),
|
||||
("wpi::nt::BooleanArrayEntry", "wpi__nt__BooleanArrayEntry.hpp"),
|
||||
("wpi::nt::BooleanArrayTopic", "wpi__nt__BooleanArrayTopic.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "BooleanTopic",
|
||||
yml_file = "semiwrap/BooleanTopic.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/BooleanTopic.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::BooleanSubscriber", "wpi__nt__BooleanSubscriber.hpp"),
|
||||
("wpi::nt::BooleanPublisher", "wpi__nt__BooleanPublisher.hpp"),
|
||||
("wpi::nt::BooleanEntry", "wpi__nt__BooleanEntry.hpp"),
|
||||
("wpi::nt::BooleanTopic", "wpi__nt__BooleanTopic.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "DoubleArrayTopic",
|
||||
yml_file = "semiwrap/DoubleArrayTopic.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/DoubleArrayTopic.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::DoubleArraySubscriber", "wpi__nt__DoubleArraySubscriber.hpp"),
|
||||
("wpi::nt::DoubleArrayPublisher", "wpi__nt__DoubleArrayPublisher.hpp"),
|
||||
("wpi::nt::DoubleArrayEntry", "wpi__nt__DoubleArrayEntry.hpp"),
|
||||
("wpi::nt::DoubleArrayTopic", "wpi__nt__DoubleArrayTopic.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "DoubleTopic",
|
||||
yml_file = "semiwrap/DoubleTopic.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/DoubleTopic.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::DoubleSubscriber", "wpi__nt__DoubleSubscriber.hpp"),
|
||||
("wpi::nt::DoublePublisher", "wpi__nt__DoublePublisher.hpp"),
|
||||
("wpi::nt::DoubleEntry", "wpi__nt__DoubleEntry.hpp"),
|
||||
("wpi::nt::DoubleTopic", "wpi__nt__DoubleTopic.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "FloatArrayTopic",
|
||||
yml_file = "semiwrap/FloatArrayTopic.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/FloatArrayTopic.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::FloatArraySubscriber", "wpi__nt__FloatArraySubscriber.hpp"),
|
||||
("wpi::nt::FloatArrayPublisher", "wpi__nt__FloatArrayPublisher.hpp"),
|
||||
("wpi::nt::FloatArrayEntry", "wpi__nt__FloatArrayEntry.hpp"),
|
||||
("wpi::nt::FloatArrayTopic", "wpi__nt__FloatArrayTopic.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "FloatTopic",
|
||||
yml_file = "semiwrap/FloatTopic.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/FloatTopic.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::FloatSubscriber", "wpi__nt__FloatSubscriber.hpp"),
|
||||
("wpi::nt::FloatPublisher", "wpi__nt__FloatPublisher.hpp"),
|
||||
("wpi::nt::FloatEntry", "wpi__nt__FloatEntry.hpp"),
|
||||
("wpi::nt::FloatTopic", "wpi__nt__FloatTopic.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "GenericEntry",
|
||||
yml_file = "semiwrap/GenericEntry.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/GenericEntry.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::GenericSubscriber", "wpi__nt__GenericSubscriber.hpp"),
|
||||
("wpi::nt::GenericPublisher", "wpi__nt__GenericPublisher.hpp"),
|
||||
("wpi::nt::GenericEntry", "wpi__nt__GenericEntry.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "IntegerArrayTopic",
|
||||
yml_file = "semiwrap/IntegerArrayTopic.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/IntegerArrayTopic.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::IntegerArraySubscriber", "wpi__nt__IntegerArraySubscriber.hpp"),
|
||||
("wpi::nt::IntegerArrayPublisher", "wpi__nt__IntegerArrayPublisher.hpp"),
|
||||
("wpi::nt::IntegerArrayEntry", "wpi__nt__IntegerArrayEntry.hpp"),
|
||||
("wpi::nt::IntegerArrayTopic", "wpi__nt__IntegerArrayTopic.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "IntegerTopic",
|
||||
yml_file = "semiwrap/IntegerTopic.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/IntegerTopic.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::IntegerSubscriber", "wpi__nt__IntegerSubscriber.hpp"),
|
||||
("wpi::nt::IntegerPublisher", "wpi__nt__IntegerPublisher.hpp"),
|
||||
("wpi::nt::IntegerEntry", "wpi__nt__IntegerEntry.hpp"),
|
||||
("wpi::nt::IntegerTopic", "wpi__nt__IntegerTopic.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "MultiSubscriber",
|
||||
yml_file = "semiwrap/MultiSubscriber.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/MultiSubscriber.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::MultiSubscriber", "wpi__nt__MultiSubscriber.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "NTSendable",
|
||||
yml_file = "semiwrap/NTSendable.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/NTSendable.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::NTSendable", "wpi__nt__NTSendable.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "NTSendableBuilder",
|
||||
yml_file = "semiwrap/NTSendableBuilder.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/NTSendableBuilder.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::NTSendableBuilder", "wpi__nt__NTSendableBuilder.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "NetworkTable",
|
||||
yml_file = "semiwrap/NetworkTable.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/NetworkTable.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::NetworkTable", "wpi__nt__NetworkTable.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "NetworkTableEntry",
|
||||
yml_file = "semiwrap/NetworkTableEntry.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/NetworkTableEntry.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::NetworkTableEntry", "wpi__nt__NetworkTableEntry.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "NetworkTableInstance",
|
||||
yml_file = "semiwrap/NetworkTableInstance.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/NetworkTableInstance.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::NetworkTableInstance", "wpi__nt__NetworkTableInstance.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "NetworkTableListener",
|
||||
yml_file = "semiwrap/NetworkTableListener.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/NetworkTableListener.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::NetworkTableListener", "wpi__nt__NetworkTableListener.hpp"),
|
||||
("wpi::nt::NetworkTableListenerPoller", "wpi__nt__NetworkTableListenerPoller.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "NetworkTableType",
|
||||
yml_file = "semiwrap/NetworkTableType.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/NetworkTableType.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [],
|
||||
),
|
||||
struct(
|
||||
class_name = "NetworkTableValue",
|
||||
yml_file = "semiwrap/NetworkTableValue.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/NetworkTableValue.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::Value", "wpi__nt__Value.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "RawTopic",
|
||||
yml_file = "semiwrap/RawTopic.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/RawTopic.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::RawSubscriber", "wpi__nt__RawSubscriber.hpp"),
|
||||
("wpi::nt::RawPublisher", "wpi__nt__RawPublisher.hpp"),
|
||||
("wpi::nt::RawEntry", "wpi__nt__RawEntry.hpp"),
|
||||
("wpi::nt::RawTopic", "wpi__nt__RawTopic.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "StructTopic",
|
||||
yml_file = "semiwrap/StructTopic.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/StructTopic.hpp",
|
||||
tmpl_class_names = [
|
||||
("StructTopic_tmpl1", "StructSubscriber"),
|
||||
("StructTopic_tmpl2", "StructPublisher"),
|
||||
("StructTopic_tmpl3", "StructEntry"),
|
||||
("StructTopic_tmpl4", "StructTopic"),
|
||||
],
|
||||
trampolines = [
|
||||
("wpi::nt::StructSubscriber", "wpi__nt__StructSubscriber.hpp"),
|
||||
("wpi::nt::StructPublisher", "wpi__nt__StructPublisher.hpp"),
|
||||
("wpi::nt::StructEntry", "wpi__nt__StructEntry.hpp"),
|
||||
("wpi::nt::StructTopic", "wpi__nt__StructTopic.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "StructArrayTopic",
|
||||
yml_file = "semiwrap/StructArrayTopic.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/StructArrayTopic.hpp",
|
||||
tmpl_class_names = [
|
||||
("StructArrayTopic_tmpl1", "StructArraySubscriber"),
|
||||
("StructArrayTopic_tmpl2", "StructArrayPublisher"),
|
||||
("StructArrayTopic_tmpl3", "StructArrayEntry"),
|
||||
("StructArrayTopic_tmpl4", "StructArrayTopic"),
|
||||
],
|
||||
trampolines = [
|
||||
("wpi::nt::StructArraySubscriber", "wpi__nt__StructArraySubscriber.hpp"),
|
||||
("wpi::nt::StructArrayPublisher", "wpi__nt__StructArrayPublisher.hpp"),
|
||||
("wpi::nt::StructArrayEntry", "wpi__nt__StructArrayEntry.hpp"),
|
||||
("wpi::nt::StructArrayTopic", "wpi__nt__StructArrayTopic.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "StringArrayTopic",
|
||||
yml_file = "semiwrap/StringArrayTopic.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/StringArrayTopic.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::StringArraySubscriber", "wpi__nt__StringArraySubscriber.hpp"),
|
||||
("wpi::nt::StringArrayPublisher", "wpi__nt__StringArrayPublisher.hpp"),
|
||||
("wpi::nt::StringArrayEntry", "wpi__nt__StringArrayEntry.hpp"),
|
||||
("wpi::nt::StringArrayTopic", "wpi__nt__StringArrayTopic.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "StringTopic",
|
||||
yml_file = "semiwrap/StringTopic.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/StringTopic.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::StringSubscriber", "wpi__nt__StringSubscriber.hpp"),
|
||||
("wpi::nt::StringPublisher", "wpi__nt__StringPublisher.hpp"),
|
||||
("wpi::nt::StringEntry", "wpi__nt__StringEntry.hpp"),
|
||||
("wpi::nt::StringTopic", "wpi__nt__StringTopic.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "Topic",
|
||||
yml_file = "semiwrap/Topic.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/Topic.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::Topic", "wpi__nt__Topic.hpp"),
|
||||
("wpi::nt::Subscriber", "wpi__nt__Subscriber.hpp"),
|
||||
("wpi::nt::Publisher", "wpi__nt__Publisher.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "ntcore_cpp",
|
||||
yml_file = "semiwrap/ntcore_cpp.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/ntcore_cpp.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::nt::EventFlags", "wpi__nt__EventFlags.hpp"),
|
||||
("wpi::nt::TopicInfo", "wpi__nt__TopicInfo.hpp"),
|
||||
("wpi::nt::ConnectionInfo", "wpi__nt__ConnectionInfo.hpp"),
|
||||
("wpi::nt::ValueEventData", "wpi__nt__ValueEventData.hpp"),
|
||||
("wpi::nt::LogMessage", "wpi__nt__LogMessage.hpp"),
|
||||
("wpi::nt::TimeSyncEventData", "wpi__nt__TimeSyncEventData.hpp"),
|
||||
("wpi::nt::Event", "wpi__nt__Event.hpp"),
|
||||
("wpi::nt::PubSubOptions", "wpi__nt__PubSubOptions.hpp"),
|
||||
("wpi::nt::meta::SubscriberOptions", "wpi__nt__meta__SubscriberOptions.hpp"),
|
||||
("wpi::nt::meta::TopicPublisher", "wpi__nt__meta__TopicPublisher.hpp"),
|
||||
("wpi::nt::meta::TopicSubscriber", "wpi__nt__meta__TopicSubscriber.hpp"),
|
||||
("wpi::nt::meta::ClientPublisher", "wpi__nt__meta__ClientPublisher.hpp"),
|
||||
("wpi::nt::meta::ClientSubscriber", "wpi__nt__meta__ClientSubscriber.hpp"),
|
||||
("wpi::nt::meta::Client", "wpi__nt__meta__Client.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "ntcore_cpp_types",
|
||||
yml_file = "semiwrap/ntcore_cpp_types.yml",
|
||||
header_root = "$(execpath :robotpy-native-ntcore.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-ntcore.copy_headers)/wpi/nt/ntcore_cpp_types.hpp",
|
||||
tmpl_class_names = [
|
||||
("ntcore_cpp_types_tmpl1", "TimestampedBoolean"),
|
||||
("ntcore_cpp_types_tmpl2", "TimestampedInteger"),
|
||||
("ntcore_cpp_types_tmpl3", "TimestampedFloat"),
|
||||
("ntcore_cpp_types_tmpl4", "TimestampedDouble"),
|
||||
("ntcore_cpp_types_tmpl5", "TimestampedString"),
|
||||
("ntcore_cpp_types_tmpl6", "TimestampedRaw"),
|
||||
("ntcore_cpp_types_tmpl7", "TimestampedBooleanArray"),
|
||||
("ntcore_cpp_types_tmpl8", "TimestampedIntegerArray"),
|
||||
("ntcore_cpp_types_tmpl9", "TimestampedFloatArray"),
|
||||
("ntcore_cpp_types_tmpl10", "TimestampedDoubleArray"),
|
||||
("ntcore_cpp_types_tmpl11", "TimestampedStringArray"),
|
||||
("ntcore_cpp_types_tmpl12", "TimestampedStruct"),
|
||||
("ntcore_cpp_types_tmpl13", "TimestampedStructArray"),
|
||||
],
|
||||
trampolines = [
|
||||
("wpi::nt::Timestamped", "wpi__nt__Timestamped.hpp"),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
resolve_casters(
|
||||
name = "ntcore.resolve_casters",
|
||||
caster_deps = ["//wpiutil:src/main/python/wpiutil/wpiutil-casters.pybind11.json"],
|
||||
casters_pkl_file = "ntcore.casters.pkl",
|
||||
dep_file = "ntcore.casters.d",
|
||||
)
|
||||
|
||||
gen_libinit(
|
||||
name = "ntcore.gen_lib_init",
|
||||
output_file = "src/main/python/ntcore/_init__ntcore.py",
|
||||
modules = ["native.ntcore._init_robotpy_native_ntcore", "wpiutil._init__wpiutil", "wpinet._init__wpinet", "wpilog._init__wpilog"],
|
||||
)
|
||||
|
||||
gen_pkgconf(
|
||||
name = "ntcore.gen_pkgconf",
|
||||
libinit_py = "ntcore._init__ntcore",
|
||||
module_pkg_name = "ntcore._ntcore",
|
||||
output_file = "ntcore.pc",
|
||||
pkg_name = "ntcore",
|
||||
install_path = "src/main/python/ntcore",
|
||||
project_file = "src/main/python/pyproject.toml",
|
||||
package_root = "src/main/python/ntcore/__init__.py",
|
||||
)
|
||||
|
||||
gen_modinit_hpp(
|
||||
name = "ntcore.gen_modinit_hpp",
|
||||
input_dats = [x.class_name for x in NTCORE_HEADER_GEN],
|
||||
libname = "_ntcore",
|
||||
output_file = "semiwrap_init.ntcore._ntcore.hpp",
|
||||
)
|
||||
|
||||
run_header_gen(
|
||||
name = "ntcore",
|
||||
casters_pickle = "ntcore.casters.pkl",
|
||||
header_gen_config = NTCORE_HEADER_GEN,
|
||||
trampoline_subpath = "src/main/python/ntcore",
|
||||
deps = header_to_dat_deps,
|
||||
local_native_libraries = [
|
||||
"//datalog:robotpy-native-datalog.copy_headers",
|
||||
"//ntcore:robotpy-native-ntcore.copy_headers",
|
||||
"//wpinet:robotpy-native-wpinet.copy_headers",
|
||||
"//wpiutil:robotpy-native-wpiutil.copy_headers",
|
||||
],
|
||||
)
|
||||
|
||||
create_pybind_library(
|
||||
name = "ntcore",
|
||||
install_path = "src/main/python/ntcore/",
|
||||
extension_name = "_ntcore",
|
||||
generated_srcs = [":ntcore.generated_srcs"],
|
||||
semiwrap_header = [":ntcore.gen_modinit_hpp"],
|
||||
deps = [
|
||||
":ntcore.tmpl_hdrs",
|
||||
":ntcore.trampoline_hdrs",
|
||||
"//datalog:datalog",
|
||||
"//datalog:wpilog_pybind_library",
|
||||
"//ntcore:ntcore",
|
||||
"//wpinet:wpinet",
|
||||
"//wpinet:wpinet_pybind_library",
|
||||
"//wpiutil:wpiutil",
|
||||
"//wpiutil:wpiutil_pybind_library",
|
||||
],
|
||||
dynamic_deps = [
|
||||
"//datalog:shared/datalog",
|
||||
"//ntcore:shared/ntcore",
|
||||
"//wpinet:shared/wpinet",
|
||||
"//wpiutil:shared/wpiutil",
|
||||
],
|
||||
extra_hdrs = extra_hdrs,
|
||||
extra_srcs = srcs,
|
||||
includes = includes,
|
||||
)
|
||||
|
||||
native.filegroup(
|
||||
name = "ntcore.generated_files",
|
||||
srcs = [
|
||||
"ntcore.gen_modinit_hpp.gen",
|
||||
"ntcore.header_gen_files",
|
||||
"ntcore.gen_pkgconf",
|
||||
"ntcore.gen_lib_init",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
)
|
||||
|
||||
def define_pybind_library(name, pkgcfgs = []):
|
||||
# Helper used to generate all files with one target.
|
||||
native.filegroup(
|
||||
name = "{}.generated_files".format(name),
|
||||
srcs = [
|
||||
"ntcore.generated_files",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Files that will be included in the wheel as data deps
|
||||
native.filegroup(
|
||||
name = "{}.generated_pkgcfg_files".format(name),
|
||||
srcs = [
|
||||
"src/main/python/ntcore/ntcore.pc",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Contains all of the non-python files that need to be included in the wheel
|
||||
native.filegroup(
|
||||
name = "{}.extra_files".format(name),
|
||||
srcs = native.glob(["src/main/python/ntcore/**"], exclude = ["src/main/python/ntcore/**/*.py"], allow_empty = True),
|
||||
tags = ["manual", "robotpy"],
|
||||
)
|
||||
|
||||
generate_version_file(
|
||||
name = "{}.generate_version".format(name),
|
||||
output_file = "src/main/python/ntcore/version.py",
|
||||
template = "//shared/bazel/rules/robotpy:version_template.in",
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
srcs = native.glob(["src/main/python/ntcore/**/*.py"]) + [
|
||||
"src/main/python/ntcore/_init__ntcore.py",
|
||||
"{}.generate_version".format(name),
|
||||
],
|
||||
data = [
|
||||
"{}.generated_pkgcfg_files".format(name),
|
||||
"{}.extra_files".format(name),
|
||||
":src/main/python/ntcore/_ntcore",
|
||||
":ntcore.trampoline_hdr_files",
|
||||
],
|
||||
imports = ["src/main/python"],
|
||||
deps = [
|
||||
"//datalog:robotpy-wpilog",
|
||||
"//ntcore:robotpy-native-ntcore",
|
||||
"//wpinet:robotpy-wpinet",
|
||||
"//wpiutil:robotpy-wpiutil",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
update_yaml_files(
|
||||
name = "{}-update-yaml".format(name),
|
||||
yaml_output_directory = "src/main/python/semiwrap",
|
||||
extra_hdrs = native.glob(["src/main/python/**/*.h"], allow_empty = True) + [
|
||||
"//datalog:robotpy-native-datalog.copy_headers",
|
||||
"//ntcore:robotpy-native-ntcore.copy_headers",
|
||||
"//wpinet:robotpy-native-wpinet.copy_headers",
|
||||
"//wpiutil:robotpy-native-wpiutil.copy_headers",
|
||||
],
|
||||
package_root_file = "src/main/python/ntcore/__init__.py",
|
||||
pkgcfgs = pkgcfgs,
|
||||
pyproject_toml = "src/main/python/pyproject.toml",
|
||||
yaml_files = native.glob(["src/main/python/semiwrap/**"]),
|
||||
)
|
||||
|
||||
scan_headers(
|
||||
name = "{}-scan-headers".format(name),
|
||||
extra_hdrs = native.glob(["src/main/python/**/*.h"], allow_empty = True) + [
|
||||
"//ntcore:robotpy-native-ntcore.copy_headers",
|
||||
],
|
||||
package_root_file = "src/main/python/ntcore/__init__.py",
|
||||
pkgcfgs = pkgcfgs,
|
||||
pyproject_toml = "src/main/python/pyproject.toml",
|
||||
)
|
||||
@@ -1,8 +1,13 @@
|
||||
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("//romiVendordep:robotpy_native_build_info.bzl", "define_native_wrapper")
|
||||
load("//romiVendordep:robotpy_pybind_build_info.bzl", "define_pybind_library", "romi_extension")
|
||||
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_minimal_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")
|
||||
|
||||
filegroup(
|
||||
name = "doxygen-files",
|
||||
@@ -101,3 +106,57 @@ package_minimal_cc_project(
|
||||
maven_artifact_name = "romiVendordep-cpp",
|
||||
maven_group_id = "org.wpilib.romiVendordep",
|
||||
)
|
||||
|
||||
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-romi",
|
||||
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-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",
|
||||
"//romiVendordep:native/romi/robotpy-native-romi.pc",
|
||||
]
|
||||
|
||||
generate_robotpy_pybind_build_info(
|
||||
name = "robotpy-romi-generator",
|
||||
additional_srcs = [":robotpy-native-romi.copy_headers"],
|
||||
package_root_file = "src/main/python/romi/__init__.py",
|
||||
pkgcfgs = PKG_CONFIG_DEPS,
|
||||
yaml_files = glob(["src/main/python/semiwrap/**/*.yml"]),
|
||||
)
|
||||
|
||||
romi_extension(
|
||||
srcs = ["src/main/python/romi/src/main.cpp"],
|
||||
)
|
||||
|
||||
define_pybind_library(
|
||||
name = "robotpy-romi",
|
||||
pkgcfgs = PKG_CONFIG_DEPS,
|
||||
)
|
||||
|
||||
robotpy_py_test(
|
||||
"python_tests",
|
||||
srcs = glob(["src/test/python/**/*.py"]),
|
||||
deps = [
|
||||
":robotpy-romi",
|
||||
requirement("pytest"),
|
||||
],
|
||||
)
|
||||
|
||||
34
romiVendordep/robotpy_native_build_info.bzl
generated
Normal file
34
romiVendordep/robotpy_native_build_info.bzl
generated
Normal file
@@ -0,0 +1,34 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "native_wrappery_library")
|
||||
|
||||
def define_native_wrapper(name, pyproject_toml = None):
|
||||
copy_to_directory(
|
||||
name = "{}.copy_headers".format(name),
|
||||
srcs = native.glob(["src/main/native/include/**"]) + native.glob(["src/generated/main/native/include/**"], allow_empty = True),
|
||||
out = "native/romi/include",
|
||||
root_paths = ["src/main/native/include/"],
|
||||
replace_prefixes = {
|
||||
"romiVendordep/src/generated/main/native/include": "",
|
||||
"romiVendordep/src/main/native/include": "",
|
||||
},
|
||||
verbose = False,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
native_wrappery_library(
|
||||
name = name,
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml",
|
||||
libinit_file = "native/romi/_init_robotpy_native_romi.py",
|
||||
pc_file = "native/romi/robotpy-native-romi.pc",
|
||||
pc_deps = [
|
||||
"//wpilibc:native/wpilib/robotpy-native-wpilib.pc",
|
||||
],
|
||||
deps = [
|
||||
"//wpilibc:robotpy-native-wpilib",
|
||||
],
|
||||
headers = "{}.copy_headers".format(name),
|
||||
native_shared_library = "shared/romiVendordep",
|
||||
install_path = "native/romi/",
|
||||
)
|
||||
208
romiVendordep/robotpy_pybind_build_info.bzl
generated
Normal file
208
romiVendordep/robotpy_pybind_build_info.bzl
generated
Normal file
@@ -0,0 +1,208 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
|
||||
def romi_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
ROMI_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "OnBoardIO",
|
||||
yml_file = "semiwrap/OnBoardIO.yml",
|
||||
header_root = "$(execpath :robotpy-native-romi.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-romi.copy_headers)/wpi/romi/OnBoardIO.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::romi::OnBoardIO", "wpi__romi__OnBoardIO.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "RomiGyro",
|
||||
yml_file = "semiwrap/RomiGyro.yml",
|
||||
header_root = "$(execpath :robotpy-native-romi.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-romi.copy_headers)/wpi/romi/RomiGyro.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::romi::RomiGyro", "wpi__romi__RomiGyro.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "RomiMotor",
|
||||
yml_file = "semiwrap/RomiMotor.yml",
|
||||
header_root = "$(execpath :robotpy-native-romi.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-romi.copy_headers)/wpi/romi/RomiMotor.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::romi::RomiMotor", "wpi__romi__RomiMotor.hpp"),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
resolve_casters(
|
||||
name = "romi.resolve_casters",
|
||||
caster_deps = ["//wpimath:src/main/python/wpimath/wpimath-casters.pybind11.json", "//wpiutil:src/main/python/wpiutil/wpiutil-casters.pybind11.json"],
|
||||
casters_pkl_file = "romi.casters.pkl",
|
||||
dep_file = "romi.casters.d",
|
||||
)
|
||||
|
||||
gen_libinit(
|
||||
name = "romi.gen_lib_init",
|
||||
output_file = "src/main/python/romi/_init__romi.py",
|
||||
modules = ["native.romi._init_robotpy_native_romi", "wpilib._init__wpilib", "wpimath.geometry._init__geometry"],
|
||||
)
|
||||
|
||||
gen_pkgconf(
|
||||
name = "romi.gen_pkgconf",
|
||||
libinit_py = "romi._init__romi",
|
||||
module_pkg_name = "romi._romi",
|
||||
output_file = "romi.pc",
|
||||
pkg_name = "romi",
|
||||
install_path = "src/main/python/romi",
|
||||
project_file = "src/main/python/pyproject.toml",
|
||||
package_root = "src/main/python/romi/__init__.py",
|
||||
)
|
||||
|
||||
gen_modinit_hpp(
|
||||
name = "romi.gen_modinit_hpp",
|
||||
input_dats = [x.class_name for x in ROMI_HEADER_GEN],
|
||||
libname = "_romi",
|
||||
output_file = "semiwrap_init.romi._romi.hpp",
|
||||
)
|
||||
|
||||
run_header_gen(
|
||||
name = "romi",
|
||||
casters_pickle = "romi.casters.pkl",
|
||||
header_gen_config = ROMI_HEADER_GEN,
|
||||
trampoline_subpath = "src/main/python/romi",
|
||||
deps = header_to_dat_deps,
|
||||
local_native_libraries = [
|
||||
"//datalog:robotpy-native-datalog.copy_headers",
|
||||
"//hal:robotpy-native-wpihal.copy_headers",
|
||||
"//ntcore:robotpy-native-ntcore.copy_headers",
|
||||
"//romiVendordep:robotpy-native-romi.copy_headers",
|
||||
"//wpilibc:robotpy-native-wpilib.copy_headers",
|
||||
"//wpimath:robotpy-native-wpimath.copy_headers",
|
||||
"//wpinet:robotpy-native-wpinet.copy_headers",
|
||||
"//wpiutil:robotpy-native-wpiutil.copy_headers",
|
||||
],
|
||||
)
|
||||
|
||||
create_pybind_library(
|
||||
name = "romi",
|
||||
install_path = "src/main/python/romi/",
|
||||
extension_name = "_romi",
|
||||
generated_srcs = [":romi.generated_srcs"],
|
||||
semiwrap_header = [":romi.gen_modinit_hpp"],
|
||||
deps = [
|
||||
":romi.tmpl_hdrs",
|
||||
":romi.trampoline_hdrs",
|
||||
"//romiVendordep:romiVendordep",
|
||||
"//wpilibc:wpilib_pybind_library",
|
||||
"//wpilibc:wpilibc",
|
||||
"//wpimath:wpimath",
|
||||
"//wpimath:wpimath_geometry_pybind_library",
|
||||
],
|
||||
dynamic_deps = [
|
||||
"//romiVendordep:shared/romiVendordep",
|
||||
"//wpilibc:shared/wpilibc",
|
||||
"//wpimath:shared/wpimath",
|
||||
],
|
||||
extra_hdrs = extra_hdrs,
|
||||
extra_srcs = srcs,
|
||||
includes = includes,
|
||||
)
|
||||
|
||||
native.filegroup(
|
||||
name = "romi.generated_files",
|
||||
srcs = [
|
||||
"romi.gen_modinit_hpp.gen",
|
||||
"romi.header_gen_files",
|
||||
"romi.gen_pkgconf",
|
||||
"romi.gen_lib_init",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
)
|
||||
|
||||
def define_pybind_library(name, pkgcfgs = []):
|
||||
# Helper used to generate all files with one target.
|
||||
native.filegroup(
|
||||
name = "{}.generated_files".format(name),
|
||||
srcs = [
|
||||
"romi.generated_files",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Files that will be included in the wheel as data deps
|
||||
native.filegroup(
|
||||
name = "{}.generated_pkgcfg_files".format(name),
|
||||
srcs = [
|
||||
"src/main/python/romi/romi.pc",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Contains all of the non-python files that need to be included in the wheel
|
||||
native.filegroup(
|
||||
name = "{}.extra_files".format(name),
|
||||
srcs = native.glob(["src/main/python/romi/**"], exclude = ["src/main/python/romi/**/*.py"], allow_empty = True),
|
||||
tags = ["manual", "robotpy"],
|
||||
)
|
||||
|
||||
generate_version_file(
|
||||
name = "{}.generate_version".format(name),
|
||||
output_file = "src/main/python/romi/version.py",
|
||||
template = "//shared/bazel/rules/robotpy:version_template.in",
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
srcs = native.glob(["src/main/python/romi/**/*.py"]) + [
|
||||
"src/main/python/romi/_init__romi.py",
|
||||
"{}.generate_version".format(name),
|
||||
],
|
||||
data = [
|
||||
"{}.generated_pkgcfg_files".format(name),
|
||||
"{}.extra_files".format(name),
|
||||
":src/main/python/romi/_romi",
|
||||
":romi.trampoline_hdr_files",
|
||||
],
|
||||
imports = ["src/main/python"],
|
||||
deps = [
|
||||
"//romiVendordep:robotpy-native-romi",
|
||||
"//wpilibc:robotpy-wpilib",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
update_yaml_files(
|
||||
name = "{}-update-yaml".format(name),
|
||||
yaml_output_directory = "src/main/python/semiwrap",
|
||||
extra_hdrs = native.glob(["src/main/python/**/*.h"], allow_empty = True) + [
|
||||
"//datalog:robotpy-native-datalog.copy_headers",
|
||||
"//hal:robotpy-native-wpihal.copy_headers",
|
||||
"//ntcore:robotpy-native-ntcore.copy_headers",
|
||||
"//romiVendordep:robotpy-native-romi.copy_headers",
|
||||
"//wpilibc:robotpy-native-wpilib.copy_headers",
|
||||
"//wpimath:robotpy-native-wpimath.copy_headers",
|
||||
"//wpinet:robotpy-native-wpinet.copy_headers",
|
||||
"//wpiutil:robotpy-native-wpiutil.copy_headers",
|
||||
],
|
||||
package_root_file = "src/main/python/romi/__init__.py",
|
||||
pkgcfgs = pkgcfgs,
|
||||
pyproject_toml = "src/main/python/pyproject.toml",
|
||||
yaml_files = native.glob(["src/main/python/semiwrap/**"]),
|
||||
)
|
||||
|
||||
scan_headers(
|
||||
name = "{}-scan-headers".format(name),
|
||||
extra_hdrs = native.glob(["src/main/python/**/*.h"], allow_empty = True) + [
|
||||
"//romiVendordep:robotpy-native-romi.copy_headers",
|
||||
],
|
||||
package_root_file = "src/main/python/romi/__init__.py",
|
||||
pkgcfgs = pkgcfgs,
|
||||
pyproject_toml = "src/main/python/pyproject.toml",
|
||||
)
|
||||
@@ -3,7 +3,10 @@ load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
load("@rules_python//python:defs.bzl", "py_binary", "py_library")
|
||||
load("@rules_python//python:pip.bzl", "whl_filegroup")
|
||||
|
||||
exports_files(["wrapper.py"])
|
||||
exports_files([
|
||||
"wrapper.py",
|
||||
"version_template.in",
|
||||
])
|
||||
|
||||
py_library(
|
||||
name = "hack_pkgcfgs",
|
||||
|
||||
@@ -384,6 +384,18 @@ def generate_pybind_build_file(
|
||||
env.filters["jsonify"] = jsonify
|
||||
template = env.from_string(template_contents)
|
||||
|
||||
all_local_native_deps = set()
|
||||
for em in extension_modules:
|
||||
all_local_native_deps.update(em.native_wrapper_dependencies)
|
||||
all_local_native_deps = sorted(all_local_native_deps)
|
||||
|
||||
try:
|
||||
version_file = raw_config["tool"]["hatch"]["build"]["hooks"]["robotpy"][
|
||||
"version_file"
|
||||
]
|
||||
except:
|
||||
version_file = None
|
||||
|
||||
with open(output_file, "w") as f:
|
||||
f.write(
|
||||
template.render(
|
||||
@@ -391,11 +403,13 @@ def generate_pybind_build_file(
|
||||
top_level_name=top_level_name,
|
||||
publish_casters_targets=publish_casters_targets,
|
||||
python_deps=sorted(python_deps),
|
||||
all_local_native_deps=all_local_native_deps,
|
||||
stripped_include_prefix=stripped_include_prefix,
|
||||
yml_prefix=yml_prefix,
|
||||
package_root_file=package_root_file,
|
||||
raw_project_config=raw_config["project"],
|
||||
entry_points=entry_points,
|
||||
version_file=version_file,
|
||||
)
|
||||
+ "\n"
|
||||
)
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
{% if publish_casters_targets %}
|
||||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
{%- endif %}
|
||||
{%- if version_file %}
|
||||
load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file")
|
||||
{%- endif %}
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", {% if publish_casters_targets %}"publish_casters", {% endif %}"resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
@@ -178,13 +181,22 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
srcs = native.glob(["{{stripped_include_prefix}}/{{top_level_name}}/**"], exclude = ["{{stripped_include_prefix}}/{{top_level_name}}/**/*.py"], allow_empty = True),
|
||||
tags = ["manual", "robotpy"],
|
||||
)
|
||||
|
||||
{% if version_file %}
|
||||
generate_version_file(
|
||||
name = "{}.generate_version".format(name),
|
||||
output_file = "{{stripped_include_prefix}}/{{version_file}}",
|
||||
template = "//shared/bazel/rules/robotpy:version_template.in",
|
||||
)
|
||||
{% endif %}
|
||||
robotpy_library(
|
||||
name = name,
|
||||
srcs = native.glob(["{{stripped_include_prefix}}/{{top_level_name}}/**/*.py"]) + [
|
||||
{%- for em in extension_modules %}
|
||||
"{{stripped_include_prefix}}/{{ em.gen_pkgconf.libinit_py.replace(".", "/") }}.py",
|
||||
{%- endfor %}
|
||||
{%- if version_file %}
|
||||
"{}.generate_version".format(name),
|
||||
{%- endif %}
|
||||
],
|
||||
data = [
|
||||
"{}.generated_pkgcfg_files".format(name),
|
||||
@@ -209,11 +221,9 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
name = "{}-update-yaml".format(name),
|
||||
yaml_output_directory = "{{ stripped_include_prefix }}/semiwrap",
|
||||
extra_hdrs = native.glob(["{{stripped_include_prefix}}/**/*.h"], allow_empty = True) + [
|
||||
{%- if python_deps %}
|
||||
{% for d in python_deps %}
|
||||
{%- if "native" in d %}"{{d}}.copy_headers",{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{%- for d in all_local_native_deps %}
|
||||
"{{d}}",
|
||||
{%- endfor %}
|
||||
],
|
||||
package_root_file = "{{package_root_file}}",
|
||||
pkgcfgs = pkgcfgs,
|
||||
|
||||
@@ -84,9 +84,11 @@ def scan_headers(name, pyproject_toml, package_root_file, extra_hdrs, pkgcfgs):
|
||||
"semiwrap.tool",
|
||||
"scan-headers",
|
||||
"--pyproject=$(location " + pyproject_toml + ")",
|
||||
"--check",
|
||||
] + pkgcfg_args,
|
||||
data = extra_hdrs + pkgcfgs + [pyproject_toml, package_root_file],
|
||||
main = "shared/bazel/rules/robotpy/wrapper.py",
|
||||
size = "small",
|
||||
target_compatible_with = robotpy_compatibility_select(),
|
||||
tags = ["robotpy_scan_headers"],
|
||||
)
|
||||
|
||||
3
shared/bazel/rules/robotpy/version_template.in
Normal file
3
shared/bazel/rules/robotpy/version_template.in
Normal file
@@ -0,0 +1,3 @@
|
||||
# This file is automatically generated, DO NOT EDIT
|
||||
|
||||
version = __version__ = "${wpilib_version}"
|
||||
@@ -6,7 +6,11 @@ load("@rules_python//python:defs.bzl", "py_binary")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "third_party_cc_lib_helper", "wpilib_cc_library", "wpilib_cc_shared_library", "wpilib_cc_static_library")
|
||||
load("//shared/bazel/rules:packaging.bzl", "package_minimal_cc_project")
|
||||
load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file")
|
||||
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("//wpilibc:generate.bzl", "generate_wpilibc")
|
||||
load("//wpilibc:robotpy_native_build_info.bzl", "define_native_wrapper")
|
||||
load("//wpilibc:robotpy_pybind_build_info.bzl", "define_pybind_library", "wpilib_counter_extension", "wpilib_drive_extension", "wpilib_event_extension", "wpilib_extension", "wpilib_simulation_extension")
|
||||
|
||||
filegroup(
|
||||
name = "doxygen-files",
|
||||
@@ -199,3 +203,96 @@ package_minimal_cc_project(
|
||||
maven_artifact_name = "wpilibc-cpp",
|
||||
maven_group_id = "org.wpilib.wpilibc",
|
||||
)
|
||||
|
||||
generate_robotpy_native_wrapper_build_info(
|
||||
name = "robotpy-native-wpilib-generator",
|
||||
pyproject_toml = "src/main/python/native-pyproject.toml",
|
||||
)
|
||||
|
||||
define_native_wrapper(
|
||||
name = "robotpy-native-wpilib",
|
||||
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-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",
|
||||
"//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",
|
||||
]
|
||||
|
||||
generate_robotpy_pybind_build_info(
|
||||
name = "robotpy-wpilib-generator",
|
||||
additional_srcs = [
|
||||
"src/main/python/wpilib/src/rpy/Filesystem.h",
|
||||
"src/main/python/wpilib/src/rpy/Notifier.h",
|
||||
"src/main/python/wpilib/src/rpy/MotorControllerGroup.h",
|
||||
] + [":robotpy-native-wpilib.copy_headers"],
|
||||
package_root_file = "src/main/python/wpilib/__init__.py",
|
||||
pkgcfgs = PKG_CONFIG_DEPS,
|
||||
yaml_files = glob(["src/main/python/semiwrap/**/*.yml"]),
|
||||
)
|
||||
|
||||
wpilib_event_extension(
|
||||
srcs = ["src/main/python/wpilib/event/event.cpp"],
|
||||
)
|
||||
|
||||
wpilib_extension(
|
||||
srcs = glob(["src/main/python/wpilib/src/**/*.cpp"]),
|
||||
extra_hdrs = glob([
|
||||
"src/main/python/wpilib/src/rpy/*.h",
|
||||
"src/main/python/wpilib/src/rpy/*.inc",
|
||||
]),
|
||||
header_to_dat_deps = glob(["src/main/python/wpilib/src/**"]),
|
||||
includes = [
|
||||
"src/main/python/wpilib",
|
||||
"src/main/python/wpilib/src",
|
||||
],
|
||||
)
|
||||
|
||||
wpilib_counter_extension(
|
||||
srcs = ["src/main/python/wpilib/counter/counter.cpp"],
|
||||
header_to_dat_deps = glob([
|
||||
"src/main/python/wpilib/src/rpy/*.h",
|
||||
"src/main/python/wpilib/src/rpy/*.inc",
|
||||
]),
|
||||
)
|
||||
|
||||
wpilib_drive_extension(
|
||||
srcs = ["src/main/python/wpilib/drive/drive.cpp"],
|
||||
header_to_dat_deps = glob([
|
||||
"src/main/python/wpilib/src/rpy/*.h",
|
||||
"src/main/python/wpilib/src/rpy/*.inc",
|
||||
]),
|
||||
)
|
||||
|
||||
wpilib_simulation_extension(
|
||||
srcs = ["src/main/python/wpilib/simulation/simulation.cpp"],
|
||||
header_to_dat_deps = glob([
|
||||
"src/main/python/wpilib/src/rpy/*.h",
|
||||
"src/main/python/wpilib/src/rpy/*.inc",
|
||||
]),
|
||||
)
|
||||
|
||||
define_pybind_library(
|
||||
name = "robotpy-wpilib",
|
||||
pkgcfgs = PKG_CONFIG_DEPS,
|
||||
)
|
||||
|
||||
robotpy_py_test(
|
||||
"python_tests",
|
||||
srcs = glob(["src/test/python/**/*.py"]),
|
||||
deps = [
|
||||
":robotpy-wpilib",
|
||||
requirement("pytest"),
|
||||
],
|
||||
)
|
||||
|
||||
42
wpilibc/robotpy_native_build_info.bzl
generated
Normal file
42
wpilibc/robotpy_native_build_info.bzl
generated
Normal file
@@ -0,0 +1,42 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "native_wrappery_library")
|
||||
|
||||
def define_native_wrapper(name, pyproject_toml = None):
|
||||
copy_to_directory(
|
||||
name = "{}.copy_headers".format(name),
|
||||
srcs = native.glob(["src/main/native/include/**"]) + native.glob(["src/generated/main/native/include/**"], allow_empty = True),
|
||||
out = "native/wpilib/include",
|
||||
root_paths = ["src/main/native/include/"],
|
||||
replace_prefixes = {
|
||||
"wpilibc/src/generated/main/native/include": "",
|
||||
"wpilibc/src/main/native/include": "",
|
||||
},
|
||||
verbose = False,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
native_wrappery_library(
|
||||
name = name,
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml",
|
||||
libinit_file = "native/wpilib/_init_robotpy_native_wpilib.py",
|
||||
pc_file = "native/wpilib/robotpy-native-wpilib.pc",
|
||||
pc_deps = [
|
||||
"//ntcore:native/ntcore/robotpy-native-ntcore.pc",
|
||||
"//hal:native/wpihal/robotpy-native-wpihal.pc",
|
||||
"//wpimath:native/wpimath/robotpy-native-wpimath.pc",
|
||||
"//wpinet:native/wpinet/robotpy-native-wpinet.pc",
|
||||
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
|
||||
],
|
||||
deps = [
|
||||
"//ntcore:robotpy-native-ntcore",
|
||||
"//hal:robotpy-native-wpihal",
|
||||
"//wpimath:robotpy-native-wpimath",
|
||||
"//wpinet:robotpy-native-wpinet",
|
||||
"//wpiutil:robotpy-native-wpiutil",
|
||||
],
|
||||
headers = "{}.copy_headers".format(name),
|
||||
native_shared_library = "shared/wpilibc",
|
||||
install_path = "native/wpilib/",
|
||||
)
|
||||
1974
wpilibc/robotpy_pybind_build_info.bzl
generated
Normal file
1974
wpilibc/robotpy_pybind_build_info.bzl
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -60,9 +60,6 @@ update_init = [
|
||||
scan_headers_ignore = [
|
||||
"wpi/system/WPILibVersion.hpp",
|
||||
|
||||
# needs a python wrapper
|
||||
"frc/AsynchronousInterrupt.h",
|
||||
|
||||
"wpi/system/Filesystem.hpp",
|
||||
"wpi/system/Notifier.hpp", # wrapped separately
|
||||
"wpi/system/Resource.hpp",
|
||||
@@ -91,78 +88,62 @@ includes = ["wpilib/src"]
|
||||
DYNAMIC_CAMERA_SERVER = 1
|
||||
|
||||
[tool.semiwrap.extension_modules."wpilib._wpilib".headers]
|
||||
# frc
|
||||
ADXL345_I2C = "wpi/hardware/accelerometer/ADXL345_I2C.hpp"
|
||||
AddressableLED = "wpi/hardware/led/AddressableLED.hpp"
|
||||
Alert = "wpi/util/Alert.hpp"
|
||||
AnalogAccelerometer = "wpi/hardware/accelerometer/AnalogAccelerometer.hpp"
|
||||
AnalogEncoder = "wpi/hardware/rotation/AnalogEncoder.hpp"
|
||||
AnalogInput = "wpi/hardware/discrete/AnalogInput.hpp"
|
||||
AnalogPotentiometer = "wpi/hardware/rotation/AnalogPotentiometer.hpp"
|
||||
CAN = "wpi/hardware/bus/CAN.hpp"
|
||||
Compressor = "wpi/hardware/pneumatic/Compressor.hpp"
|
||||
CompressorConfigType = "wpi/hardware/pneumatic/CompressorConfigType.hpp"
|
||||
DataLogManager = "wpi/system/DataLogManager.hpp"
|
||||
DSControlWord = "wpi/driverstation/DSControlWord.hpp"
|
||||
DigitalInput = "wpi/hardware/discrete/DigitalInput.hpp"
|
||||
DigitalOutput = "wpi/hardware/discrete/DigitalOutput.hpp"
|
||||
DoubleSolenoid = "wpi/hardware/pneumatic/DoubleSolenoid.hpp"
|
||||
DriverStation = "wpi/driverstation/DriverStation.hpp"
|
||||
DutyCycle = "wpi/hardware/rotation/DutyCycle.hpp"
|
||||
DutyCycleEncoder = "wpi/hardware/rotation/DutyCycleEncoder.hpp"
|
||||
Encoder = "wpi/hardware/rotation/Encoder.hpp"
|
||||
Errors = "wpi/system/Errors.hpp"
|
||||
# rpy
|
||||
Filesystem = "rpy/Filesystem.h"
|
||||
MotorControllerGroup = "rpy/MotorControllerGroup.h"
|
||||
Notifier = "rpy/Notifier.h"
|
||||
|
||||
# wpi
|
||||
ExpansionHub = "wpi/ExpansionHub.hpp"
|
||||
ExpansionHubMotor = "wpi/ExpansionHubMotor.hpp"
|
||||
ExpansionHubPidConstants = "wpi/ExpansionHubPidConstants.hpp"
|
||||
ExpansionHubServo = "wpi/ExpansionHubServo.hpp"
|
||||
Filesystem = "rpy/Filesystem.h"
|
||||
|
||||
# wpi/driverstation
|
||||
DSControlWord = "wpi/driverstation/DSControlWord.hpp"
|
||||
DriverStation = "wpi/driverstation/DriverStation.hpp"
|
||||
Gamepad = "wpi/driverstation/Gamepad.hpp"
|
||||
I2C = "wpi/hardware/bus/I2C.hpp"
|
||||
IterativeRobotBase = "wpi/framework/IterativeRobotBase.hpp"
|
||||
GenericHID = "wpi/driverstation/GenericHID.hpp"
|
||||
Joystick = "wpi/driverstation/Joystick.hpp"
|
||||
LEDPattern = "wpi/hardware/led/LEDPattern.hpp"
|
||||
MotorSafety = "wpi/hardware/motor/MotorSafety.hpp"
|
||||
Notifier = "rpy/Notifier.h"
|
||||
OnboardIMU = "wpi/hardware/imu/OnboardIMU.hpp"
|
||||
PS4Controller = "wpi/driverstation/PS4Controller.hpp"
|
||||
PS5Controller = "wpi/driverstation/PS5Controller.hpp"
|
||||
PWM = "wpi/hardware/discrete/PWM.hpp"
|
||||
PneumaticHub = "wpi/hardware/pneumatic/PneumaticHub.hpp"
|
||||
PneumaticsBase = "wpi/hardware/pneumatic/PneumaticsBase.hpp"
|
||||
PneumaticsControlModule = "wpi/hardware/pneumatic/PneumaticsControlModule.hpp"
|
||||
PneumaticsModuleType = "wpi/hardware/pneumatic/PneumaticsModuleType.hpp"
|
||||
PowerDistribution = "wpi/hardware/power/PowerDistribution.hpp"
|
||||
Preferences = "wpi/util/Preferences.hpp"
|
||||
RobotBase = "wpi/framework/RobotBase.hpp"
|
||||
RobotController = "wpi/system/RobotController.hpp"
|
||||
RobotState = "wpi/framework/RobotState.hpp"
|
||||
RuntimeType = "wpi/system/RuntimeType.hpp"
|
||||
SensorUtil = "wpi/util/SensorUtil.hpp"
|
||||
SerialPort = "wpi/hardware/bus/SerialPort.hpp"
|
||||
SharpIR = "wpi/hardware/range/SharpIR.hpp"
|
||||
Solenoid = "wpi/hardware/pneumatic/Solenoid.hpp"
|
||||
StadiaController = "wpi/driverstation/StadiaController.hpp"
|
||||
SystemServer = "wpi/system/SystemServer.hpp"
|
||||
Threads = "wpi/system/Threads.hpp"
|
||||
TimedRobot = "wpi/framework/TimedRobot.hpp"
|
||||
Timer = "wpi/system/Timer.hpp"
|
||||
TimesliceRobot = "wpi/framework/TimesliceRobot.hpp"
|
||||
Tracer = "wpi/system/Tracer.hpp"
|
||||
Watchdog = "wpi/system/Watchdog.hpp"
|
||||
XboxController = "wpi/driverstation/XboxController.hpp"
|
||||
|
||||
# frc (interfaces)
|
||||
# wpi/framework
|
||||
IterativeRobotBase = "wpi/framework/IterativeRobotBase.hpp"
|
||||
RobotBase = "wpi/framework/RobotBase.hpp"
|
||||
RobotState = "wpi/framework/RobotState.hpp"
|
||||
TimedRobot = "wpi/framework/TimedRobot.hpp"
|
||||
TimesliceRobot = "wpi/framework/TimesliceRobot.hpp"
|
||||
|
||||
# wpi/hardware/accelerometer
|
||||
ADXL345_I2C = "wpi/hardware/accelerometer/ADXL345_I2C.hpp"
|
||||
AnalogAccelerometer = "wpi/hardware/accelerometer/AnalogAccelerometer.hpp"
|
||||
|
||||
# wpi/hardware/bus
|
||||
CAN = "wpi/hardware/bus/CAN.hpp"
|
||||
I2C = "wpi/hardware/bus/I2C.hpp"
|
||||
SerialPort = "wpi/hardware/bus/SerialPort.hpp"
|
||||
|
||||
# wpi/hardware/discrete
|
||||
AnalogInput = "wpi/hardware/discrete/AnalogInput.hpp"
|
||||
CounterBase = "wpi/hardware/discrete/CounterBase.hpp"
|
||||
GenericHID = "wpi/driverstation/GenericHID.hpp"
|
||||
MotorController = "wpi/hardware/motor/MotorController.hpp"
|
||||
DigitalInput = "wpi/hardware/discrete/DigitalInput.hpp"
|
||||
DigitalOutput = "wpi/hardware/discrete/DigitalOutput.hpp"
|
||||
PWM = "wpi/hardware/discrete/PWM.hpp"
|
||||
|
||||
# frc/internal
|
||||
DriverStationModeThread = "wpi/internal/DriverStationModeThread.hpp"
|
||||
# wpi/hardware/imu
|
||||
OnboardIMU = "wpi/hardware/imu/OnboardIMU.hpp"
|
||||
|
||||
# frc/motorcontrol
|
||||
# wpi/hardware/led
|
||||
AddressableLED = "wpi/hardware/led/AddressableLED.hpp"
|
||||
LEDPattern = "wpi/hardware/led/LEDPattern.hpp"
|
||||
|
||||
# wpi/hardware/motor
|
||||
Koors40 = "wpi/hardware/motor/Koors40.hpp"
|
||||
MotorControllerGroup = "rpy/MotorControllerGroup.h"
|
||||
MotorController = "wpi/hardware/motor/MotorController.hpp"
|
||||
MotorSafety = "wpi/hardware/motor/MotorSafety.hpp"
|
||||
PWMMotorController = "wpi/hardware/motor/PWMMotorController.hpp"
|
||||
PWMSparkFlex = "wpi/hardware/motor/PWMSparkFlex.hpp"
|
||||
PWMSparkMax = "wpi/hardware/motor/PWMSparkMax.hpp"
|
||||
@@ -175,7 +156,33 @@ SparkMini = "wpi/hardware/motor/SparkMini.hpp"
|
||||
Talon = "wpi/hardware/motor/Talon.hpp"
|
||||
VictorSP = "wpi/hardware/motor/VictorSP.hpp"
|
||||
|
||||
# frc/smartdashboard
|
||||
# wpi/hardware/pneumatic
|
||||
Compressor = "wpi/hardware/pneumatic/Compressor.hpp"
|
||||
CompressorConfigType = "wpi/hardware/pneumatic/CompressorConfigType.hpp"
|
||||
DoubleSolenoid = "wpi/hardware/pneumatic/DoubleSolenoid.hpp"
|
||||
PneumaticHub = "wpi/hardware/pneumatic/PneumaticHub.hpp"
|
||||
PneumaticsBase = "wpi/hardware/pneumatic/PneumaticsBase.hpp"
|
||||
PneumaticsControlModule = "wpi/hardware/pneumatic/PneumaticsControlModule.hpp"
|
||||
PneumaticsModuleType = "wpi/hardware/pneumatic/PneumaticsModuleType.hpp"
|
||||
Solenoid = "wpi/hardware/pneumatic/Solenoid.hpp"
|
||||
|
||||
# wpi/hardware/power
|
||||
PowerDistribution = "wpi/hardware/power/PowerDistribution.hpp"
|
||||
|
||||
# wpi/hardware/range
|
||||
SharpIR = "wpi/hardware/range/SharpIR.hpp"
|
||||
|
||||
# wpi/hardware/rotation
|
||||
AnalogEncoder = "wpi/hardware/rotation/AnalogEncoder.hpp"
|
||||
AnalogPotentiometer = "wpi/hardware/rotation/AnalogPotentiometer.hpp"
|
||||
DutyCycle = "wpi/hardware/rotation/DutyCycle.hpp"
|
||||
DutyCycleEncoder = "wpi/hardware/rotation/DutyCycleEncoder.hpp"
|
||||
Encoder = "wpi/hardware/rotation/Encoder.hpp"
|
||||
|
||||
# wpi/internal
|
||||
DriverStationModeThread = "wpi/internal/DriverStationModeThread.hpp"
|
||||
|
||||
# wpi/smartdashboard
|
||||
Field2d = "wpi/smartdashboard/Field2d.hpp"
|
||||
FieldObject2d = "wpi/smartdashboard/FieldObject2d.hpp"
|
||||
Mechanism2d = "wpi/smartdashboard/Mechanism2d.hpp"
|
||||
@@ -187,12 +194,26 @@ SendableChooser = "wpi/smartdashboard/SendableChooser.hpp"
|
||||
SendableChooserBase = "wpi/smartdashboard/SendableChooserBase.hpp"
|
||||
SmartDashboard = "wpi/smartdashboard/SmartDashboard.hpp"
|
||||
|
||||
# frc/sysid
|
||||
# wpi/sysid
|
||||
SysIdRoutineLog = "wpi/sysid/SysIdRoutineLog.hpp"
|
||||
|
||||
# frc/util
|
||||
# wpi/system
|
||||
DataLogManager = "wpi/system/DataLogManager.hpp"
|
||||
Errors = "wpi/system/Errors.hpp"
|
||||
RobotController = "wpi/system/RobotController.hpp"
|
||||
RuntimeType = "wpi/system/RuntimeType.hpp"
|
||||
SystemServer = "wpi/system/SystemServer.hpp"
|
||||
Threads = "wpi/system/Threads.hpp"
|
||||
Timer = "wpi/system/Timer.hpp"
|
||||
Tracer = "wpi/system/Tracer.hpp"
|
||||
Watchdog = "wpi/system/Watchdog.hpp"
|
||||
|
||||
# wpi/util
|
||||
Alert = "wpi/util/Alert.hpp"
|
||||
Color = "wpi/util/Color.hpp"
|
||||
Color8Bit = "wpi/util/Color8Bit.hpp"
|
||||
Preferences = "wpi/util/Preferences.hpp"
|
||||
SensorUtil = "wpi/util/SensorUtil.hpp"
|
||||
|
||||
|
||||
[tool.semiwrap.extension_modules."wpilib.counter._counter"]
|
||||
@@ -202,7 +223,7 @@ depends = ["wpilib"]
|
||||
yaml_path = "semiwrap/counter"
|
||||
|
||||
[tool.semiwrap.extension_modules."wpilib.counter._counter".headers]
|
||||
# frc/counter
|
||||
# wpi/counter
|
||||
EdgeConfiguration = "wpi/counter/EdgeConfiguration.hpp"
|
||||
Tachometer = "wpi/counter/Tachometer.hpp"
|
||||
UpDownCounter = "wpi/counter/UpDownCounter.hpp"
|
||||
@@ -215,7 +236,7 @@ depends = ["wpilib"]
|
||||
yaml_path = "semiwrap/drive"
|
||||
|
||||
[tool.semiwrap.extension_modules."wpilib.drive._drive".headers]
|
||||
# frc/drive
|
||||
# wpi/drive
|
||||
DifferentialDrive = "wpi/drive/DifferentialDrive.hpp"
|
||||
MecanumDrive = "wpi/drive/MecanumDrive.hpp"
|
||||
RobotDriveBase = "wpi/drive/RobotDriveBase.hpp"
|
||||
@@ -229,7 +250,7 @@ depends = ["wpimath_filter"]
|
||||
yaml_path = "semiwrap/event"
|
||||
|
||||
[tool.semiwrap.extension_modules."wpilib.event._event".headers]
|
||||
# frc/event
|
||||
# wpi/event
|
||||
BooleanEvent = "wpi/event/BooleanEvent.hpp"
|
||||
EventLoop = "wpi/event/EventLoop.hpp"
|
||||
NetworkBooleanEvent = "wpi/event/NetworkBooleanEvent.hpp"
|
||||
@@ -242,7 +263,7 @@ depends = ["wpilib", "wpimath_controls", "wpimath_geometry", "wpimath_kinematics
|
||||
yaml_path = "semiwrap/simulation"
|
||||
|
||||
[tool.semiwrap.extension_modules."wpilib.simulation._simulation".headers]
|
||||
# frc/simulation
|
||||
# wpi/simulation
|
||||
ADXL345Sim = "wpi/simulation/ADXL345Sim.hpp"
|
||||
AddressableLEDSim = "wpi/simulation/AddressableLEDSim.hpp"
|
||||
AnalogEncoderSim = "wpi/simulation/AnalogEncoderSim.hpp"
|
||||
|
||||
@@ -8,7 +8,12 @@ load("//shared/bazel/rules:cc_rules.bzl", "generate_def_windows", "third_party_c
|
||||
load("//shared/bazel/rules:java_rules.bzl", "wpilib_java_junit5_test")
|
||||
load("//shared/bazel/rules:jni_rules.bzl", "wpilib_jni_cc_library", "wpilib_jni_java_library")
|
||||
load("//shared/bazel/rules:packaging.bzl", "package_default_jni_project", "pkg_files_headers")
|
||||
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("//wpimath:generate.bzl", "generate_wpimath")
|
||||
load("//wpimath:robotpy_native_build_info.bzl", "define_native_wrapper")
|
||||
load("//wpimath:robotpy_pybind_build_info.bzl", "define_pybind_library", "publish_library_casters", "wpimath_controls_extension", "wpimath_extension", "wpimath_filter_extension", "wpimath_geometry_extension", "wpimath_interpolation_extension", "wpimath_kinematics_extension", "wpimath_spline_extension")
|
||||
load("//wpimath:robotpy_pybind_test_info.bzl", "wpimath_test_extension", define_test_pybind_library = "define_pybind_library")
|
||||
|
||||
filegroup(
|
||||
name = "doxygen-files",
|
||||
@@ -319,3 +324,137 @@ package_default_jni_project(
|
||||
maven_artifact_name = "wpimath-cpp",
|
||||
maven_group_id = "org.wpilib.wpimath",
|
||||
)
|
||||
|
||||
generate_robotpy_native_wrapper_build_info(
|
||||
name = "robotpy-native-wpimath-generator",
|
||||
pyproject_toml = "src/main/python/native-pyproject.toml",
|
||||
third_party_dirs = [
|
||||
"gcem",
|
||||
"sleipnir",
|
||||
],
|
||||
)
|
||||
|
||||
define_native_wrapper(
|
||||
name = "robotpy-native-wpimath",
|
||||
pyproject_toml = "src/main/python/native-pyproject.toml",
|
||||
)
|
||||
|
||||
PYBIND_PKGCFG_DEPS = [
|
||||
"//wpimath:native/wpimath/robotpy-native-wpimath.pc",
|
||||
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
|
||||
"//wpiutil:robotpy-wpiutil.generated_pkgcfg_files",
|
||||
]
|
||||
|
||||
generate_robotpy_pybind_build_info(
|
||||
name = "robotpy-wpimath-generator",
|
||||
additional_srcs = [":robotpy-native-wpimath.copy_headers"],
|
||||
package_root_file = "src/main/python/wpimath/__init__.py",
|
||||
pkgcfgs = PYBIND_PKGCFG_DEPS,
|
||||
yaml_files = glob(["src/main/python/semiwrap/**/*.yml"]),
|
||||
)
|
||||
|
||||
publish_library_casters()
|
||||
|
||||
wpimath_extension(
|
||||
srcs = ["src/main/python/wpimath/src/wpimath.cpp"],
|
||||
extra_hdrs = glob(["src/main/python/wpimath/_impl/src/**/*.h"]),
|
||||
)
|
||||
|
||||
wpimath_filter_extension(
|
||||
srcs = ["src/main/python/wpimath/filter/filter.cpp"],
|
||||
extra_hdrs = glob(["src/main/python/wpimath/_impl/src/**/*.h"]),
|
||||
)
|
||||
|
||||
wpimath_geometry_extension(
|
||||
srcs = ["src/main/python/wpimath/geometry/geometry.cpp"],
|
||||
extra_hdrs = glob(["src/main/python/wpimath/geometry/include/rpy/*"]),
|
||||
header_to_dat_deps = glob(["src/main/native/include/**/*"]) + glob([
|
||||
"src/main/python/wpimath/geometry/include/**/*.h",
|
||||
"src/main/python/wpimath/_impl/src/**/*.h",
|
||||
]),
|
||||
includes = ["src/main/python/wpimath/geometry/include"],
|
||||
)
|
||||
|
||||
wpimath_interpolation_extension(
|
||||
srcs = ["src/main/python/wpimath/interpolation/interpolation.cpp"],
|
||||
header_to_dat_deps = glob([
|
||||
"src/main/python/wpimath/geometry/include/**/*.h",
|
||||
"src/main/python/wpimath/_impl/src/**/*.h",
|
||||
]),
|
||||
)
|
||||
|
||||
wpimath_kinematics_extension(
|
||||
srcs = ["src/main/python/wpimath/kinematics/kinematics.cpp"],
|
||||
header_to_dat_deps = glob([
|
||||
"src/main/python/wpimath/geometry/include/**/*.h",
|
||||
"src/main/python/wpimath/_impl/src/**/*.h",
|
||||
]),
|
||||
)
|
||||
|
||||
wpimath_spline_extension(
|
||||
srcs = ["src/main/python/wpimath/spline/spline.cpp"],
|
||||
header_to_dat_deps = glob([
|
||||
"src/main/python/wpimath/geometry/include/**/*.h",
|
||||
"src/main/python/wpimath/_impl/src/**/*.h",
|
||||
]),
|
||||
)
|
||||
|
||||
wpimath_controls_extension(
|
||||
srcs = ["src/main/python/wpimath/_controls/controls.cpp"],
|
||||
header_to_dat_deps = glob([
|
||||
"src/main/python/wpimath/geometry/include/**/*.h",
|
||||
"src/main/python/wpimath/_impl/src/**/*.h",
|
||||
]),
|
||||
)
|
||||
|
||||
define_pybind_library(
|
||||
name = "robotpy-wpimath",
|
||||
pkgcfgs = PYBIND_PKGCFG_DEPS,
|
||||
)
|
||||
|
||||
generate_robotpy_pybind_build_info(
|
||||
name = "robotpy-wpimath_test-generator",
|
||||
additional_srcs = ["src/test/python/cpp/wpimath_test/include/module.h"],
|
||||
generated_file_name = "robotpy_pybind_test_info.bzl",
|
||||
package_root_file = "src/test/python/cpp/wpimath_test/__init__.py",
|
||||
pkgcfgs = [
|
||||
"//wpimath:native/wpimath/robotpy-native-wpimath.pc",
|
||||
"//wpimath:robotpy-wpimath.generated_pkgcfg_files",
|
||||
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
|
||||
"//wpiutil:robotpy-wpiutil.generated_pkgcfg_files",
|
||||
],
|
||||
pyproject_toml = "src/test/python/cpp/pyproject.toml",
|
||||
stripped_include_prefix = "src/test/python/cpp",
|
||||
yaml_files = glob(["src/test/python/cpp/semiwrap/**/*.yml"]),
|
||||
yml_prefix = "src/test/python/cpp/",
|
||||
)
|
||||
|
||||
wpimath_test_extension(
|
||||
srcs = glob(["src/test/python/cpp/wpimath_test/src/*.cpp"]),
|
||||
extra_hdrs = ["src/test/python/cpp/wpimath_test/include/module.h"],
|
||||
header_to_dat_deps = ["src/test/python/cpp/wpimath_test/include/module.h"],
|
||||
includes = ["src/test/python/cpp/wpimath_test/include"],
|
||||
)
|
||||
|
||||
define_test_pybind_library(
|
||||
name = "robotpy-wpimath-test",
|
||||
pkgcfgs = [
|
||||
"//wpimath:native/wpimath/robotpy-native-wpimath.pc",
|
||||
"//wpimath:robotpy-wpimath.generated_pkgcfg_files",
|
||||
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
|
||||
"//wpiutil:robotpy-wpiutil.generated_pkgcfg_files",
|
||||
],
|
||||
)
|
||||
|
||||
robotpy_py_test(
|
||||
"python_tests",
|
||||
srcs = glob(
|
||||
["src/test/python/**/*.py"],
|
||||
exclude = ["src/test/python/cpp/**"],
|
||||
),
|
||||
deps = [
|
||||
":robotpy-wpimath",
|
||||
":robotpy-wpimath-test",
|
||||
requirement("pytest"),
|
||||
],
|
||||
)
|
||||
|
||||
39
wpimath/robotpy_native_build_info.bzl
generated
Normal file
39
wpimath/robotpy_native_build_info.bzl
generated
Normal file
@@ -0,0 +1,39 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "native_wrappery_library")
|
||||
|
||||
def define_native_wrapper(name, pyproject_toml = None):
|
||||
copy_to_directory(
|
||||
name = "{}.copy_headers".format(name),
|
||||
srcs = native.glob(["src/main/native/include/**"]) + native.glob(["src/generated/main/native/include/**"], allow_empty = True) + native.glob([
|
||||
"src/main/native/thirdparty/gcem/include/**",
|
||||
"src/main/native/thirdparty/sleipnir/include/**",
|
||||
]),
|
||||
out = "native/wpimath/include",
|
||||
root_paths = ["src/main/native/include/"],
|
||||
replace_prefixes = {
|
||||
"wpimath/src/generated/main/native/include": "",
|
||||
"wpimath/src/main/native/include": "",
|
||||
"wpimath/src/main/native/thirdparty/gcem/include": "",
|
||||
"wpimath/src/main/native/thirdparty/sleipnir/include": "",
|
||||
},
|
||||
verbose = False,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
native_wrappery_library(
|
||||
name = name,
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml",
|
||||
libinit_file = "native/wpimath/_init_robotpy_native_wpimath.py",
|
||||
pc_file = "native/wpimath/robotpy-native-wpimath.pc",
|
||||
pc_deps = [
|
||||
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
|
||||
],
|
||||
deps = [
|
||||
"//wpiutil:robotpy-native-wpiutil",
|
||||
],
|
||||
headers = "{}.copy_headers".format(name),
|
||||
native_shared_library = "shared/wpimath",
|
||||
install_path = "native/wpimath/",
|
||||
)
|
||||
1785
wpimath/robotpy_pybind_build_info.bzl
generated
Normal file
1785
wpimath/robotpy_pybind_build_info.bzl
generated
Normal file
File diff suppressed because it is too large
Load Diff
157
wpimath/robotpy_pybind_test_info.bzl
Normal file
157
wpimath/robotpy_pybind_test_info.bzl
Normal file
@@ -0,0 +1,157 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
|
||||
def wpimath_test_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
WPIMATH_TEST_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "module",
|
||||
yml_file = "semiwrap/module.yml",
|
||||
header_root = "wpimath/src/test/python/cpp/wpimath_test/include",
|
||||
header_file = "wpimath/src/test/python/cpp/wpimath_test/include/module.h",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("SomeClass", "__SomeClass.hpp"),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
resolve_casters(
|
||||
name = "wpimath_test.resolve_casters",
|
||||
caster_deps = ["//wpimath:src/main/python/wpimath/wpimath-casters.pybind11.json", "//wpiutil:src/main/python/wpiutil/wpiutil-casters.pybind11.json"],
|
||||
casters_pkl_file = "wpimath_test.casters.pkl",
|
||||
dep_file = "wpimath_test.casters.d",
|
||||
)
|
||||
|
||||
gen_libinit(
|
||||
name = "wpimath_test.gen_lib_init",
|
||||
output_file = "src/test/python/cpp/wpimath_test/_init__wpimath_test.py",
|
||||
modules = ["wpimath._init__wpimath"],
|
||||
)
|
||||
|
||||
gen_pkgconf(
|
||||
name = "wpimath_test.gen_pkgconf",
|
||||
libinit_py = "wpimath_test._init__wpimath_test",
|
||||
module_pkg_name = "wpimath_test._wpimath_test",
|
||||
output_file = "wpimath_test.pc",
|
||||
pkg_name = "wpimath_test",
|
||||
install_path = "src/test/python/cpp/wpimath_test",
|
||||
project_file = "src/test/python/cpp/pyproject.toml",
|
||||
package_root = "src/test/python/cpp/wpimath_test/__init__.py",
|
||||
)
|
||||
|
||||
gen_modinit_hpp(
|
||||
name = "wpimath_test.gen_modinit_hpp",
|
||||
input_dats = [x.class_name for x in WPIMATH_TEST_HEADER_GEN],
|
||||
libname = "_wpimath_test",
|
||||
output_file = "semiwrap_init.wpimath_test._wpimath_test.hpp",
|
||||
)
|
||||
|
||||
run_header_gen(
|
||||
name = "wpimath_test",
|
||||
casters_pickle = "wpimath_test.casters.pkl",
|
||||
header_gen_config = WPIMATH_TEST_HEADER_GEN,
|
||||
trampoline_subpath = "src/test/python/cpp/wpimath_test",
|
||||
deps = header_to_dat_deps,
|
||||
local_native_libraries = [
|
||||
],
|
||||
yml_prefix = "src/test/python/cpp/",
|
||||
)
|
||||
|
||||
create_pybind_library(
|
||||
name = "wpimath_test",
|
||||
install_path = "src/test/python/cpp/wpimath_test/",
|
||||
extension_name = "_wpimath_test",
|
||||
generated_srcs = [":wpimath_test.generated_srcs"],
|
||||
semiwrap_header = [":wpimath_test.gen_modinit_hpp"],
|
||||
deps = [
|
||||
":wpimath_test.tmpl_hdrs",
|
||||
":wpimath_test.trampoline_hdrs",
|
||||
"//wpimath:wpimath",
|
||||
"//wpimath:wpimath_pybind_library",
|
||||
],
|
||||
dynamic_deps = [
|
||||
"//wpimath:shared/wpimath",
|
||||
],
|
||||
extra_hdrs = extra_hdrs,
|
||||
extra_srcs = srcs,
|
||||
includes = includes,
|
||||
)
|
||||
|
||||
native.filegroup(
|
||||
name = "wpimath_test.generated_files",
|
||||
srcs = [
|
||||
"wpimath_test.gen_modinit_hpp.gen",
|
||||
"wpimath_test.header_gen_files",
|
||||
"wpimath_test.gen_pkgconf",
|
||||
"wpimath_test.gen_lib_init",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
)
|
||||
|
||||
def define_pybind_library(name, pkgcfgs = []):
|
||||
# Helper used to generate all files with one target.
|
||||
native.filegroup(
|
||||
name = "{}.generated_files".format(name),
|
||||
srcs = [
|
||||
"wpimath_test.generated_files",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Files that will be included in the wheel as data deps
|
||||
native.filegroup(
|
||||
name = "{}.generated_pkgcfg_files".format(name),
|
||||
srcs = [
|
||||
"src/test/python/cpp/wpimath_test/wpimath_test.pc",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Contains all of the non-python files that need to be included in the wheel
|
||||
native.filegroup(
|
||||
name = "{}.extra_files".format(name),
|
||||
srcs = native.glob(["src/test/python/cpp/wpimath_test/**"], exclude = ["src/test/python/cpp/wpimath_test/**/*.py"], allow_empty = True),
|
||||
tags = ["manual", "robotpy"],
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
srcs = native.glob(["src/test/python/cpp/wpimath_test/**/*.py"]) + [
|
||||
"src/test/python/cpp/wpimath_test/_init__wpimath_test.py",
|
||||
],
|
||||
data = [
|
||||
"{}.generated_pkgcfg_files".format(name),
|
||||
"{}.extra_files".format(name),
|
||||
":src/test/python/cpp/wpimath_test/_wpimath_test",
|
||||
":wpimath_test.trampoline_hdr_files",
|
||||
],
|
||||
imports = ["src/test/python/cpp"],
|
||||
deps = [
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
update_yaml_files(
|
||||
name = "{}-update-yaml".format(name),
|
||||
yaml_output_directory = "src/test/python/cpp/semiwrap",
|
||||
extra_hdrs = native.glob(["src/test/python/cpp/**/*.h"], allow_empty = True) + [
|
||||
],
|
||||
package_root_file = "src/test/python/cpp/wpimath_test/__init__.py",
|
||||
pkgcfgs = pkgcfgs,
|
||||
pyproject_toml = "src/test/python/cpp/pyproject.toml",
|
||||
yaml_files = native.glob(["src/test/python/cpp/semiwrap/**"]),
|
||||
)
|
||||
|
||||
scan_headers(
|
||||
name = "{}-scan-headers".format(name),
|
||||
extra_hdrs = native.glob(["src/test/python/cpp/**/*.h"], allow_empty = True) + [
|
||||
],
|
||||
package_root_file = "src/test/python/cpp/wpimath_test/__init__.py",
|
||||
pkgcfgs = pkgcfgs,
|
||||
pyproject_toml = "src/test/python/cpp/pyproject.toml",
|
||||
)
|
||||
@@ -83,10 +83,10 @@ scan_headers_ignore = [
|
||||
|
||||
"wpi/math/proto/*",
|
||||
"wpi/math/*/proto/*",
|
||||
|
||||
|
||||
"wpi/math/struct/*",
|
||||
"wpi/math/*/struct/*",
|
||||
|
||||
|
||||
"[eE]igen/*",
|
||||
|
||||
"gcem.hpp",
|
||||
@@ -95,9 +95,7 @@ scan_headers_ignore = [
|
||||
"gch/*",
|
||||
"sleipnir/*",
|
||||
"type_casters/*",
|
||||
"unsupported/*",
|
||||
"wpi/units/*",
|
||||
"wpimath/protobuf/*",
|
||||
|
||||
"wpi/math/util/MathShared.hpp",
|
||||
|
||||
@@ -1491,7 +1489,7 @@ includes = ["wpimath/geometry/include"]
|
||||
yaml_path = "semiwrap/geometry"
|
||||
|
||||
[tool.semiwrap.extension_modules."wpimath.geometry._geometry".headers]
|
||||
# frc/geometry
|
||||
# wpi/math/geometry
|
||||
CoordinateAxis = "wpi/math/geometry/CoordinateAxis.hpp"
|
||||
CoordinateSystem = "wpi/math/geometry/CoordinateSystem.hpp"
|
||||
Ellipse2d = "wpi/math/geometry/Ellipse2d.hpp"
|
||||
@@ -1515,7 +1513,7 @@ depends = ["wpimath_geometry"]
|
||||
yaml_path = "semiwrap/interpolation"
|
||||
|
||||
[tool.semiwrap.extension_modules."wpimath.interpolation._interpolation".headers]
|
||||
# frc/interpolation
|
||||
# wpi/math/interpolation
|
||||
TimeInterpolatableBuffer = "wpi/math/interpolation/TimeInterpolatableBuffer.hpp"
|
||||
|
||||
|
||||
@@ -1526,7 +1524,7 @@ depends = ["wpimath_geometry"]
|
||||
yaml_path = "semiwrap/kinematics"
|
||||
|
||||
[tool.semiwrap.extension_modules."wpimath.kinematics._kinematics".headers]
|
||||
# frc/kinematics
|
||||
# wpi/math/kinematics
|
||||
ChassisSpeeds = "wpi/math/kinematics/ChassisSpeeds.hpp"
|
||||
DifferentialDriveKinematics = "wpi/math/kinematics/DifferentialDriveKinematics.hpp"
|
||||
DifferentialDriveOdometry3d = "wpi/math/kinematics/DifferentialDriveOdometry3d.hpp"
|
||||
@@ -1555,7 +1553,7 @@ depends = ["wpimath_geometry"]
|
||||
yaml_path = "semiwrap/spline"
|
||||
|
||||
[tool.semiwrap.extension_modules."wpimath.spline._spline".headers]
|
||||
# frc/spline
|
||||
# wpi/math/spline
|
||||
CubicHermiteSpline = "wpi/math/spline/CubicHermiteSpline.hpp"
|
||||
QuinticHermiteSpline = "wpi/math/spline/QuinticHermiteSpline.hpp"
|
||||
Spline = "wpi/math/spline/Spline.hpp"
|
||||
@@ -1570,7 +1568,7 @@ depends = ["wpimath", "wpimath_geometry", "wpimath_kinematics", "wpimath_spline"
|
||||
yaml_path = "semiwrap/controls"
|
||||
|
||||
[tool.semiwrap.extension_modules."wpimath._controls._controls".headers]
|
||||
# frc/controller
|
||||
# wpi/math/controller
|
||||
ArmFeedforward = "wpi/math/controller/ArmFeedforward.hpp"
|
||||
BangBangController = "wpi/math/controller/BangBangController.hpp"
|
||||
ControlAffinePlantInversionFeedforward = "wpi/math/controller/ControlAffinePlantInversionFeedforward.hpp"
|
||||
@@ -1587,7 +1585,7 @@ PIDController = "wpi/math/controller/PIDController.hpp"
|
||||
ProfiledPIDController = "wpi/math/controller/ProfiledPIDController.hpp"
|
||||
SimpleMotorFeedforward = "wpi/math/controller/SimpleMotorFeedforward.hpp"
|
||||
|
||||
# frc/estimator
|
||||
# wpi/math/estimator
|
||||
# AngleStatistics = "wpi/math/estimator/AngleStatistics.hpp"
|
||||
DifferentialDrivePoseEstimator = "wpi/math/estimator/DifferentialDrivePoseEstimator.hpp"
|
||||
DifferentialDrivePoseEstimator3d = "wpi/math/estimator/DifferentialDrivePoseEstimator3d.hpp"
|
||||
@@ -1604,24 +1602,24 @@ SwerveDrivePoseEstimator3d = "wpi/math/estimator/SwerveDrivePoseEstimator3d.hpp"
|
||||
# UnscentedKalmanFilter = "wpi/math/estimator/UnscentedKalmanFilter.hpp"
|
||||
# UnscentedTransform = "wpi/math/estimator/UnscentedTransform.hpp"
|
||||
|
||||
# frc/optimization
|
||||
# wpi/math/optimization
|
||||
SimulatedAnnealing = "wpi/math/optimization/SimulatedAnnealing.hpp"
|
||||
|
||||
# frc/path
|
||||
# wpi/math/path
|
||||
TravelingSalesman = "wpi/math/path/TravelingSalesman.hpp"
|
||||
|
||||
# frc/system
|
||||
# wpi/math/system
|
||||
# Discretization = "wpi/math/system/Discretization.hpp"
|
||||
LinearSystem = "wpi/math/system/LinearSystem.hpp"
|
||||
LinearSystemLoop = "wpi/math/system/LinearSystemLoop.hpp"
|
||||
# NumericalIntegration = "wpi/math/system/NumericalIntegration.hpp"
|
||||
# NumericalJacobian = "wpi/math/system/NumericalJacobian.hpp"
|
||||
|
||||
# frc/system/plant
|
||||
# wpi/math/system/plant
|
||||
DCMotor = "wpi/math/system/plant/DCMotor.hpp"
|
||||
LinearSystemId = "wpi/math/system/plant/LinearSystemId.hpp"
|
||||
|
||||
# frc/trajectory
|
||||
# wpi/math/trajectory
|
||||
ExponentialProfile = "wpi/math/trajectory/ExponentialProfile.hpp"
|
||||
Trajectory = "wpi/math/trajectory/Trajectory.hpp"
|
||||
TrajectoryConfig = "wpi/math/trajectory/TrajectoryConfig.hpp"
|
||||
@@ -1629,7 +1627,7 @@ TrajectoryGenerator = "wpi/math/trajectory/TrajectoryGenerator.hpp"
|
||||
TrajectoryParameterizer = "wpi/math/trajectory/TrajectoryParameterizer.hpp"
|
||||
TrapezoidProfile = "wpi/math/trajectory/TrapezoidProfile.hpp"
|
||||
|
||||
# frc/trajectory/constraint
|
||||
# wpi/math/trajectory/constraint
|
||||
CentripetalAccelerationConstraint = "wpi/math/trajectory/constraint/CentripetalAccelerationConstraint.hpp"
|
||||
DifferentialDriveKinematicsConstraint = "wpi/math/trajectory/constraint/DifferentialDriveKinematicsConstraint.hpp"
|
||||
DifferentialDriveVoltageConstraint = "wpi/math/trajectory/constraint/DifferentialDriveVoltageConstraint.hpp"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from . import _init__wpimath_test
|
||||
|
||||
# autogenerated by 'robotpy-build create-imports wpimath_test'
|
||||
# autogenerated by 'semiwrap create-imports wpimath_test wpimath_test._wpimath_test'
|
||||
from ._wpimath_test import SomeClass
|
||||
|
||||
__all__ = ["SomeClass"]
|
||||
|
||||
9
wpinet/robotpy_pybind_build_info.bzl
generated
9
wpinet/robotpy_pybind_build_info.bzl
generated
@@ -1,5 +1,6 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
@@ -132,10 +133,17 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
tags = ["manual", "robotpy"],
|
||||
)
|
||||
|
||||
generate_version_file(
|
||||
name = "{}.generate_version".format(name),
|
||||
output_file = "src/main/python/wpinet/version.py",
|
||||
template = "//shared/bazel/rules/robotpy:version_template.in",
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
srcs = native.glob(["src/main/python/wpinet/**/*.py"]) + [
|
||||
"src/main/python/wpinet/_init__wpinet.py",
|
||||
"{}.generate_version".format(name),
|
||||
],
|
||||
data = [
|
||||
"{}.generated_pkgcfg_files".format(name),
|
||||
@@ -156,6 +164,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
yaml_output_directory = "src/main/python/semiwrap",
|
||||
extra_hdrs = native.glob(["src/main/python/**/*.h"], allow_empty = True) + [
|
||||
"//wpinet:robotpy-native-wpinet.copy_headers",
|
||||
"//wpiutil:robotpy-native-wpiutil.copy_headers",
|
||||
],
|
||||
package_root_file = "src/main/python/wpinet/__init__.py",
|
||||
pkgcfgs = pkgcfgs,
|
||||
|
||||
8
wpiutil/robotpy_pybind_build_info.bzl
generated
8
wpiutil/robotpy_pybind_build_info.bzl
generated
@@ -1,6 +1,7 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "publish_casters", "resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
@@ -193,10 +194,17 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
tags = ["manual", "robotpy"],
|
||||
)
|
||||
|
||||
generate_version_file(
|
||||
name = "{}.generate_version".format(name),
|
||||
output_file = "src/main/python/wpiutil/version.py",
|
||||
template = "//shared/bazel/rules/robotpy:version_template.in",
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
srcs = native.glob(["src/main/python/wpiutil/**/*.py"]) + [
|
||||
"src/main/python/wpiutil/_init__wpiutil.py",
|
||||
"{}.generate_version".format(name),
|
||||
],
|
||||
data = [
|
||||
"{}.generated_pkgcfg_files".format(name),
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
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_minimal_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",
|
||||
@@ -99,3 +104,57 @@ package_minimal_cc_project(
|
||||
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-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"),
|
||||
],
|
||||
)
|
||||
|
||||
34
xrpVendordep/robotpy_native_build_info.bzl
generated
Normal file
34
xrpVendordep/robotpy_native_build_info.bzl
generated
Normal file
@@ -0,0 +1,34 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "native_wrappery_library")
|
||||
|
||||
def define_native_wrapper(name, pyproject_toml = None):
|
||||
copy_to_directory(
|
||||
name = "{}.copy_headers".format(name),
|
||||
srcs = native.glob(["src/main/native/include/**"]) + native.glob(["src/generated/main/native/include/**"], allow_empty = True),
|
||||
out = "native/xrp/include",
|
||||
root_paths = ["src/main/native/include/"],
|
||||
replace_prefixes = {
|
||||
"xrpVendordep/src/generated/main/native/include": "",
|
||||
"xrpVendordep/src/main/native/include": "",
|
||||
},
|
||||
verbose = False,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
native_wrappery_library(
|
||||
name = name,
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml",
|
||||
libinit_file = "native/xrp/_init_robotpy_native_xrp.py",
|
||||
pc_file = "native/xrp/robotpy-native-xrp.pc",
|
||||
pc_deps = [
|
||||
"//wpilibc:native/wpilib/robotpy-native-wpilib.pc",
|
||||
],
|
||||
deps = [
|
||||
"//wpilibc:robotpy-native-wpilib",
|
||||
],
|
||||
headers = "{}.copy_headers".format(name),
|
||||
native_shared_library = "shared/xrpVendordep",
|
||||
install_path = "native/xrp/",
|
||||
)
|
||||
238
xrpVendordep/robotpy_pybind_build_info.bzl
generated
Normal file
238
xrpVendordep/robotpy_pybind_build_info.bzl
generated
Normal file
@@ -0,0 +1,238 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
|
||||
def xrp_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
XRP_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "XRPGyro",
|
||||
yml_file = "semiwrap/XRPGyro.yml",
|
||||
header_root = "$(execpath :robotpy-native-xrp.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-xrp.copy_headers)/wpi/xrp/XRPGyro.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::xrp::XRPGyro", "wpi__xrp__XRPGyro.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "XRPMotor",
|
||||
yml_file = "semiwrap/XRPMotor.yml",
|
||||
header_root = "$(execpath :robotpy-native-xrp.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-xrp.copy_headers)/wpi/xrp/XRPMotor.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::xrp::XRPMotor", "wpi__xrp__XRPMotor.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "XRPOnBoardIO",
|
||||
yml_file = "semiwrap/XRPOnBoardIO.yml",
|
||||
header_root = "$(execpath :robotpy-native-xrp.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-xrp.copy_headers)/wpi/xrp/XRPOnBoardIO.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::xrp::XRPOnBoardIO", "wpi__xrp__XRPOnBoardIO.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "XRPRangefinder",
|
||||
yml_file = "semiwrap/XRPRangefinder.yml",
|
||||
header_root = "$(execpath :robotpy-native-xrp.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-xrp.copy_headers)/wpi/xrp/XRPRangefinder.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::xrp::XRPRangefinder", "wpi__xrp__XRPRangefinder.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "XRPReflectanceSensor",
|
||||
yml_file = "semiwrap/XRPReflectanceSensor.yml",
|
||||
header_root = "$(execpath :robotpy-native-xrp.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-xrp.copy_headers)/wpi/xrp/XRPReflectanceSensor.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::xrp::XRPReflectanceSensor", "wpi__xrp__XRPReflectanceSensor.hpp"),
|
||||
],
|
||||
),
|
||||
struct(
|
||||
class_name = "XRPServo",
|
||||
yml_file = "semiwrap/XRPServo.yml",
|
||||
header_root = "$(execpath :robotpy-native-xrp.copy_headers)",
|
||||
header_file = "$(execpath :robotpy-native-xrp.copy_headers)/wpi/xrp/XRPServo.hpp",
|
||||
tmpl_class_names = [],
|
||||
trampolines = [
|
||||
("wpi::xrp::XRPServo", "wpi__xrp__XRPServo.hpp"),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
resolve_casters(
|
||||
name = "xrp.resolve_casters",
|
||||
caster_deps = ["//wpimath:src/main/python/wpimath/wpimath-casters.pybind11.json", "//wpiutil:src/main/python/wpiutil/wpiutil-casters.pybind11.json"],
|
||||
casters_pkl_file = "xrp.casters.pkl",
|
||||
dep_file = "xrp.casters.d",
|
||||
)
|
||||
|
||||
gen_libinit(
|
||||
name = "xrp.gen_lib_init",
|
||||
output_file = "src/main/python/xrp/_init__xrp.py",
|
||||
modules = ["native.xrp._init_robotpy_native_xrp", "wpilib._init__wpilib", "wpimath.geometry._init__geometry"],
|
||||
)
|
||||
|
||||
gen_pkgconf(
|
||||
name = "xrp.gen_pkgconf",
|
||||
libinit_py = "xrp._init__xrp",
|
||||
module_pkg_name = "xrp._xrp",
|
||||
output_file = "xrp.pc",
|
||||
pkg_name = "xrp",
|
||||
install_path = "src/main/python/xrp",
|
||||
project_file = "src/main/python/pyproject.toml",
|
||||
package_root = "src/main/python/xrp/__init__.py",
|
||||
)
|
||||
|
||||
gen_modinit_hpp(
|
||||
name = "xrp.gen_modinit_hpp",
|
||||
input_dats = [x.class_name for x in XRP_HEADER_GEN],
|
||||
libname = "_xrp",
|
||||
output_file = "semiwrap_init.xrp._xrp.hpp",
|
||||
)
|
||||
|
||||
run_header_gen(
|
||||
name = "xrp",
|
||||
casters_pickle = "xrp.casters.pkl",
|
||||
header_gen_config = XRP_HEADER_GEN,
|
||||
trampoline_subpath = "src/main/python/xrp",
|
||||
deps = header_to_dat_deps,
|
||||
local_native_libraries = [
|
||||
"//datalog:robotpy-native-datalog.copy_headers",
|
||||
"//hal:robotpy-native-wpihal.copy_headers",
|
||||
"//ntcore:robotpy-native-ntcore.copy_headers",
|
||||
"//wpilibc:robotpy-native-wpilib.copy_headers",
|
||||
"//wpimath:robotpy-native-wpimath.copy_headers",
|
||||
"//wpinet:robotpy-native-wpinet.copy_headers",
|
||||
"//wpiutil:robotpy-native-wpiutil.copy_headers",
|
||||
"//xrpVendordep:robotpy-native-xrp.copy_headers",
|
||||
],
|
||||
)
|
||||
|
||||
create_pybind_library(
|
||||
name = "xrp",
|
||||
install_path = "src/main/python/xrp/",
|
||||
extension_name = "_xrp",
|
||||
generated_srcs = [":xrp.generated_srcs"],
|
||||
semiwrap_header = [":xrp.gen_modinit_hpp"],
|
||||
deps = [
|
||||
":xrp.tmpl_hdrs",
|
||||
":xrp.trampoline_hdrs",
|
||||
"//wpilibc:wpilib_pybind_library",
|
||||
"//wpilibc:wpilibc",
|
||||
"//wpimath:wpimath",
|
||||
"//wpimath:wpimath_geometry_pybind_library",
|
||||
"//xrpVendordep:xrpVendordep",
|
||||
],
|
||||
dynamic_deps = [
|
||||
"//wpilibc:shared/wpilibc",
|
||||
"//wpimath:shared/wpimath",
|
||||
"//xrpVendordep:shared/xrpVendordep",
|
||||
],
|
||||
extra_hdrs = extra_hdrs,
|
||||
extra_srcs = srcs,
|
||||
includes = includes,
|
||||
)
|
||||
|
||||
native.filegroup(
|
||||
name = "xrp.generated_files",
|
||||
srcs = [
|
||||
"xrp.gen_modinit_hpp.gen",
|
||||
"xrp.header_gen_files",
|
||||
"xrp.gen_pkgconf",
|
||||
"xrp.gen_lib_init",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
)
|
||||
|
||||
def define_pybind_library(name, pkgcfgs = []):
|
||||
# Helper used to generate all files with one target.
|
||||
native.filegroup(
|
||||
name = "{}.generated_files".format(name),
|
||||
srcs = [
|
||||
"xrp.generated_files",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Files that will be included in the wheel as data deps
|
||||
native.filegroup(
|
||||
name = "{}.generated_pkgcfg_files".format(name),
|
||||
srcs = [
|
||||
"src/main/python/xrp/xrp.pc",
|
||||
],
|
||||
tags = ["manual", "robotpy"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Contains all of the non-python files that need to be included in the wheel
|
||||
native.filegroup(
|
||||
name = "{}.extra_files".format(name),
|
||||
srcs = native.glob(["src/main/python/xrp/**"], exclude = ["src/main/python/xrp/**/*.py"], allow_empty = True),
|
||||
tags = ["manual", "robotpy"],
|
||||
)
|
||||
|
||||
generate_version_file(
|
||||
name = "{}.generate_version".format(name),
|
||||
output_file = "src/main/python/xrp/version.py",
|
||||
template = "//shared/bazel/rules/robotpy:version_template.in",
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
srcs = native.glob(["src/main/python/xrp/**/*.py"]) + [
|
||||
"src/main/python/xrp/_init__xrp.py",
|
||||
"{}.generate_version".format(name),
|
||||
],
|
||||
data = [
|
||||
"{}.generated_pkgcfg_files".format(name),
|
||||
"{}.extra_files".format(name),
|
||||
":src/main/python/xrp/_xrp",
|
||||
":xrp.trampoline_hdr_files",
|
||||
],
|
||||
imports = ["src/main/python"],
|
||||
deps = [
|
||||
"//wpilibc:robotpy-wpilib",
|
||||
"//xrpVendordep:robotpy-native-xrp",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
update_yaml_files(
|
||||
name = "{}-update-yaml".format(name),
|
||||
yaml_output_directory = "src/main/python/semiwrap",
|
||||
extra_hdrs = native.glob(["src/main/python/**/*.h"], allow_empty = True) + [
|
||||
"//datalog:robotpy-native-datalog.copy_headers",
|
||||
"//hal:robotpy-native-wpihal.copy_headers",
|
||||
"//ntcore:robotpy-native-ntcore.copy_headers",
|
||||
"//wpilibc:robotpy-native-wpilib.copy_headers",
|
||||
"//wpimath:robotpy-native-wpimath.copy_headers",
|
||||
"//wpinet:robotpy-native-wpinet.copy_headers",
|
||||
"//wpiutil:robotpy-native-wpiutil.copy_headers",
|
||||
"//xrpVendordep:robotpy-native-xrp.copy_headers",
|
||||
],
|
||||
package_root_file = "src/main/python/xrp/__init__.py",
|
||||
pkgcfgs = pkgcfgs,
|
||||
pyproject_toml = "src/main/python/pyproject.toml",
|
||||
yaml_files = native.glob(["src/main/python/semiwrap/**"]),
|
||||
)
|
||||
|
||||
scan_headers(
|
||||
name = "{}-scan-headers".format(name),
|
||||
extra_hdrs = native.glob(["src/main/python/**/*.h"], allow_empty = True) + [
|
||||
"//xrpVendordep:robotpy-native-xrp.copy_headers",
|
||||
],
|
||||
package_root_file = "src/main/python/xrp/__init__.py",
|
||||
pkgcfgs = pkgcfgs,
|
||||
pyproject_toml = "src/main/python/pyproject.toml",
|
||||
)
|
||||
Reference in New Issue
Block a user