2019-04-06 21:08:09 +08:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2020-05-09 02:52:24 +08:00
|
|
|
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/${CMAKE_HOST_SYSTEM_NAME}.${CMAKE_HOST_SYSTEM_PROCESSOR}.cmake)
|
|
|
|
# @Intent: Set necessary compiler & linker options for this specific host architecture & OS
|
|
|
|
include(${CMAKE_HOST_SYSTEM_NAME}.${CMAKE_HOST_SYSTEM_PROCESSOR}.cmake)
|
|
|
|
else()
|
|
|
|
if (CONFIG_64BIT)
|
|
|
|
# some gcc versions fail to build without -fPIC
|
|
|
|
zephyr_compile_options(-m64 -fPIC)
|
|
|
|
zephyr_link_libraries(-m64)
|
|
|
|
else ()
|
|
|
|
zephyr_compile_options(-m32)
|
|
|
|
zephyr_link_libraries(-m32)
|
|
|
|
endif ()
|
|
|
|
endif()
|
2019-07-04 01:21:40 +08:00
|
|
|
|
2017-10-03 22:31:55 +08:00
|
|
|
zephyr_compile_options(
|
|
|
|
${ARCH_FLAG}
|
2018-06-15 02:21:18 +08:00
|
|
|
-include ${ZEPHYR_BASE}/arch/posix/include/posix_cheats.h
|
2017-10-03 22:31:55 +08:00
|
|
|
)
|
|
|
|
|
2019-03-08 18:29:31 +08:00
|
|
|
# @Intent: Obtain compiler specific flags for no freestanding compilation
|
|
|
|
toolchain_cc_no_freestanding_options()
|
|
|
|
|
2018-11-16 11:27:13 +08:00
|
|
|
zephyr_include_directories(${BOARD_DIR})
|
|
|
|
|
2019-08-24 17:12:38 +08:00
|
|
|
if (CONFIG_COVERAGE)
|
|
|
|
toolchain_cc_coverage()
|
|
|
|
endif ()
|
2017-11-22 21:28:52 +08:00
|
|
|
|
2018-05-30 06:16:29 +08:00
|
|
|
if (CONFIG_ASAN)
|
2019-08-23 04:03:22 +08:00
|
|
|
toolchain_cc_asan()
|
2018-05-30 06:16:29 +08:00
|
|
|
endif ()
|
|
|
|
|
2019-10-04 06:54:00 +08:00
|
|
|
if (CONFIG_UBSAN)
|
|
|
|
toolchain_cc_ubsan()
|
|
|
|
endif ()
|
|
|
|
|
2018-09-23 01:19:59 +08:00
|
|
|
zephyr_compile_definitions(_POSIX_C_SOURCE=200809 _XOPEN_SOURCE=600 _XOPEN_SOURCE_EXTENDED)
|
2017-10-03 22:31:55 +08:00
|
|
|
|
|
|
|
zephyr_ld_options(
|
|
|
|
-ldl
|
|
|
|
-pthread
|
|
|
|
)
|
|
|
|
|
|
|
|
# About the -include directive: The reason to do it this way, is because in this
|
|
|
|
# manner it is transparent to the application. Otherwise posix_cheats.h needs to
|
|
|
|
# be included in all the applications' files which define main( ), and in any
|
|
|
|
# app file which uses the pthreads like API provided by Zephyr
|
|
|
|
# ( include/posix/pthread.h / kernel/pthread.c ) [And any future API added to
|
|
|
|
# Zephyr which will clash with the native POSIX API] . It would also need to
|
|
|
|
# be included in a few zephyr kernel files.
|
|
|
|
|
|
|
|
|
|
|
|
add_subdirectory(core)
|