From 9a6dee283bd82f061b583395f8757c3cf2a9b710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Berm=C3=BAdez=20Ortega?= <34604561+julianbermudez@users.noreply.github.com> Date: Mon, 1 Apr 2019 15:35:06 +0200 Subject: [PATCH] Raspberry Pi toolchain (#78) * Refs #4671. Add Raspberry Pi toolchain. * Refs #4671. Fix Windows error compilation. --- CMakeLists.txt | 10 ++++++++-- toolchains/nuttx_toolchain.cmake | 2 -- toolchains/raspberrypi_toolchain.cmake | 13 +++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 toolchains/raspberrypi_toolchain.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 19a97806..fc21be74 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -184,8 +184,14 @@ set_target_properties(${PROJECT_NAME} PROPERTIES C_STANDARD_REQUIRED YES ) -target_link_libraries(${PROJECT_NAME} PUBLIC microcdr - $<$:ws2_32> +target_compile_options(${PROJECT_NAME} PRIVATE $<$:-fdata-sections -ffunction-sections>) + +target_link_libraries(${PROJECT_NAME} + PUBLIC + microcdr + $<$>:ws2_32> + PRIVATE + $<$>:rt> ) target_include_directories(${PROJECT_NAME} PUBLIC diff --git a/toolchains/nuttx_toolchain.cmake b/toolchains/nuttx_toolchain.cmake index b27c3f23..e3d9ad02 100644 --- a/toolchains/nuttx_toolchain.cmake +++ b/toolchains/nuttx_toolchain.cmake @@ -33,5 +33,3 @@ add_compile_options( ${ARCH_CPU_FLAGS} ${ARCH_OPT_FLAGS} ) - -set(__BIG_ENDIAN__ 0) diff --git a/toolchains/raspberrypi_toolchain.cmake b/toolchains/raspberrypi_toolchain.cmake new file mode 100644 index 00000000..9ce8c478 --- /dev/null +++ b/toolchains/raspberrypi_toolchain.cmake @@ -0,0 +1,13 @@ +set(CMAKE_SYSTEM_NAME Linux) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + +set(CMAKE_C_COMPILER ${RPI_COMPILER}/arm-linux-gnueabihf-gcc) +set(CMAKE_CXX_COMPILER ${RPI_COMPILER}/arm-linux-gnueabihf-g++) + +add_compile_options( + -std=c99 + )