Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.cache
build
16 changes: 14 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ option(BUILD_SAMPLE "Build sample" ON)
option(BUILD_TESTS "Build unit and perfermence tests" OFF)
option(ENABLE_COVERAGE "Flag to enable/disable building code with -fprofile-arcs and -ftest-coverage. Gcc only" OFF)
option(ENABLE_RTTI "Flag to enable/disable building code with RTTI information" ON)

option(USE_CPP20 "Use C++ 20 coroutine" OFF)

#Platform
if (CMAKE_CROSSCOMPILING)
Expand Down Expand Up @@ -127,6 +127,18 @@ else()
endif()
endif()

if (USE_CPP20)
message("Use C++20 coroutine")
# GCC coroutine flags
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcoroutines")
#-ftree-slp-vectorize with coroutine cause link error. disable it util gcc fix.
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-tree-slp-vectorize")
endif()
#Compiler flags
list(APPEND SDK_COMPILER_FLAGS "-std=c++20")
add_compile_definitions(USE_CPP20)
endif()

if (BUILD_SHARED_LIBS)
set(STATIC_LIB_SUFFIX "-static")
Expand All @@ -146,4 +158,4 @@ endif()
if(BUILD_TESTS)
add_subdirectory(test)
add_subdirectory(ptest)
endif()
endif()
Loading