2018-05-03 00:55:29 +08:00
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
|
|
|
set(FLOW_SRCS
|
|
|
|
ActorCollection.actor.cpp
|
|
|
|
ActorCollection.h
|
2020-02-29 04:33:57 +08:00
|
|
|
Arena.cpp
|
2018-05-03 00:55:29 +08:00
|
|
|
Arena.h
|
2021-12-15 04:01:44 +08:00
|
|
|
ArgParseUtil.h
|
2018-05-03 00:55:29 +08:00
|
|
|
AsioReactor.h
|
2021-07-03 06:04:42 +08:00
|
|
|
BooleanParam.h
|
2018-05-03 00:55:29 +08:00
|
|
|
CompressedInt.actor.cpp
|
|
|
|
CompressedInt.h
|
|
|
|
Deque.cpp
|
|
|
|
Deque.h
|
2019-12-05 05:32:38 +08:00
|
|
|
DeterministicRandom.cpp
|
2018-05-03 00:55:29 +08:00
|
|
|
DeterministicRandom.h
|
|
|
|
Error.cpp
|
|
|
|
Error.h
|
|
|
|
EventTypes.actor.h
|
|
|
|
FastAlloc.cpp
|
|
|
|
FastAlloc.h
|
|
|
|
FastRef.h
|
|
|
|
FaultInjection.cpp
|
|
|
|
FaultInjection.h
|
2018-12-14 07:52:27 +08:00
|
|
|
FileTraceLogWriter.cpp
|
|
|
|
FileTraceLogWriter.h
|
2018-05-03 00:55:29 +08:00
|
|
|
Hash3.c
|
|
|
|
Hash3.h
|
2020-11-02 04:15:39 +08:00
|
|
|
Histogram.cpp
|
|
|
|
Histogram.h
|
2018-05-03 00:55:29 +08:00
|
|
|
IDispatched.h
|
|
|
|
IRandom.h
|
2021-06-30 04:23:36 +08:00
|
|
|
IThreadPoolTest.actor.cpp
|
2018-05-03 00:55:29 +08:00
|
|
|
IThreadPool.cpp
|
|
|
|
IThreadPool.h
|
2020-07-08 00:06:13 +08:00
|
|
|
ITrace.h
|
2018-05-03 00:55:29 +08:00
|
|
|
IndexedSet.actor.h
|
|
|
|
IndexedSet.cpp
|
|
|
|
IndexedSet.h
|
2019-01-10 07:58:18 +08:00
|
|
|
JsonTraceLogFormatter.cpp
|
|
|
|
JsonTraceLogFormatter.h
|
2018-05-03 00:55:29 +08:00
|
|
|
Knobs.cpp
|
|
|
|
Knobs.h
|
|
|
|
MetricSample.h
|
|
|
|
Net2.actor.cpp
|
|
|
|
Net2Packet.cpp
|
|
|
|
Net2Packet.h
|
2020-05-05 08:20:47 +08:00
|
|
|
Platform.actor.cpp
|
|
|
|
Platform.actor.h
|
2018-05-03 00:55:29 +08:00
|
|
|
Platform.h
|
|
|
|
Profiler.actor.cpp
|
|
|
|
Profiler.h
|
2020-12-27 04:30:00 +08:00
|
|
|
SendBufferIterator.h
|
2018-05-03 00:55:29 +08:00
|
|
|
SignalSafeUnwind.cpp
|
|
|
|
SignalSafeUnwind.h
|
|
|
|
SimpleOpt.h
|
2021-07-10 12:06:15 +08:00
|
|
|
StreamCipher.h
|
2018-05-03 00:55:29 +08:00
|
|
|
SystemMonitor.cpp
|
|
|
|
SystemMonitor.h
|
|
|
|
TDMetric.actor.h
|
|
|
|
TDMetric.cpp
|
2020-03-05 12:14:47 +08:00
|
|
|
TLSConfig.actor.cpp
|
|
|
|
TLSConfig.actor.h
|
2018-05-03 00:55:29 +08:00
|
|
|
ThreadHelper.actor.h
|
2021-04-14 04:21:04 +08:00
|
|
|
ThreadHelper.actor.cpp
|
2018-05-03 00:55:29 +08:00
|
|
|
ThreadPrimitives.cpp
|
|
|
|
ThreadPrimitives.h
|
|
|
|
ThreadSafeQueue.h
|
|
|
|
Trace.cpp
|
|
|
|
Trace.h
|
2020-07-08 00:06:13 +08:00
|
|
|
Tracing.h
|
2020-10-16 07:26:33 +08:00
|
|
|
Tracing.actor.cpp
|
2020-04-15 04:16:28 +08:00
|
|
|
TreeBenchmark.h
|
2021-06-17 00:46:21 +08:00
|
|
|
TypeTraits.h
|
2018-05-03 00:55:29 +08:00
|
|
|
UnitTest.cpp
|
|
|
|
UnitTest.h
|
2021-06-04 06:10:04 +08:00
|
|
|
WriteOnlySet.actor.cpp
|
2018-12-14 07:52:27 +08:00
|
|
|
XmlTraceLogFormatter.cpp
|
2020-03-05 12:14:47 +08:00
|
|
|
XmlTraceLogFormatter.h
|
2018-05-03 00:55:29 +08:00
|
|
|
actorcompiler.h
|
2020-04-28 02:00:46 +08:00
|
|
|
crc32c.h
|
2020-01-14 10:19:30 +08:00
|
|
|
crc32c.cpp
|
2018-05-03 00:55:29 +08:00
|
|
|
error_definitions.h
|
2019-11-16 04:26:51 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/SourceVersion.h
|
2019-01-25 05:54:28 +08:00
|
|
|
flat_buffers.cpp
|
2020-03-05 12:14:47 +08:00
|
|
|
flat_buffers.h
|
2018-05-03 00:55:29 +08:00
|
|
|
flow.cpp
|
|
|
|
flow.h
|
|
|
|
genericactors.actor.cpp
|
|
|
|
genericactors.actor.h
|
|
|
|
network.cpp
|
|
|
|
network.h
|
2020-04-28 02:00:46 +08:00
|
|
|
rte_memcpy.h
|
2019-04-11 08:41:02 +08:00
|
|
|
serialize.cpp
|
2020-03-05 12:14:47 +08:00
|
|
|
serialize.h
|
2018-05-04 06:48:10 +08:00
|
|
|
stacktrace.h
|
2020-04-28 02:00:46 +08:00
|
|
|
test_memcpy.cpp
|
|
|
|
test_memcpy_perf.cpp
|
2020-11-18 14:59:27 +08:00
|
|
|
version.cpp
|
2020-11-22 10:25:35 +08:00
|
|
|
xxhash.c
|
|
|
|
xxhash.h)
|
2018-05-04 06:48:10 +08:00
|
|
|
|
2021-01-26 04:09:29 +08:00
|
|
|
if(WITH_TLS AND NOT WIN32)
|
2021-01-26 02:42:14 +08:00
|
|
|
set(FLOW_SRCS
|
|
|
|
${FLOW_SRCS}
|
2021-07-10 12:06:15 +08:00
|
|
|
StreamCipher.cpp)
|
2021-01-26 02:42:14 +08:00
|
|
|
endif()
|
|
|
|
|
2020-12-11 10:08:02 +08:00
|
|
|
add_library(stacktrace stacktrace.amalgamation.cpp stacktrace.h)
|
|
|
|
if (USE_ASAN)
|
|
|
|
target_compile_definitions(stacktrace PRIVATE ADDRESS_SANITIZER)
|
|
|
|
elseif(USE_MSAN)
|
|
|
|
target_compile_definitions(stacktrace PRIVATE MEMORY_SANITIZER)
|
|
|
|
elseif(USE_UBSAN)
|
|
|
|
target_compile_definitions(stacktrace PRIVATE UNDEFINED_BEHAVIOR_SANITIZER)
|
|
|
|
elseif(USE_TSAN)
|
|
|
|
target_compile_definitions(stacktrace PRIVATE THREAD_SANITIZER DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL=1)
|
|
|
|
endif()
|
|
|
|
|
2020-06-12 04:30:19 +08:00
|
|
|
if(UNIX AND NOT APPLE)
|
|
|
|
list(APPEND FLOW_SRCS folly_memcpy.S)
|
|
|
|
endif()
|
|
|
|
|
2021-06-08 10:23:47 +08:00
|
|
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
|
2021-06-10 06:27:32 +08:00
|
|
|
list(APPEND FLOW_SRCS aarch64/memcmp.S aarch64/memcpy.S)
|
2021-06-08 10:23:47 +08:00
|
|
|
endif()
|
|
|
|
|
2019-11-16 04:26:51 +08:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/SourceVersion.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/SourceVersion.h)
|
2020-11-26 06:06:59 +08:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
2018-05-03 00:55:29 +08:00
|
|
|
|
2019-02-09 08:51:13 +08:00
|
|
|
add_flow_target(STATIC_LIBRARY NAME flow SRCS ${FLOW_SRCS})
|
2020-12-11 10:08:02 +08:00
|
|
|
target_link_libraries(flow PRIVATE stacktrace)
|
2021-11-17 03:03:49 +08:00
|
|
|
target_link_libraries(flow PUBLIC fmt::fmt)
|
2021-07-24 08:18:13 +08:00
|
|
|
|
|
|
|
add_flow_target(STATIC_LIBRARY NAME flow_sampling SRCS ${FLOW_SRCS})
|
|
|
|
target_link_libraries(flow_sampling PRIVATE stacktrace)
|
|
|
|
target_compile_definitions(flow_sampling PRIVATE -DENABLE_SAMPLING)
|
2021-08-21 00:32:56 +08:00
|
|
|
if(WIN32)
|
|
|
|
add_dependencies(flow_sampling_actors flow_actors)
|
|
|
|
endif()
|
2021-07-24 08:18:13 +08:00
|
|
|
|
2019-02-07 11:27:38 +08:00
|
|
|
if (NOT APPLE AND NOT WIN32)
|
2018-05-03 00:55:29 +08:00
|
|
|
set (FLOW_LIBS ${FLOW_LIBS} rt)
|
2019-02-07 11:27:38 +08:00
|
|
|
elseif(WIN32)
|
|
|
|
target_link_libraries(flow PUBLIC winmm.lib)
|
2019-12-17 00:09:10 +08:00
|
|
|
target_link_libraries(flow PUBLIC psapi.lib)
|
2021-07-24 08:18:13 +08:00
|
|
|
target_link_libraries(flow_sampling PUBLIC winmm.lib)
|
|
|
|
target_link_libraries(flow_sampling PUBLIC psapi.lib)
|
2018-05-03 00:55:29 +08:00
|
|
|
endif()
|
2020-02-02 05:23:53 +08:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
|
|
|
set (FLOW_LIBS ${FLOW_LIBS} execinfo devstat)
|
|
|
|
find_library(EIO eio)
|
|
|
|
if(EIO)
|
|
|
|
target_link_libraries(flow PUBLIC ${EIO})
|
2021-07-24 08:18:13 +08:00
|
|
|
target_link_libraries(flow_sampling PUBLIC ${EIO})
|
2020-02-02 05:23:53 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
2018-05-03 00:55:29 +08:00
|
|
|
target_link_libraries(flow PRIVATE ${FLOW_LIBS})
|
2021-07-24 08:18:13 +08:00
|
|
|
target_link_libraries(flow_sampling PRIVATE ${FLOW_LIBS})
|
2019-06-11 06:30:57 +08:00
|
|
|
if(USE_VALGRIND)
|
|
|
|
target_link_libraries(flow PUBLIC Valgrind)
|
2021-07-24 08:18:13 +08:00
|
|
|
target_link_libraries(flow_sampling PUBLIC Valgrind)
|
2019-06-11 06:30:57 +08:00
|
|
|
endif()
|
2021-01-23 13:47:36 +08:00
|
|
|
if(NOT WITH_TLS)
|
2019-02-06 14:20:44 +08:00
|
|
|
target_compile_definitions(flow PUBLIC TLS_DISABLED)
|
2021-07-24 08:18:13 +08:00
|
|
|
target_compile_definitions(flow_sampling PUBLIC TLS_DISABLED)
|
2019-02-06 14:20:44 +08:00
|
|
|
else()
|
2020-02-14 06:42:45 +08:00
|
|
|
target_link_libraries(flow PUBLIC OpenSSL::SSL)
|
2021-07-24 08:18:13 +08:00
|
|
|
target_link_libraries(flow_sampling PUBLIC OpenSSL::SSL)
|
2019-02-06 14:20:44 +08:00
|
|
|
endif()
|
2021-01-29 00:01:40 +08:00
|
|
|
target_link_libraries(flow PUBLIC Threads::Threads ${CMAKE_DL_LIBS})
|
2021-07-24 08:18:13 +08:00
|
|
|
target_link_libraries(flow_sampling PUBLIC Threads::Threads ${CMAKE_DL_LIBS})
|
2021-01-28 10:13:02 +08:00
|
|
|
if(USE_SANITIZER)
|
|
|
|
target_link_libraries(flow PUBLIC boost_asan)
|
2021-07-24 08:18:13 +08:00
|
|
|
target_link_libraries(flow_sampling PUBLIC boost_asan)
|
2021-01-28 10:13:02 +08:00
|
|
|
else()
|
|
|
|
target_link_libraries(flow PUBLIC boost_target)
|
2021-07-24 08:18:13 +08:00
|
|
|
target_link_libraries(flow_sampling PUBLIC boost_target)
|
2021-01-28 10:13:02 +08:00
|
|
|
endif()
|
2020-02-22 00:56:52 +08:00
|
|
|
if(USE_VALGRIND)
|
|
|
|
target_link_libraries(flow PUBLIC Valgrind)
|
2021-07-24 08:18:13 +08:00
|
|
|
target_link_libraries(flow_sampling PUBLIC Valgrind)
|
2019-02-06 14:20:44 +08:00
|
|
|
endif()
|
2018-05-04 06:48:10 +08:00
|
|
|
|
|
|
|
if(APPLE)
|
|
|
|
find_library(IO_KIT IOKit)
|
|
|
|
find_library(CORE_FOUNDATION CoreFoundation)
|
|
|
|
target_link_libraries(flow PRIVATE ${IO_KIT} ${CORE_FOUNDATION})
|
2021-07-24 08:18:13 +08:00
|
|
|
target_link_libraries(flow_sampling PRIVATE ${IO_KIT} ${CORE_FOUNDATION})
|
2018-05-04 06:48:10 +08:00
|
|
|
endif()
|