mirror of
https://github.com/OpenEtherCATsociety/SOEM.git
synced 2026-09-25 10:59:39 +08:00
Remove rt-kernel toolchain
Remove local toolchain in favour of version from installed rt-kernel tree. Change-Id: I4d27254c5884f45b7d055d441c4528ee85a4b526
This commit is contained in:
@@ -1,102 +0,0 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# www.rt-labs.com
|
||||
# Copyright 2017 rt-labs AB, Sweden.
|
||||
#
|
||||
# This software is licensed under the terms of the BSD 3-clause
|
||||
# license. See the file LICENSE distributed with this software for
|
||||
# full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
include_guard()
|
||||
cmake_minimum_required (VERSION 3.16)
|
||||
|
||||
# Avoid warning when re-running cmake
|
||||
set(DUMMY ${CMAKE_TOOLCHAIN_FILE})
|
||||
|
||||
# No support for shared libs
|
||||
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
|
||||
|
||||
set(UNIX 1)
|
||||
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
|
||||
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".elf")
|
||||
|
||||
# Do not build executables during configuration stage. Required
|
||||
# libraries may not be built yet.
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
|
||||
# Prefer standard extensions
|
||||
set(CMAKE_C_OUTPUT_EXTENSION_REPLACE 1)
|
||||
set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
|
||||
set(CMAKE_ASM_OUTPUT_EXTENSION_REPLACE 1)
|
||||
|
||||
# Add machine-specific flags
|
||||
add_compile_options(${MACHINE})
|
||||
add_link_options(${MACHINE})
|
||||
|
||||
if (NOT ${VARIANT} STREQUAL "")
|
||||
add_definitions(-D${VARIANT})
|
||||
endif()
|
||||
|
||||
# Common flags
|
||||
add_compile_options(
|
||||
-fdata-sections
|
||||
-ffunction-sections
|
||||
-fomit-frame-pointer
|
||||
-fno-strict-aliasing
|
||||
-fshort-wchar
|
||||
)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions")
|
||||
|
||||
# Linker script
|
||||
set(TYPE "" CACHE STRING "BSP link type")
|
||||
if (NOT ${TYPE} STREQUAL "")
|
||||
set(_TYPE "_${TYPE}")
|
||||
endif()
|
||||
|
||||
define_property(TARGET
|
||||
PROPERTY BSP_LINK_SCRIPT INHERITED
|
||||
BRIEF_DOCS "Define the linker script to use when linking executable"
|
||||
FULL_DOCS "Define the linker script to use when linking executable"
|
||||
)
|
||||
|
||||
set_directory_properties(
|
||||
PROPERTIES BSP_LINK_SCRIPT ${BSP_DIR}/${BSP}${_TYPE}.ld
|
||||
)
|
||||
|
||||
# Linker flags
|
||||
add_link_options(
|
||||
-nostartfiles
|
||||
-T$<TARGET_PROPERTY:BSP_LINK_SCRIPT>
|
||||
-Wl,--gc-sections
|
||||
)
|
||||
|
||||
# Standard libraries
|
||||
link_libraries(
|
||||
c
|
||||
m
|
||||
$<$<LINK_LANGUAGE:CXX>:-lstdc++>
|
||||
)
|
||||
|
||||
# Group libraries when linking
|
||||
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--start-group <LINK_LIBRARIES> -Wl,--end-group -Wl,-Map=<TARGET>.map,--cref")
|
||||
|
||||
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--start-group <LINK_LIBRARIES> -Wl,--end-group -Wl,-Map=<TARGET>.map,--cref")
|
||||
|
||||
# Macro to add TTOS schedule
|
||||
macro(target_tt_schedule target infile)
|
||||
find_package(Python3 REQUIRED)
|
||||
string(REPLACE .tt .c outfile ${infile})
|
||||
add_custom_command(
|
||||
OUTPUT ${outfile}
|
||||
COMMAND ${Python3_EXECUTABLE} ${TT_PARSE} ${CMAKE_CURRENT_LIST_DIR}/${infile} > ${outfile}
|
||||
DEPENDS ${infile}
|
||||
)
|
||||
target_sources(${target} PRIVATE ${outfile})
|
||||
endmacro()
|
||||
@@ -1,17 +0,0 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2014 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mthumb-interwork
|
||||
-mlittle-endian
|
||||
-mthumb
|
||||
)
|
||||
@@ -1,16 +0,0 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2010 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mlittle-endian
|
||||
-mcpu=arm926ej-s
|
||||
)
|
||||
@@ -1,15 +0,0 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2011 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mcpu=bf537
|
||||
)
|
||||
@@ -1,17 +0,0 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2017 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mcpu=cortex-a8
|
||||
-mfpu=neon
|
||||
-mfloat-abi=hard
|
||||
)
|
||||
@@ -1,16 +0,0 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2011 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mfpu=neon
|
||||
-mcpu=cortex-a8
|
||||
)
|
||||
@@ -1,17 +0,0 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2014 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mcpu=cortex-a9
|
||||
-mfpu=vfpv3-d16
|
||||
-mfloat-abi=hard
|
||||
)
|
||||
@@ -1,16 +0,0 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2014 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mfpu=neon
|
||||
-mcpu=cortex-a9
|
||||
)
|
||||
@@ -1,17 +0,0 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2011 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mfpu=vfp
|
||||
-mcpu=cortex-m3
|
||||
-mthumb
|
||||
)
|
||||
@@ -1,15 +0,0 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2011 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mcpu=cortex-m33+nodsp
|
||||
)
|
||||
@@ -1,18 +0,0 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2024 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mcpu=cortex-m33
|
||||
-mthumb
|
||||
-mfloat-abi=hard
|
||||
-mfpu=fpv5-sp-d16
|
||||
)
|
||||
@@ -1,17 +0,0 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2011 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mfpu=vfp
|
||||
-mcpu=cortex-m4
|
||||
-mthumb
|
||||
)
|
||||
@@ -1,18 +0,0 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2011 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mcpu=cortex-m4
|
||||
-mthumb
|
||||
-mfloat-abi=hard
|
||||
-mfpu=fpv4-sp-d16
|
||||
)
|
||||
@@ -1,18 +0,0 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2011 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mcpu=cortex-m7
|
||||
-mthumb
|
||||
-mfloat-abi=hard
|
||||
-mfpu=fpv4-sp-d16
|
||||
)
|
||||
@@ -1,18 +0,0 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2011 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mcpu=cortex-m7
|
||||
-mthumb
|
||||
-mfloat-abi=hard
|
||||
-mfpu=fpv5-d16
|
||||
)
|
||||
@@ -1,18 +0,0 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2018 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mcpu=cortex-r5
|
||||
-mthumb
|
||||
-mfloat-abi=hard
|
||||
-mfpu=vfpv3-d16
|
||||
)
|
||||
@@ -1,18 +0,0 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2011 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mcpu=8540
|
||||
-mregnames
|
||||
-mmultiple
|
||||
-mabi=spe
|
||||
)
|
||||
@@ -1,19 +0,0 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2011 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mbig
|
||||
-mregnames
|
||||
-mcpu=powerpc
|
||||
-mcall-sysv
|
||||
-meabi
|
||||
)
|
||||
@@ -1,148 +0,0 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# www.rt-labs.com
|
||||
# Copyright 2017 rt-labs AB, Sweden.
|
||||
#
|
||||
# This software is licensed under the terms of the BSD 3-clause
|
||||
# license. See the file LICENSE distributed with this software for
|
||||
# full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
rt-kernel toolchain
|
||||
-------------------
|
||||
|
||||
The following variables must be set when cmake configuration is
|
||||
invoked::
|
||||
|
||||
BSP - Name of Board Support Package
|
||||
|
||||
The following variables are optional::
|
||||
|
||||
COMPILERS - Compiler search path, defaults to /opt/rt-tools/compilers
|
||||
RTK - Location of rt-kernel tree, defaults to root of toolchain file
|
||||
BSP_DIR - Location of BSP directory, defaults to ${RTK}/bsp/${BSP}
|
||||
TT_PARSE - Location of tt_parse, defaults to ${RTK}/script/tt_parse.py
|
||||
|
||||
The variables can set from environment variables or from CMake
|
||||
configuration. Your CMAKE_MODULE_PATH must also be configured so that
|
||||
Platform/rt-kernel.cmake can be found.
|
||||
|
||||
Example to build for the xmc48relax board::
|
||||
|
||||
BSP=xmc48relax cmake \
|
||||
-B build.xmc48relax \
|
||||
-S /path/to/rt-kernel \
|
||||
-DCMAKE_TOOLCHAIN_FILE=/path/to/rt-kernel.cmake \
|
||||
-G "Unix Makefiles"
|
||||
|
||||
The variables can also be set from the root CMakeLists.txt. Example to
|
||||
build using an out-of-tree BSP::
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
set(ENV{BSP} mybsp)
|
||||
set(ENV{BSP_DIR} "${CMAKE_CURRENT_LIST_DIR}/mybsp")
|
||||
set(ENV{RTK} "${CMAKE_CURRENT_LIST_DIR}/rt-kernel")
|
||||
list(APPEND CMAKE_MODULE_PATH "$ENV{RTK}/cmake")
|
||||
project (MYPROJECT VERSION 2.0.1)
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
include_guard()
|
||||
cmake_minimum_required (VERSION 3.16)
|
||||
|
||||
# The name of the target operating system
|
||||
set(CMAKE_SYSTEM_NAME rt-kernel)
|
||||
|
||||
# Default toolchain search path
|
||||
if (NOT DEFINED ENV{COMPILERS})
|
||||
set(ENV{COMPILERS} "/opt/rt-tools/compilers")
|
||||
endif()
|
||||
set(COMPILERS $ENV{COMPILERS} CACHE PATH
|
||||
"Location of compiler toolchain")
|
||||
|
||||
# Default rt-kernel location
|
||||
if(NOT DEFINED ENV{RTK})
|
||||
# Set default to grand-parent of current dir
|
||||
get_filename_component(RTK_ROOT
|
||||
${CMAKE_CURRENT_LIST_DIR}/../..
|
||||
ABSOLUTE
|
||||
)
|
||||
set(ENV{RTK} ${RTK_ROOT})
|
||||
endif()
|
||||
set(RTK $ENV{RTK} CACHE PATH
|
||||
"Location of rt-kernel tree")
|
||||
|
||||
# Name of BSP
|
||||
set(BSP $ENV{BSP} CACHE STRING
|
||||
"The name of the BSP to build for")
|
||||
|
||||
# Default BSP dir
|
||||
if(NOT DEFINED ENV{BSP_DIR})
|
||||
set(ENV{BSP_DIR} ${RTK}/bsp/${BSP})
|
||||
endif()
|
||||
set(BSP_DIR $ENV{BSP_DIR} CACHE PATH
|
||||
"Location of BSP")
|
||||
|
||||
# Default tt_parse search path
|
||||
if (NOT DEFINED ENV{TT_PARSE})
|
||||
set(ENV{TT_PARSE} "${RTK}/script/tt_parse.py")
|
||||
endif()
|
||||
set(TT_PARSE $ENV{TT_PARSE} CACHE FILEPATH
|
||||
"Location of tt_parse")
|
||||
|
||||
message(STATUS "BSP: ${BSP}")
|
||||
message(STATUS "BSP_DIR: ${BSP_DIR}")
|
||||
message(STATUS "RTK: ${RTK}")
|
||||
|
||||
# Variables required for cmake try_compile phase
|
||||
list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
|
||||
"BSP"
|
||||
"BSP_DIR"
|
||||
)
|
||||
|
||||
# Check that BSP is set
|
||||
if (NOT BSP)
|
||||
message(FATAL_ERROR "BSP has not been set")
|
||||
endif()
|
||||
|
||||
# Check that bsp.mk exists
|
||||
set(BSP_MK_FILE ${BSP_DIR}/${BSP}.mk)
|
||||
if (NOT EXISTS ${BSP_MK_FILE})
|
||||
message(FATAL_ERROR "Failed to open ${BSP_MK_FILE}")
|
||||
endif()
|
||||
|
||||
# Slurp bsp.mk contents
|
||||
file(READ ${BSP_MK_FILE} BSP_MK)
|
||||
|
||||
# Get CPU
|
||||
string(REGEX MATCH "CPU=([A-Za-z0-9_\-]*)" _ ${BSP_MK})
|
||||
set(CPU ${CMAKE_MATCH_1})
|
||||
|
||||
# Get ARCH
|
||||
string(REGEX MATCH "ARCH=([A-Za-z0-9_\-]*)" _ ${BSP_MK})
|
||||
set(ARCH ${CMAKE_MATCH_1})
|
||||
|
||||
# Get VARIANT
|
||||
string(REGEX MATCH "VARIANT=([A-Za-z0-9_\-]*)" _ ${BSP_MK})
|
||||
set(VARIANT ${CMAKE_MATCH_1})
|
||||
|
||||
# Get CROSS_GCC
|
||||
string(REGEX MATCH "CROSS_GCC=([A-Za-z0-9_\-]*)" _ ${BSP_MK})
|
||||
set(CROSS_GCC ${CMAKE_MATCH_1})
|
||||
|
||||
# Set cross-compiler toolchain
|
||||
set(CMAKE_C_COMPILER ${COMPILERS}/${CROSS_GCC}/bin/${CROSS_GCC}-gcc)
|
||||
set(CMAKE_CXX_COMPILER ${CMAKE_C_COMPILER})
|
||||
if(CMAKE_HOST_WIN32)
|
||||
set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER}.exe)
|
||||
set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER}.exe)
|
||||
endif(CMAKE_HOST_WIN32)
|
||||
|
||||
# Set cross-compiler machine-specific flags
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/${CPU}.cmake)
|
||||
Reference in New Issue
Block a user