eclipse / mraa

Linux Library for low speed IO Communication in C with bindings for C++, Python, Node.js & Java. Supports generic io platforms, as well as Intel Edison, Intel Joule, Raspberry Pi and many more.
http://mraa.io
MIT License
1.38k stars 615 forks source link

Support for cross compiling with linaro toolchain #188

Open michael-ring opened 9 years ago

michael-ring commented 9 years ago

I today discovered the directory cmake/Toolchains, a nice place to put my cmake toolchain file for crosscompiling the arm targets.

I am not a cmake guru, perhaps you guys can have a look on how to better optimize the file so that it works for as much platforms as possible:

One easy thing to do is to remove the absolute paths to gcc and g++, I am not sure how to handle

SET(CMAKE_FIND_ROOT_PATH /usr/local/linaro/arm-linux-gnueabihf/) or SET(SYSTEM_USR_DIR /usr/local/linaro/arm-linux-gnueabihf/) in an (if possible) system independant way.

Michael


# this one is important
SET(CMAKE_SYSTEM_NAME Linux)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)

# specify the cross compiler
SET(CMAKE_C_COMPILER   /usr/local/linaro/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc)
SET(CMAKE_CXX_COMPILER /usr/local/linaro/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++)

# where is the target environment 
SET(CMAKE_FIND_ROOT_PATH  /usr/local/linaro/arm-linux-gnueabihf/)

# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(SYSTEM_USR_DIR /usr/local/linaro/arm-linux-gnueabihf/)
arfoll commented 9 years ago

Looks ok tbh, the cool thing about the oe/yocto toolchain is that it comes with it's own 'env' file so that compiler paths etc don't have to be hard set. Does the linaro toolchain not come with something like this?