Wanted to use C++ but chose Java instead because Eclipse is cross-platform?
Using C++ and wishing you could use a newer version of gcc, with performance and optimization improvements? Wanted a native gcc build on linux?
Wishing you could use C++11 features in your robot code? Lambdas, rvalue references, standard library improvements, the whole 9 yards?
After a lot of work by several people, I can say that there are working build scripts for a complete C++ toolchain using GCC 4.7.0. Thanks for the build script go to the following people:
- Austin Schuh
- Ross Light
- Cody Schafer
GCC Build Scripts can be found here:
https://github.com/rbmj/vxworks-gcc-patches
Static-Linked GCC Binaries are in the “Downloads” Section. The binaries I built should run on any modern amd64 linux machine, but I’m not sure, so please test!
WPILib patched for new GCC is here:
The binaries in the downloads section should work on any linux machine.
I don’t have any windows binaries as I haven’t ported the build script to windows, but if anyone wants to help with that, that would be REALLY COOL
Finally, I have a toolchain file for CMake. This toolchain file is here:
https://github.com/rbmj/cmake_vxworks
You will need to use this toolchain file if you want to compile WPILib. TODO: Give WPILib a find_package/.config file!
An example CMakeLists.txt file for a simple robot project:
cmake_minimum_required(VERSION 2.8)
#project specific EXAMPLE
project(FRC)
set(FRC_SOURCES main.cpp) #just add to this list here
set(FRC_INCLUDES ${WPILIB_INCLUDE_DIR}) #defined by the toolchain
set(FRC_LIBS ${WPILIB_LIBRARY}) #ditto
# below here should stay pretty much the same
add_executable(FRC_UserProgram ${FRC_SOURCES})
set_target_properties(FRC_UserProgram PROPERTIES SUFFIX .out)
target_link_libraries(FRC_UserProgram ${FRC_LIBS})
include_directories(${FRC_INCLUDES})
compile with:
$ cmake /path/to/repo/robot_test -DCMAKE_TOOLCHAIN_FILE=/path/to/toolchain/vxworks_toolchain.cmake
$ make
$ wput -u FRC_UserProgram.out ftp://10.xx.yy.12/ni-rt/system/ #deploy
CMake is awesome - use it! This toolchain is NOT COMPATIBLE with the ucpp makefiles, so if you want a working executable you MUST use CMake!
TODO:
- Do more extensive tests, including C++11 features
- Make the build scripts nicer and less crufty
- Get a working windows port