How to use external vendordeps with CMake WPILib

i am following the instructions here: allwpilib/README-CMAKE.md at main · wpilibsuite/allwpilib · GitHub

how do I use external vendordeps (phoenix6, revlib, etc) with CMake-built wpilib? the documentation seems to only mention built-in vendordeps (romi and xrp).

on another note if someone knows, is there a way to use wpilib in another cmake project without installing? im sure theres a way but if someone can point me in the right direction thatd be great

Vendordeps are completely DIY with cmake. You’ll need to look at the json, download the appropriate maven artifacts, extract them, and point your cmake build to those headers/libraries.

At least in its current form, the cmake build is not intended for building robot programs. Its purpose is primarily to support coprocessors for which we don’t build pre-built binaries, but want to have ntcore or cscore libraries available.

Regarding using the cmake build without installing it, it should be possible to use cmake ExternalProject.

2 Likes

okay, makes sense. one thing I could not figure out was finding the maven artifacts. i was able to get to the maven-metadata.xml file for a given group and artifact id, but not how gradlerio converts the data given in the json file into a maven url for an actual file.

(ive figured out now that revlib distributes files on github too, and ctre is moot because they require apt)

Take a look at vendor-json-repo/check.py at master · wpilibsuite/vendor-json-repo · GitHub, in particular the MavenFetcher class and how it’s used in check_file().

1 Like

this helps a lot, thanks!

One thing to note is that our apt distribution is our non-FRC (non-WPI) distribution.
If you want classes that implement WPILib classes you’ll need to grab them from our maven, which the MavenFetcher class should cover.
If all you want is generic Phoenix6 and don’t care about the WPILib integration, then apt along with find_package(phoenix6) should be fine.

3 Likes

good to know. on another note, does the FRC version of phoenix6 support socketcan?

Yep, the requirements between using the FRC and non-FRC variants of our libraries are essentially identical (everything plus WPILib). You can reference the non-FRC requirements here, but it boils down to socketCAN for Linux and CANivore for Windows.

1 Like