Only build libcoro if COROUTINE_IMPL == libcoro

It doesn't build at all on mac m1
This commit is contained in:
Andrew Noyes 2021-12-03 16:34:35 -08:00
parent b43f1640a4
commit 23de546586

View File

@ -87,22 +87,24 @@ if(COMPILE_EIO)
target_link_libraries(fdbrpc_sampling PRIVATE eio)
endif()
set(CORO_SRCS libcoroutine/Common.c libcoroutine/Coro.c)
if(APPLE)
list(APPEND CORO_SRCS libcoroutine/asm.S)
if(${COROUTINE_IMPL} STREQUAL libcoro)
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)
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)