mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-14 01:42:37 +08:00
Add option to use boost or libcoro
By default, use boost everywhere except windows and linux x86 (for performance reasons)
This commit is contained in:
parent
6429b82796
commit
b6fd402a3c
@ -202,6 +202,21 @@ else()
|
||||
target_include_directories(toml11_target SYSTEM INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/toml11/include)
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
# Coroutine implementation
|
||||
################################################################################
|
||||
|
||||
set(DEFAULT_COROUTINE_IMPL boost)
|
||||
if(WIN32)
|
||||
# boost coroutine not available in windows build environment for now.
|
||||
set(DEFAULT_COROUTINE_IMPL libcoro)
|
||||
elseif(NOT APPLE AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^x86")
|
||||
# revert to libcoro for x86 linux while we investigate a performance regression
|
||||
set(DEFAULT_COROUTINE_IMPL libcoro)
|
||||
endif()
|
||||
|
||||
set(COROUTINE_IMPL ${DEFAULT_COROUTINE_IMPL} CACHE STRING "Which coroutine implementation to use. Options are boost and libcoro")
|
||||
|
||||
################################################################################
|
||||
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/packages)
|
||||
|
@ -86,8 +86,23 @@ if(COMPILE_EIO)
|
||||
target_link_libraries(fdbrpc PRIVATE eio)
|
||||
target_link_libraries(fdbrpc_sampling PRIVATE eio)
|
||||
endif()
|
||||
if(WIN32)
|
||||
add_library(coro STATIC libcoroutine/Common.c libcoroutine/Coro.c)
|
||||
target_link_libraries(fdbrpc PRIVATE coro)
|
||||
target_link_libraries(fdbrpc_sampling PRIVATE coro)
|
||||
|
||||
set(CORO_SRCS libcoroutine/Common.c libcoroutine/Coro.c)
|
||||
if(APPLE)
|
||||
list(APPEND CORO_SRCS libcoroutine/asm.S)
|
||||
endif()
|
||||
if(NOT WIN32)
|
||||
list(APPEND CORO_SRCS libcoroutine/context.c)
|
||||
endif()
|
||||
add_library(coro STATIC ${CORO_SRCS})
|
||||
if(WIN32)
|
||||
target_compile_definitions(coro PRIVATE USE_FIBERS)
|
||||
else()
|
||||
target_compile_definitions(coro PRIVATE USE_UCONTEXT)
|
||||
target_compile_options(coro BEFORE PRIVATE -w) # disable warnings for third party
|
||||
endif()
|
||||
if(USE_VALGRIND)
|
||||
target_link_libraries(coro PUBLIC Valgrind)
|
||||
endif()
|
||||
target_link_libraries(fdbrpc PRIVATE coro)
|
||||
target_link_libraries(fdbrpc_sampling PRIVATE coro)
|
||||
|
@ -270,8 +270,7 @@ set(FDBSERVER_SRCS
|
||||
workloads/WriteTagThrottling.actor.cpp
|
||||
)
|
||||
|
||||
# ugly hack to make Windows work for now
|
||||
if(WIN32)
|
||||
if(${COROUTINE_IMPL} STREQUAL libcoro)
|
||||
list(APPEND FDBSERVER_SRCS CoroFlowCoro.actor.cpp)
|
||||
else()
|
||||
list(APPEND FDBSERVER_SRCS CoroFlow.actor.cpp)
|
||||
|
Loading…
x
Reference in New Issue
Block a user