From a848cc8e89a8f4b87d6c73007c393b23fa1f423d Mon Sep 17 00:00:00 2001 From: Hugo Freire Date: Sat, 27 Aug 2016 16:53:44 +0200 Subject: [PATCH] Added cross-compilation for ARM. --- .../linux/toolchain/arm-linux-gnueabihf.cmake | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 cmake/platforms/linux/toolchain/arm-linux-gnueabihf.cmake diff --git a/cmake/platforms/linux/toolchain/arm-linux-gnueabihf.cmake b/cmake/platforms/linux/toolchain/arm-linux-gnueabihf.cmake new file mode 100644 index 0000000..a885eb8 --- /dev/null +++ b/cmake/platforms/linux/toolchain/arm-linux-gnueabihf.cmake @@ -0,0 +1,22 @@ + +# +# CMake defines to cross-compile to ARM/Linux on BCM2708 using glibc. +# + +SET(CMAKE_SYSTEM_NAME Linux) +SET(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc) +SET(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++) +SET(CMAKE_ASM_COMPILER arm-linux-gnueabihf-gcc) +SET(CMAKE_SYSTEM_PROCESSOR arm) + +#ADD_DEFINITIONS("-march=armv6") +add_definitions("-mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -marm") + +# rdynamic means the backtrace should work +IF (CMAKE_BUILD_TYPE MATCHES "Debug") + add_definitions(-rdynamic) +ENDIF () + +# avoids annoying and pointless warnings from gcc +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE") +SET(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -c")