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-02-12 04:36:21 +08:00
|
|
|
# Until we completely deprecate it
|
|
|
|
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()
|
|
|
|
|
|
|
|
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-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()
|
|
|
|
|
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)
|