Anybody that is using my repositories for the toolchain/cmake/wpilib should no longer have to create any symlinks to the munch.sh, strip_syms.sh scripts or the host directory. It was just a bug in where the cmake toolchain file was looking for them. I'll also write a little comprehensive "howto" on installing the toolchain. Please note that I have not yet tried putting this code onto the robot, but if what rbmj did works, this should as well.
I've also added gcc-4.7.2 support to the vxworks-gcc-patches repository. If you want to use gcc-4.7.2, you may even though it is experimental. Just checkout the gcc-4.7.2 branch after cloning in to the repository, then continue as normal.
Begin Simple Install Tutorial
First, we'll need to create a directory to do all of our building in. I use ~/workspace in my home directory, but thats just me. This is NOT, I repeat NOT where the toolchain and things are installed, so it doesn't need to be on the PATH or anything. Run the following commands to get all the projects "cloned" from github.
Code:
mkdir -p ~/workspace
cd ~/workspace
git clone git://github.com/mcoffin/vxworks-gcc-patches.git
git clone git://github.com/mcoffin/cmake_vxworks.git cmake-vxworks
git clone git://github.com/mcoffin/wpilib.git
You will now have the subdirectories "vxworks-gcc-patches", "cmake-vxworks", and "wpilib" under your workspace. The first thing to do is have the vxworks-gcc-patches project download and compile GCC for you.Run the following commands to do this.
Code:
cd vxworks-gcc-patches
sudo make install
If you don't get any errors, the toolchain should have installed to "/usr/local". Next, you'll need to set the WIND_BASE variable just to satisfy gcc.
Code:
export WIND_BASE=/usr/local/powerpc-wrs-vxworks/wind_base
Finally, you'll have to build WPILib, so that you can link it with your robot's code. For some reason, on one of my machines, I have to run cmake twice to get the install directory to be set properly. I would recommend doing just to make sure you don't install WPILib to some weird place.
Code:
cd ~/workspace/wpilib
cmake . -DCMAKE_TOOLCHAIN_FILE=/path/to/workspace/cmake-vxworks/vxworks_toolchain.cmake
cmake . -DCMAKE_TOOLCHAIN_FILE=/path/to/workspace/cmake-vxworks/vxworks_toolchain.cmake
make
sudo make install
Then, you'll have to write a simple CMakeLists.txt file to compile your robot code. Assuming your robot code is stored in a directory called 'src' under the CMakeLists.txt file, the following CMakeLists.txt will work. It would be really easy to modify this for your robot's needs.
Code:
cmake_minimum_required(VERSION 2.8)
project(FRC)
set(CMAKE_MODULE_PATH /path/to/cmake-vxworks/cmake/Modules)
find_package(WPILib REQUIRED)
include_directories(${WPILib_INCLUDE_DIR})
include_directories(src)
file(GLOB_RECURSE SOURCES "src/*.cpp")
add_executable(FRC_UserProgram ${SOURCES})
set_target_properties(FRC_UserProgram PROPERTIES
SUFFIX .out
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
target_link_libraries(${WPILib_LIBRARY})
Finally, change directory to your your robot's CMakeLists.txt file, run cmake the same way we did for WPILib, then
If you don't get any errors, then your program should be compiled to bin/FRC_UserProgram.out. This can then be pushed to the robot with
Ross Light's frctool or just an FTP client.