samples: tensorflow: add no-threadsafe-statics to compiler flags
Adds no-threadsafe-statics to compiler flags for gcc and arcmwdt. The flag is required to compile the samples - the module can compile without it. Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
This commit is contained in:
parent
468c553190
commit
e6b8c50599
5 changed files with 19 additions and 4 deletions
|
@ -173,6 +173,9 @@ set_compiler_property(PROPERTY security_fortify "")
|
|||
# Required C++ flags when using mwdt
|
||||
set_property(TARGET compiler-cpp PROPERTY required "")
|
||||
|
||||
# Compiler flag for turning off thread-safe initialization of local statics
|
||||
set_property(TARGET compiler-cpp PROPERTY no_threadsafe_statics "-fno-threadsafe-statics")
|
||||
|
||||
#################################
|
||||
# This section covers asm flags #
|
||||
#################################
|
||||
|
|
|
@ -98,5 +98,8 @@ set_compiler_property(PROPERTY sanitize_address)
|
|||
|
||||
set_compiler_property(PROPERTY sanitize_undefined)
|
||||
|
||||
# Compiler flag for turning off thread-safe initialization of local statics
|
||||
set_property(TARGET compiler-cpp PROPERTY no_threadsafe_statics)
|
||||
|
||||
# Required ASM flags when compiling
|
||||
set_property(TARGET asm PROPERTY required)
|
||||
|
|
|
@ -177,6 +177,9 @@ set_compiler_property(PROPERTY sanitize_address -fsanitize=address)
|
|||
|
||||
set_compiler_property(PROPERTY sanitize_undefined -fsanitize=undefined)
|
||||
|
||||
# GCC compiler flag for turning off thread-safe initialization of local statics
|
||||
set_property(TARGET compiler-cpp PROPERTY no_threadsafe_statics "-fno-threadsafe-statics")
|
||||
|
||||
# Required ASM flags when using gcc
|
||||
set_property(TARGET asm PROPERTY required "-xassembler-with-cpp")
|
||||
|
||||
|
|
|
@ -3,8 +3,11 @@ cmake_minimum_required(VERSION 3.13.1)
|
|||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||
project(tensorflow_hello_world)
|
||||
|
||||
# Required for TensorFlow to compile properly
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-threadsafe-statics")
|
||||
# These samples use local static initialization. Since Zephyr doesn't support the
|
||||
# C++ ABI for thread-safe initialization of local statics and the constructors don't
|
||||
# appear to require thread safety, we turn it off in the C++ compiler.
|
||||
set(NO_THREADSAFE_STATICS $<TARGET_PROPERTY:compiler-cpp,no_threadsafe_statics>)
|
||||
zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:${NO_THREADSAFE_STATICS}>)
|
||||
|
||||
target_sources(app PRIVATE
|
||||
src/assert.cc
|
||||
|
|
|
@ -3,8 +3,11 @@ cmake_minimum_required(VERSION 3.13.1)
|
|||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||
project(tensorflow_magic_wand)
|
||||
|
||||
# Required for TensorFlow to compile properly
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-threadsafe-statics")
|
||||
# These samples use local static initialization. Since Zephyr doesn't support the
|
||||
# C++ ABI for thread-safe initialization of local statics and the constructors don't
|
||||
# appear to require thread safety, we turn it off in the C++ compiler.
|
||||
set(NO_THREADSAFE_STATICS $<TARGET_PROPERTY:compiler-cpp,no_threadsafe_statics>)
|
||||
zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:${NO_THREADSAFE_STATICS}>)
|
||||
|
||||
target_sources(app PRIVATE
|
||||
src/main_functions.h
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue