2017-10-27 21:43:34 +08:00
|
|
|
set(CMAKE_SYSTEM_NAME Generic)
|
|
|
|
set(CMAKE_SYSTEM_PROCESSOR ${ARCH})
|
|
|
|
|
|
|
|
set(BUILD_SHARED_LIBS OFF)
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
2018-09-03 16:54:16 +08:00
|
|
|
# Don't inherit compiler flags from the environment
|
|
|
|
foreach(var CFLAGS CXXFLAGS)
|
|
|
|
if(DEFINED ENV{${var}})
|
|
|
|
message(WARNING "The environment variable '${var}' was set to $ENV{${var}},
|
|
|
|
but Zephyr ignores flags from the environment. Use 'cmake -DEXTRA_${var}=$ENV{${var}}' instead.")
|
|
|
|
unset(ENV{${var}})
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
2018-02-12 04:36:21 +08:00
|
|
|
# Until we completely deprecate it
|
2018-05-31 01:52:27 +08:00
|
|
|
if(NOT DEFINED ENV{ZEPHYR_TOOLCHAIN_VARIANT})
|
|
|
|
if(DEFINED ENV{ZEPHYR_GCC_VARIANT})
|
|
|
|
message(WARNING "ZEPHYR_GCC_VARIANT is deprecated, please use ZEPHYR_TOOLCHAIN_VARIANT instead")
|
|
|
|
set(ZEPHYR_TOOLCHAIN_VARIANT $ENV{ZEPHYR_GCC_VARIANT})
|
|
|
|
endif()
|
2018-02-12 04:36:21 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT ZEPHYR_TOOLCHAIN_VARIANT)
|
|
|
|
if(DEFINED ENV{ZEPHYR_TOOLCHAIN_VARIANT})
|
|
|
|
set(ZEPHYR_TOOLCHAIN_VARIANT $ENV{ZEPHYR_TOOLCHAIN_VARIANT})
|
2018-01-09 00:06:42 +08:00
|
|
|
elseif(CROSS_COMPILE OR CONFIG_CROSS_COMPILE OR (DEFINED ENV{CROSS_COMPILE}))
|
2018-02-12 04:36:21 +08:00
|
|
|
set(ZEPHYR_TOOLCHAIN_VARIANT cross-compile)
|
2018-01-09 00:06:42 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
2018-08-03 23:11:23 +08:00
|
|
|
|
|
|
|
# Until we completely deprecate it
|
|
|
|
if(${ZEPHYR_TOOLCHAIN_VARIANT} STREQUAL "gccarmemb")
|
|
|
|
message(WARNING "gccarmemb is deprecated, please use gnuarmemb instead")
|
|
|
|
set(ZEPHYR_TOOLCHAIN_VARIANT "gnuarmemb")
|
|
|
|
endif()
|
|
|
|
|
2018-02-12 04:36:21 +08:00
|
|
|
set(ZEPHYR_TOOLCHAIN_VARIANT ${ZEPHYR_TOOLCHAIN_VARIANT} CACHE STRING "Zephyr toolchain variant")
|
|
|
|
assert(ZEPHYR_TOOLCHAIN_VARIANT "Zephyr toolchain variant invalid: please set the ZEPHYR_TOOLCHAIN_VARIANT-variable")
|
2018-01-09 00:06:42 +08:00
|
|
|
|
2018-02-12 04:36:21 +08:00
|
|
|
if(CONFIG_ARCH_POSIX OR (ZEPHYR_TOOLCHAIN_VARIANT STREQUAL "host"))
|
2018-01-09 00:06:42 +08:00
|
|
|
set(COMPILER host-gcc)
|
|
|
|
endif()
|
|
|
|
|
2018-08-03 23:11:23 +08:00
|
|
|
|
2017-10-27 21:43:34 +08:00
|
|
|
# Configure the toolchain based on what SDK/toolchain is in use.
|
2018-01-09 00:06:42 +08:00
|
|
|
if(NOT (COMPILER STREQUAL "host-gcc"))
|
2018-02-12 04:47:59 +08:00
|
|
|
include(${ZEPHYR_BASE}/cmake/toolchain/${ZEPHYR_TOOLCHAIN_VARIANT}.cmake)
|
2017-10-03 22:31:55 +08:00
|
|
|
endif()
|
2017-10-27 21:43:34 +08:00
|
|
|
|
|
|
|
# Configure the toolchain based on what toolchain technology is used
|
2018-01-09 00:05:26 +08:00
|
|
|
# (gcc, host-gcc etc.)
|
2018-02-12 04:47:59 +08:00
|
|
|
include(${ZEPHYR_BASE}/cmake/compiler/${COMPILER}.cmake OPTIONAL)
|
2018-04-17 20:49:52 +08:00
|
|
|
|
|
|
|
# Uniquely identify the toolchain wrt. it's capabilities.
|
|
|
|
#
|
|
|
|
# What we are looking for, is a signature definition that is defined
|
|
|
|
# like this:
|
|
|
|
|
|
|
|
# Toolchains with the same signature will always support the same set
|
|
|
|
# of flags.
|
|
|
|
|
|
|
|
# It is not clear how this signature should be constructed. The
|
|
|
|
# strategy chosen is to md5sum the CC binary.
|
|
|
|
|
|
|
|
file(MD5 ${CMAKE_C_COMPILER} CMAKE_C_COMPILER_MD5_SUM)
|
|
|
|
set(TOOLCHAIN_SIGNATURE ${CMAKE_C_COMPILER_MD5_SUM})
|