As a new user, I cannot put more than two links in a message. Please see here for resources mentioned.
Hey all,
I’m creating device drivers to use the pixy2 [1] camera with the roboRIO. Kentridge Robotics ported the Pixy2 Arduino library [2] to make Pixy2JavaAPI [3]. I’ve chosen to use swig [4] to generate Java bindings for the libpixyusb2 [5] library. I have been able to write a Bash script to call swig and gcc to compile libpixyusb2, but I’m having a very difficult time creating a Gradle build system that. Some of its jobs include:
- Call Swig to generate interface bindings.
- Compile
libpixyusb2aslibpixyusb2_cpp_api, and link it tolibusb, producing a.soor a.dll. - Compile
libpixyusb2_java_app, and include thelibpixyusb2_cpp_apishared object inside the JAR.
Thus far, my build system is able to do these things, and run a piece of sample code, but, despite countless hours of research, I have not been able to compile the C portion for the roboRIO, through Gradle.
I have found that WPILib’s own GradleRIO [6] leverages their native-utils [7] libraries. native-utils looks promising, however I have not found any way to successfully use it to invoke arm-frc2019-linux-gnueabi-g++. I have also found Pathfinder V2 [8] to be a good example of a library that is built for roboRIO as well as desktop:
Kyle@CometObservatory MINGW64 ~/Documents/Projects/Java/Robot/Pathfinder (master)
$ ./gradlew tasks
buildDependentsPathfinderjniLinuxathenaDebugSharedLibrary - Build dependents of shared library 'pathfinderjni:linuxathena:debug:sharedLibrary'.
buildDependentsPathfinderjniLinuxathenaDebugStaticLibrary - Build dependents of static library 'pathfinderjni:linuxathena:debug:staticLibrary'.
buildDependentsPathfinderjniLinuxathenaReleaseSharedLibrary - Build dependents of shared library 'pathfinderjni:linuxathena:release:sharedLibrary'.
buildDependentsPathfinderjniLinuxathenaReleaseStaticLibrary - Build dependents of static library 'pathfinderjni:linuxathena:release:staticLibrary'.
buildDependentsPathfinderjniLinuxraspbianDebugSharedLibrary - Build dependents of shared library 'pathfinderjni:linuxraspbian:debug:sharedLibrary'.
buildDependentsPathfinderjniLinuxraspbianDebugStaticLibrary - Build dependents of static library 'pathfinderjni:linuxraspbian:debug:staticLibrary'.
buildDependentsPathfinderjniLinuxraspbianReleaseSharedLibrary - Build dependents of shared library 'pathfinderjni:linuxraspbian:release:sharedLibrary'.
buildDependentsPathfinderjniLinuxraspbianReleaseStaticLibrary - Build dependents of static library 'pathfinderjni:linuxraspbian:release:staticLibrary'.
buildDependentsPathfinderjniWindowsx86-64DebugSharedLibrary - Build dependents of shared library 'pathfinderjni:windowsx86-64:debug:sharedLibrary'.
buildDependentsPathfinderjniWindowsx86-64DebugStaticLibrary - Build dependents of static library 'pathfinderjni:windowsx86-64:debug:staticLibrary'.
buildDependentsPathfinderjniWindowsx86-64ReleaseSharedLibrary - Build dependents of shared library 'pathfinderjni:windowsx86-64:release:sharedLibrary'.
buildDependentsPathfinderjniWindowsx86-64ReleaseStaticLibrary - Build dependents of static library 'pathfinderjni:windowsx86-64:release:staticLibrary'.
buildDependentsPathfinderjniWindowsx86DebugSharedLibrary - Build dependents of shared library 'pathfinderjni:windowsx86:debug:sharedLibrary'.
buildDependentsPathfinderjniWindowsx86DebugStaticLibrary - Build dependents of static library 'pathfinderjni:windowsx86:debug:staticLibrary'.
buildDependentsPathfinderjniWindowsx86ReleaseSharedLibrary - Build dependents of shared library 'pathfinderjni:windowsx86:release:sharedLibrary'.
buildDependentsPathfinderjniWindowsx86ReleaseStaticLibrary - Build dependents of static library 'pathfinderjni:windowsx86:release:staticLibrary'.
I have tried to use Pathfinder’s Gradle code in my own library, but I haven’t had any success, I believe because their code uses the old software model [9]. As it stands, my build code uses the new C++ plugins [10], and I have not found a way to do what I currently do in the old software model.
To reiterate, I am creating a library that utilizes Java and C++ in tandem, but I am unable to configure the Gradle build system to compile for the roboRIO, rather than desktop. The WIP library is currently located here. I would be more than happy to clarify any pieces of what I have done, what hasn’t worked, or what I’m trying to accomplish. Much thanks for any guidance.