cmake: add more checks for folly-config.h generation
[folly.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 3.4.0 FATAL_ERROR)
2
3 # includes
4 set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
5 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
6
7 # package information
8 set(PACKAGE_NAME      "folly")
9 set(PACKAGE_VERSION   "0.58.0-dev")
10 set(PACKAGE_STRING    "${PACKAGE_NAME} ${PACKAGE_VERSION}")
11 set(PACKAGE_TARNAME   "${PACKAGE_NAME}-${PACKAGE_VERSION}")
12 set(PACKAGE_BUGREPORT "https://github.com/facebook/folly/issues")
13
14 # 150+ tests in the root folder anyone? No? I didn't think so.
15 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
16
17 project(${PACKAGE_NAME} CXX)
18
19 if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
20   # Check target architecture
21   if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
22     message(FATAL_ERROR "Folly requires a 64bit target architecture.")
23   endif()
24
25   if (MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1920)
26     set(MSVC_IS_2017 ON)
27   elseif (MSVC_VERSION EQUAL 1900)
28     set(MSVC_IS_2017 OFF)
29   else()
30     message(
31       FATAL_ERROR
32       "This build script only supports building Folly on 64-bit Windows with "
33       "Visual Studio 2015 or Visual Studio 2017. "
34       "MSVC version '${MSVC_VERSION}' is not supported."
35     )
36   endif()
37 else()
38   message(
39     FATAL_ERROR
40     "The CMake build should only be used on Windows. "
41     "For every other platform, use autoconf."
42   )
43 endif()
44
45 set(FOLLY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/folly")
46
47 # Generate a few tables and create the main config file.
48 find_package(PythonInterp REQUIRED)
49 add_custom_command(
50   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/folly/build/EscapeTables.cpp
51   COMMAND
52     ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/folly/build
53   COMMAND
54     ${PYTHON_EXECUTABLE} "${FOLLY_DIR}/build/generate_escape_tables.py"
55     --install_dir ${CMAKE_CURRENT_BINARY_DIR}/folly/build
56   DEPENDS ${FOLLY_DIR}/build/generate_escape_tables.py
57   COMMENT "Generating the escape tables..." VERBATIM
58 )
59 add_custom_command(
60   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/folly/build/FormatTables.cpp
61   COMMAND
62     ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/folly/build
63   COMMAND
64     ${PYTHON_EXECUTABLE} "${FOLLY_DIR}/build/generate_format_tables.py"
65     --install_dir ${CMAKE_CURRENT_BINARY_DIR}/folly/build
66   DEPENDS ${FOLLY_DIR}/build/generate_format_tables.py
67   COMMENT "Generating the format tables..." VERBATIM
68 )
69 add_custom_command(
70   OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/folly/build/GroupVarintTables.cpp"
71   COMMAND
72     ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/folly/build
73   COMMAND
74     ${PYTHON_EXECUTABLE} "${FOLLY_DIR}/build/generate_varint_tables.py"
75     --install_dir ${CMAKE_CURRENT_BINARY_DIR}/folly/build
76   DEPENDS ${FOLLY_DIR}/build/generate_varint_tables.py
77   COMMENT "Generating the group varint tables..." VERBATIM
78 )
79
80 include(folly-deps) # Find the required packages
81
82 if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
83   include(FollyCompilerMSVC)
84 else()
85   include(FollyCompilerUnix)
86 endif()
87 include(FollyFunctions)
88
89 include(FollyConfigChecks)
90 configure_file(
91   ${CMAKE_CURRENT_SOURCE_DIR}/CMake/folly-config.h.cmake
92   ${CMAKE_CURRENT_BINARY_DIR}/folly/folly-config.h
93 )
94
95 # Main folly library files
96 auto_sources(files "*.cpp" "RECURSE" "${FOLLY_DIR}")
97 auto_sources(hfiles "*.h" "RECURSE" "${FOLLY_DIR}")
98
99 # No need for tests or benchmarks, and we can't build most experimental stuff.
100 REMOVE_MATCHES_FROM_LISTS(files hfiles
101   MATCHES
102     "/build/"
103     "/experimental/exception_tracer/"
104     "/experimental/hazptr/bench/"
105     "/experimental/hazptr/example/"
106     "/experimental/logging/example/"
107     "/futures/exercises/"
108     "/test/"
109     "/tools/"
110     "Benchmark.cpp$"
111     "Test.cpp$"
112   IGNORE_MATCHES
113     "/Benchmark.cpp$"
114 )
115 list(REMOVE_ITEM files
116   ${FOLLY_DIR}/Poly.cpp
117   ${FOLLY_DIR}/SingletonStackTrace.cpp
118   ${FOLLY_DIR}/experimental/JSONSchemaTester.cpp
119   ${FOLLY_DIR}/experimental/RCUUtils.cpp
120   ${FOLLY_DIR}/experimental/io/AsyncIO.cpp
121   ${FOLLY_DIR}/experimental/io/HugePageUtil.cpp
122   ${FOLLY_DIR}/experimental/symbolizer/ElfUtil.cpp
123   ${FOLLY_DIR}/futures/test/Benchmark.cpp
124 )
125 list(REMOVE_ITEM hfiles
126   ${FOLLY_DIR}/Fingerprint.h
127   ${FOLLY_DIR}/Poly.h
128   ${FOLLY_DIR}/Poly-inl.h
129   ${FOLLY_DIR}/detail/PolyDetail.h
130   ${FOLLY_DIR}/detail/TypeList.h
131   ${FOLLY_DIR}/detail/SlowFingerprint.h
132   ${FOLLY_DIR}/detail/FingerprintPolynomial.h
133   ${FOLLY_DIR}/experimental/RCURefCount.h
134   ${FOLLY_DIR}/experimental/RCUUtils.h
135   ${FOLLY_DIR}/experimental/io/AsyncIO.h
136   ${FOLLY_DIR}/poly/Nullable.h
137   ${FOLLY_DIR}/poly/Regular.h
138 )
139 if (NOT FOLLY_USE_SYMBOLIZER)
140   REMOVE_MATCHES_FROM_LISTS(files hfiles
141     MATCHES
142       "/experimental/symbolizer/"
143   )
144 endif()
145 if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
146 list(REMOVE_ITEM files
147   ${FOLLY_DIR}/Subprocess.cpp
148 )
149 endif()
150
151 add_library(folly_base OBJECT
152   ${files} ${hfiles}
153   ${CMAKE_CURRENT_BINARY_DIR}/folly/folly-config.h
154   ${CMAKE_CURRENT_BINARY_DIR}/folly/build/EscapeTables.cpp
155   ${CMAKE_CURRENT_BINARY_DIR}/folly/build/FormatTables.cpp
156   ${CMAKE_CURRENT_BINARY_DIR}/folly/build/GroupVarintTables.cpp
157 )
158 auto_source_group(folly ${FOLLY_DIR} ${files} ${hfiles})
159 apply_folly_compile_options_to_target(folly_base)
160 target_include_directories(folly_base PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
161 # Add the generated files to the correct source group.
162 source_group("folly" FILES ${CMAKE_CURRENT_BINARY_DIR}/folly/folly-config.h)
163 source_group("folly\\build" FILES
164   ${CMAKE_CURRENT_BINARY_DIR}/folly/build/EscapeTables.cpp
165   ${CMAKE_CURRENT_BINARY_DIR}/folly/build/FingerprintTables.cpp
166   ${CMAKE_CURRENT_BINARY_DIR}/folly/build/FormatTables.cpp
167   ${CMAKE_CURRENT_BINARY_DIR}/folly/build/GroupVarintTables.cpp
168 )
169
170 if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
171   set(FOLLY_LINK_LIBRARIES
172     ${FOLLY_LINK_LIBRARIES}
173     Iphlpapi.lib
174     Ws2_32.lib
175   )
176 endif()
177
178 set(FOLLY_LINK_LIBRARIES
179   ${FOLLY_LINK_LIBRARIES}
180   ${FOLLY_SHINY_DEPENDENCIES}
181 )
182
183 target_include_directories(folly_base
184   PUBLIC
185     ${FOLLY_INCLUDE_DIRECTORIES}
186     $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
187 )
188
189 foreach (LIB ${FOLLY_SHINY_DEPENDENCIES})
190   target_include_directories(folly_base PUBLIC $<TARGET_PROPERTY:${LIB},INCLUDE_DIRECTORIES>)
191   target_compile_definitions(folly_base PUBLIC $<TARGET_PROPERTY:${LIB},INTERFACE_COMPILE_DEFINITIONS>)
192 endforeach()
193
194 if (FOLLY_HAVE_PTHREAD)
195   target_include_directories(folly_base PUBLIC ${LIBPTHREAD_INCLUDE_DIRS})
196 endif()
197
198 # Now to generate the fingerprint tables
199 add_executable(GenerateFingerprintTables
200   ${FOLLY_DIR}/build/GenerateFingerprintTables.cpp
201   $<TARGET_OBJECTS:folly_base>
202 )
203 target_link_libraries(GenerateFingerprintTables PRIVATE ${FOLLY_LINK_LIBRARIES})
204 target_include_directories(GenerateFingerprintTables PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
205 add_dependencies(GenerateFingerprintTables folly_base)
206 apply_folly_compile_options_to_target(GenerateFingerprintTables)
207 set_property(TARGET GenerateFingerprintTables PROPERTY FOLDER "Build")
208 source_group("" FILES ${FOLLY_DIR}/build/GenerateFingerprintTables.cpp)
209
210 # Compile the fingerprint tables.
211 add_custom_command(
212   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/folly/build/FingerprintTables.cpp
213   COMMAND
214     ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/folly/build
215   COMMAND
216     GenerateFingerprintTables
217     --install_dir ${CMAKE_CURRENT_BINARY_DIR}/folly/build
218   DEPENDS GenerateFingerprintTables
219   COMMENT "Generating the fingerprint tables..."
220 )
221 add_library(folly_fingerprint STATIC
222   ${CMAKE_CURRENT_BINARY_DIR}/folly/build/FingerprintTables.cpp
223   ${FOLLY_DIR}/Fingerprint.h
224   ${FOLLY_DIR}/detail/SlowFingerprint.h
225   ${FOLLY_DIR}/detail/FingerprintPolynomial.h
226   $<TARGET_OBJECTS:folly_base>
227 )
228 target_link_libraries(folly_fingerprint PRIVATE ${FOLLY_LINK_LIBRARIES})
229 target_include_directories(folly_fingerprint PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
230 add_dependencies(folly_fingerprint folly_base)
231 apply_folly_compile_options_to_target(folly_fingerprint)
232
233 # We want to generate a single library and target for folly, but we needed a
234 # two-stage compile for the fingerprint tables, so we create a phony source
235 # file that we modify whenever the base libraries change, causing folly to be
236 # re-linked, making things happy.
237 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/folly_dep.cpp
238   COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/folly_dep.cpp
239   DEPENDS folly_base folly_fingerprint
240 )
241 add_library(folly ${CMAKE_CURRENT_BINARY_DIR}/folly_dep.cpp $<TARGET_OBJECTS:folly_base>)
242 apply_folly_compile_options_to_target(folly)
243 source_group("" FILES ${CMAKE_CURRENT_BINARY_DIR}/folly_dep.cpp)
244
245 target_link_libraries(folly PUBLIC ${FOLLY_LINK_LIBRARIES})
246 target_include_directories(folly PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
247
248 install(TARGETS folly
249   EXPORT folly
250   RUNTIME DESTINATION bin
251   LIBRARY DESTINATION lib
252   ARCHIVE DESTINATION lib)
253 auto_install_files(folly ${FOLLY_DIR}
254   ${hfiles}
255   ${FOLLY_DIR}/Fingerprint.h
256   ${FOLLY_DIR}/detail/SlowFingerprint.h
257   ${FOLLY_DIR}/detail/FingerprintPolynomial.h
258 )
259 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/folly/folly-config.h DESTINATION include/folly)
260 install(
261   EXPORT folly
262   DESTINATION share/folly
263   NAMESPACE Folly::
264   FILE folly-targets.cmake
265 )
266
267 # We need a wrapper config file to do the find_package calls to ensure
268 # that all our dependencies are available to link against.
269 file(
270   COPY ${CMAKE_CURRENT_SOURCE_DIR}/CMake/folly-deps.cmake
271   DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/
272 )
273 file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/folly-deps.cmake "\ninclude(folly-targets.cmake)\n")
274 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/folly-deps.cmake DESTINATION share/folly RENAME folly-config.cmake)
275
276 option(BUILD_TESTS "If enabled, compile the tests." OFF)
277 option(BUILD_BROKEN_TESTS "If enabled, compile tests that are known to be broken." OFF)
278 option(BUILD_HANGING_TESTS "If enabled, compile tests that are known to hang." OFF)
279 option(BUILD_SLOW_TESTS "If enabled, compile tests that take a while to run in debug mode." OFF)
280 if (BUILD_TESTS)
281   find_package(GMock MODULE REQUIRED)
282
283   add_library(folly_test_support
284     ${FOLLY_DIR}/test/DeterministicSchedule.cpp
285     ${FOLLY_DIR}/test/DeterministicSchedule.h
286     ${FOLLY_DIR}/test/SingletonTestStructs.cpp
287     ${FOLLY_DIR}/test/SocketAddressTestHelper.cpp
288     ${FOLLY_DIR}/test/SocketAddressTestHelper.h
289     ${FOLLY_DIR}/experimental/logging/test/TestLogHandler.cpp
290     ${FOLLY_DIR}/experimental/logging/test/TestLogHandler.h
291     ${FOLLY_DIR}/futures/test/TestExecutor.cpp
292     ${FOLLY_DIR}/futures/test/TestExecutor.h
293     ${FOLLY_DIR}/io/async/test/BlockingSocket.h
294     ${FOLLY_DIR}/io/async/test/MockAsyncServerSocket.h
295     ${FOLLY_DIR}/io/async/test/MockAsyncSocket.h
296     ${FOLLY_DIR}/io/async/test/MockAsyncSSLSocket.h
297     ${FOLLY_DIR}/io/async/test/MockAsyncTransport.h
298     ${FOLLY_DIR}/io/async/test/MockAsyncUDPSocket.h
299     ${FOLLY_DIR}/io/async/test/MockTimeoutManager.h
300     ${FOLLY_DIR}/io/async/test/ScopedBoundPort.cpp
301     ${FOLLY_DIR}/io/async/test/ScopedBoundPort.h
302     ${FOLLY_DIR}/io/async/test/SocketPair.cpp
303     ${FOLLY_DIR}/io/async/test/SocketPair.h
304     ${FOLLY_DIR}/io/async/test/TestSSLServer.cpp
305     ${FOLLY_DIR}/io/async/test/TestSSLServer.h
306     ${FOLLY_DIR}/io/async/test/TimeUtil.cpp
307     ${FOLLY_DIR}/io/async/test/TimeUtil.h
308     ${FOLLY_DIR}/io/async/test/UndelayedDestruction.h
309     ${FOLLY_DIR}/io/async/test/Util.h
310   )
311   target_compile_definitions(folly_test_support
312     PUBLIC
313       ${LIBGMOCK_DEFINES}
314   )
315   target_include_directories(folly_test_support
316     PUBLIC
317       ${LIBGMOCK_INCLUDE_DIR}
318   )
319   target_link_libraries(folly_test_support
320     PUBLIC
321       Boost::thread
322       folly
323       ${LIBGMOCK_LIBRARY}
324   )
325   apply_folly_compile_options_to_target(folly_test_support)
326
327   folly_define_tests(
328     DIRECTORY chrono/test/
329       TEST chrono_conv_test SOURCES ConvTest.cpp
330
331     DIRECTORY compression/test/
332       TEST compression_test SOURCES CompressionTest.cpp
333
334     DIRECTORY container/test/
335       TEST access_test SOURCES AccessTest.cpp
336       TEST array_test SOURCES ArrayTest.cpp
337       TEST bit_iterator_test SOURCES BitIteratorTest.cpp
338       TEST enumerate_test SOURCES EnumerateTest.cpp
339       TEST evicting_cache_map_test SOURCES EvictingCacheMapTest.cpp
340       TEST foreach_test SOURCES ForeachTest.cpp
341       TEST merge_test SOURCES MergeTest.cpp
342       TEST sparse_byte_set_test SOURCES SparseByteSetTest.cpp
343
344     DIRECTORY concurrency/test/
345       TEST cache_locality_test SOURCES CacheLocalityTest.cpp
346
347     DIRECTORY executors/test/
348       TEST async_helpers_test SOURCES AsyncTest.cpp
349       TEST codel_test SOURCES CodelTest.cpp
350       TEST executor_test SOURCES ExecutorTest.cpp
351       TEST fiber_io_executor_test SOURCES FiberIOExecutorTest.cpp
352       TEST global_executor_test SOURCES GlobalExecutorTest.cpp
353       TEST serial_executor_test SOURCES SerialExecutorTest.cpp
354       TEST thread_pool_executor_test SOURCES ThreadPoolExecutorTest.cpp
355       TEST threaded_executor_test SOURCES ThreadedExecutorTest.cpp
356
357     DIRECTORY executors/task_queue/test/
358       TEST unbounded_blocking_queue_test SOURCES UnboundedBlockingQueueTest.cpp
359
360     DIRECTORY experimental/test/
361       TEST autotimer_test SOURCES AutoTimerTest.cpp
362       TEST bits_test_2 SOURCES BitsTest.cpp
363       TEST bitvector_test SOURCES BitVectorCodingTest.cpp
364       TEST dynamic_parser_test SOURCES DynamicParserTest.cpp
365       TEST eliasfano_test SOURCES EliasFanoCodingTest.cpp
366       TEST event_count_test SOURCES EventCountTest.cpp
367       TEST function_scheduler_test_2 SOURCES FunctionSchedulerTest.cpp
368       TEST future_dag_test SOURCES FutureDAGTest.cpp
369       TEST json_schema_test SOURCES JSONSchemaTest.cpp
370       TEST lock_free_ring_buffer_test SOURCES LockFreeRingBufferTest.cpp
371       #TEST nested_command_line_app_test SOURCES NestedCommandLineAppTest.cpp
372       #TEST program_options_test SOURCES ProgramOptionsTest.cpp
373       # Depends on liburcu
374       #TEST read_mostly_shared_ptr_test SOURCES ReadMostlySharedPtrTest.cpp
375       #TEST ref_count_test SOURCES RefCountTest.cpp
376       TEST stringkeyed_test SOURCES StringKeyedTest.cpp
377       TEST test_util_test SOURCES TestUtilTest.cpp
378       TEST tuple_ops_test SOURCES TupleOpsTest.cpp
379
380     DIRECTORY experimental/io/test/
381       # Depends on libaio
382       #TEST async_io_test SOURCES AsyncIOTest.cpp
383       TEST fs_util_test SOURCES FsUtilTest.cpp
384
385     DIRECTORY experimental/logging/test/
386       TEST async_file_writer_test SOURCES AsyncFileWriterTest.cpp
387       TEST config_parser_test SOURCES ConfigParserTest.cpp
388       TEST config_update_test SOURCES ConfigUpdateTest.cpp
389       TEST file_handler_factory_test SOURCES FileHandlerFactoryTest.cpp
390       TEST glog_formatter_test SOURCES GlogFormatterTest.cpp
391       TEST immediate_file_writer_test SOURCES ImmediateFileWriterTest.cpp
392       TEST log_category_test SOURCES LogCategoryTest.cpp
393       TEST logger_db_test SOURCES LoggerDBTest.cpp
394       TEST logger_test SOURCES LoggerTest.cpp
395       TEST log_level_test SOURCES LogLevelTest.cpp
396       TEST log_message_test SOURCES LogMessageTest.cpp
397       TEST log_name_test SOURCES LogNameTest.cpp
398       TEST log_stream_test SOURCES LogStreamTest.cpp
399       TEST printf_test SOURCES PrintfTest.cpp
400       TEST rate_limiter_test SOURCES RateLimiterTest.cpp
401       TEST standard_log_handler_test SOURCES StandardLogHandlerTest.cpp
402       TEST xlog_test
403         HEADERS
404           XlogHeader1.h
405           XlogHeader2.h
406         SOURCES
407           XlogFile1.cpp
408           XlogFile2.cpp
409           XlogTest.cpp
410
411     DIRECTORY fibers/test/
412       TEST fibers_test SOURCES FibersTest.cpp
413
414     DIRECTORY functional/test/
415       TEST apply_tuple_test SOURCES ApplyTupleTest.cpp
416       TEST partial_test SOURCES PartialTest.cpp
417
418     DIRECTORY futures/test/
419       TEST barrier_test SOURCES BarrierTest.cpp
420       TEST callback_lifetime_test SOURCES CallbackLifetimeTest.cpp
421       TEST collect_test SOURCES CollectTest.cpp
422       TEST context_test SOURCES ContextTest.cpp
423       TEST core_test SOURCES CoreTest.cpp
424       TEST ensure_test SOURCES EnsureTest.cpp
425       TEST fsm_test SOURCES FSMTest.cpp
426       TEST filter_test SOURCES FilterTest.cpp
427       TEST future_splitter_test SOURCES FutureSplitterTest.cpp
428       # MSVC SFINAE bug
429       #TEST future_test SOURCES FutureTest.cpp
430       TEST header_compile_test SOURCES HeaderCompileTest.cpp
431       TEST interrupt_test SOURCES InterruptTest.cpp
432       TEST map_test SOURCES MapTest.cpp
433       TEST non_copyable_lambda_test SOURCES NonCopyableLambdaTest.cpp
434       TEST poll_test SOURCES PollTest.cpp
435       TEST promise_test SOURCES PromiseTest.cpp
436       TEST reduce_test SOURCES ReduceTest.cpp
437       # MSVC SFINAE bug
438       #TEST retrying_test SOURCES RetryingTest.cpp
439       TEST self_destruct_test SOURCES SelfDestructTest.cpp
440       TEST shared_promise_test SOURCES SharedPromiseTest.cpp
441       TEST test_executor_test SOURCES TestExecutorTest.cpp
442       TEST then_compile_test
443         HEADERS
444           ThenCompileTest.h
445         SOURCES
446           ThenCompileTest.cpp
447       TEST then_test SOURCES ThenTest.cpp
448       TEST timekeeper_test SOURCES TimekeeperTest.cpp
449       TEST times_test SOURCES TimesTest.cpp
450       TEST unwrap_test SOURCES UnwrapTest.cpp
451       TEST via_test SOURCES ViaTest.cpp
452       TEST wait_test SOURCES WaitTest.cpp
453       TEST when_test SOURCES WhenTest.cpp
454       TEST while_do_test SOURCES WhileDoTest.cpp
455       TEST will_equal_test SOURCES WillEqualTest.cpp
456       TEST window_test SOURCES WindowTest.cpp
457
458     DIRECTORY gen/test/
459       # MSVC bug can't resolve initializer_list constructor properly
460       #TEST base_test SOURCES BaseTest.cpp
461       TEST combine_test SOURCES CombineTest.cpp
462       TEST parallel_map_test SOURCES ParallelMapTest.cpp
463       TEST parallel_test SOURCES ParallelTest.cpp
464
465     DIRECTORY hash/test/
466       TEST checksum_test SOURCES ChecksumTest.cpp
467       TEST hash_test SOURCES HashTest.cpp
468       TEST spooky_hash_v1_test SOURCES SpookyHashV1Test.cpp
469       TEST spooky_hash_v2_test SOURCES SpookyHashV2Test.cpp
470
471     DIRECTORY io/test/
472       TEST iobuf_test SOURCES IOBufTest.cpp
473       TEST iobuf_cursor_test SOURCES IOBufCursorTest.cpp
474       TEST iobuf_queue_test SOURCES IOBufQueueTest.cpp
475       TEST record_io_test SOURCES RecordIOTest.cpp
476       TEST ShutdownSocketSetTest HANGING
477         SOURCES ShutdownSocketSetTest.cpp
478
479     DIRECTORY io/async/test/
480       TEST async_test
481         CONTENT_DIR certs/
482         HEADERS
483           AsyncSocketTest.h
484           AsyncSSLSocketTest.h
485         SOURCES
486           AsyncPipeTest.cpp
487           AsyncSocketExceptionTest.cpp
488           AsyncSocketTest.cpp
489           AsyncSocketTest2.cpp
490           AsyncSSLSocketTest.cpp
491           AsyncSSLSocketTest2.cpp
492           AsyncSSLSocketWriteTest.cpp
493           AsyncTransportTest.cpp
494           # This is disabled because it depends on things that don't exist
495           # on Windows.
496           #EventHandlerTest.cpp
497           # The async signal handler is not supported on Windows.
498           #AsyncSignalHandlerTest.cpp
499       TEST async_timeout_test SOURCES AsyncTimeoutTest.cpp
500       TEST AsyncUDPSocketTest SOURCES AsyncUDPSocketTest.cpp
501       TEST DelayedDestructionTest SOURCES DelayedDestructionTest.cpp
502       TEST DelayedDestructionBaseTest SOURCES DelayedDestructionBaseTest.cpp
503       TEST DestructorCheckTest SOURCES DestructorCheckTest.cpp
504       TEST EventBaseTest SOURCES EventBaseTest.cpp
505       TEST EventBaseLocalTest SOURCES EventBaseLocalTest.cpp
506       TEST HHWheelTimerTest SOURCES HHWheelTimerTest.cpp
507       TEST HHWheelTimerSlowTests SLOW
508         SOURCES HHWheelTimerSlowTests.cpp
509       TEST NotificationQueueTest SOURCES NotificationQueueTest.cpp
510       TEST RequestContextTest SOURCES RequestContextTest.cpp
511       TEST ScopedEventBaseThreadTest SOURCES ScopedEventBaseThreadTest.cpp
512       TEST ssl_session_test SOURCES SSLSessionTest.cpp
513       TEST writechain_test SOURCES WriteChainAsyncTransportWrapperTest.cpp
514
515     DIRECTORY io/async/ssl/test/
516       TEST ssl_errors_test SOURCES SSLErrorsTest.cpp
517
518     DIRECTORY lang/test/
519       TEST bits_test SOURCES BitsTest.cpp
520       TEST cold_class_test SOURCES ColdClassTest.cpp
521       TEST safe_assert_test SOURCES SafeAssertTest.cpp
522
523     DIRECTORY memory/test/
524       TEST arena_test SOURCES ArenaTest.cpp
525       TEST thread_cached_arena_test SOURCES ThreadCachedArenaTest.cpp
526       TEST mallctl_helper_test SOURCES MallctlHelperTest.cpp
527
528     DIRECTORY portability/test/
529       TEST constexpr_test SOURCES ConstexprTest.cpp
530       TEST libgen-test SOURCES LibgenTest.cpp
531       TEST openssl_portability_test SOURCES OpenSSLPortabilityTest.cpp
532       TEST time-test SOURCES TimeTest.cpp
533
534     DIRECTORY ssl/test/
535       TEST openssl_hash_test SOURCES OpenSSLHashTest.cpp
536
537     DIRECTORY stats/test/
538       TEST histogram_test SOURCES HistogramTest.cpp
539       TEST timeseries_histogram_test SOURCES TimeseriesHistogramTest.cpp
540       TEST timeseries_test SOURCES TimeSeriesTest.cpp
541
542     DIRECTORY synchronization/test/
543       TEST baton_test SOURCES BatonTest.cpp
544       TEST call_once_test SOURCES CallOnceTest.cpp
545       TEST lifo_sem_test SOURCES LifoSemTests.cpp
546       TEST rw_spin_lock_test SOURCES RWSpinLockTest.cpp
547
548     DIRECTORY system/test/
549       TEST memory_mapping_test SOURCES MemoryMappingTest.cpp
550       TEST shell_test SOURCES ShellTest.cpp
551       #TEST subprocess_test SOURCES SubprocessTest.cpp
552       TEST thread_id_test SOURCES ThreadIdTest.cpp
553       TEST thread_name_test SOURCES ThreadNameTest.cpp
554
555     DIRECTORY synchronization/test/
556       TEST atomic_struct_test SOURCES AtomicStructTest.cpp
557
558     DIRECTORY test/
559       TEST ahm_int_stress_test SOURCES AHMIntStressTest.cpp
560       TEST arena_smartptr_test SOURCES ArenaSmartPtrTest.cpp
561       TEST ascii_check_test SOURCES AsciiCaseInsensitiveTest.cpp
562       TEST atomic_bit_set_test SOURCES AtomicBitSetTest.cpp
563       TEST atomic_hash_array_test SOURCES AtomicHashArrayTest.cpp
564       TEST atomic_hash_map_test HANGING
565         SOURCES AtomicHashMapTest.cpp
566       TEST atomic_linked_list_test SOURCES AtomicLinkedListTest.cpp
567       TEST atomic_unordered_map_test SOURCES AtomicUnorderedMapTest.cpp
568       TEST cacheline_padded_test SOURCES CachelinePaddedTest.cpp
569       TEST clock_gettime_wrappers_test SOURCES ClockGettimeWrappersTest.cpp
570       TEST concurrent_skip_list_test SOURCES ConcurrentSkipListTest.cpp
571       TEST conv_test SOURCES ConvTest.cpp
572       TEST cpu_id_test SOURCES CpuIdTest.cpp
573       TEST demangle_test SOURCES DemangleTest.cpp
574       TEST deterministic_schedule_test SOURCES DeterministicScheduleTest.cpp
575       TEST discriminated_ptr_test SOURCES DiscriminatedPtrTest.cpp
576       TEST dynamic_test SOURCES DynamicTest.cpp
577       TEST dynamic_converter_test SOURCES DynamicConverterTest.cpp
578       TEST dynamic_other_test SOURCES DynamicOtherTest.cpp
579       TEST endian_test SOURCES EndianTest.cpp
580       TEST exception_test SOURCES ExceptionTest.cpp
581       TEST exception_wrapper_test SOURCES ExceptionWrapperTest.cpp
582       TEST expected_test SOURCES ExpectedTest.cpp
583       TEST fbvector_test SOURCES FBVectorTest.cpp
584       TEST file_test SOURCES FileTest.cpp
585       #TEST file_lock_test SOURCES FileLockTest.cpp
586       TEST file_util_test HANGING
587         SOURCES FileUtilTest.cpp
588       # TEST fingerprint_test SOURCES FingerprintTest.cpp
589       TEST format_other_test SOURCES FormatOtherTest.cpp
590       TEST format_test SOURCES FormatTest.cpp
591       TEST function_scheduler_test SOURCES FunctionSchedulerTest.cpp
592       TEST function_test BROKEN
593         SOURCES FunctionTest.cpp
594       TEST function_ref_test SOURCES FunctionRefTest.cpp
595       TEST futex_test SOURCES FutexTest.cpp
596       TEST group_varint_test SOURCES GroupVarintTest.cpp
597       TEST group_varint_test_ssse3 SOURCES GroupVarintTest.cpp
598       TEST has_member_fn_traits_test SOURCES HasMemberFnTraitsTest.cpp
599       TEST indestructible_test SOURCES IndestructibleTest.cpp
600       TEST indexed_mem_pool_test BROKEN
601         SOURCES IndexedMemPoolTest.cpp
602       # MSVC Preprocessor stringizing raw string literals bug
603       #TEST json_test SOURCES JsonTest.cpp
604       TEST json_other_test
605         CONTENT_DIR json_test_data/
606         SOURCES
607           JsonOtherTest.cpp
608       TEST lazy_test SOURCES LazyTest.cpp
609       TEST lock_traits_test SOURCES LockTraitsTest.cpp
610       TEST locks_test SOURCES SmallLocksTest.cpp SpinLockTest.cpp
611       TEST logging_test SOURCES LoggingTest.cpp
612       TEST math_test SOURCES MathTest.cpp
613       TEST map_util_test SOURCES MapUtilTest.cpp
614       TEST memcpy_test SOURCES MemcpyTest.cpp
615       TEST memory_idler_test SOURCES MemoryIdlerTest.cpp
616       TEST memory_test SOURCES MemoryTest.cpp
617       TEST move_wrapper_test SOURCES MoveWrapperTest.cpp
618       TEST mpmc_pipeline_test SOURCES MPMCPipelineTest.cpp
619       TEST mpmc_queue_test SLOW
620         SOURCES MPMCQueueTest.cpp
621       TEST network_address_test HANGING
622         SOURCES
623           IPAddressTest.cpp
624           MacAddressTest.cpp
625           SocketAddressTest.cpp
626       TEST optional_test SOURCES OptionalTest.cpp
627       TEST packed_sync_ptr_test HANGING
628         SOURCES PackedSyncPtrTest.cpp
629       TEST padded_test SOURCES PaddedTest.cpp
630       #TEST poly_test SOURCES PolyTest.cpp
631       TEST portability_test SOURCES PortabilityTest.cpp
632       TEST producer_consumer_queue_test SLOW
633         SOURCES ProducerConsumerQueueTest.cpp
634       TEST random_test SOURCES RandomTest.cpp
635       TEST range_test SOURCES RangeTest.cpp
636       TEST scope_guard_test SOURCES ScopeGuardTest.cpp
637       # Heavily dependent on drand and srand48
638       #TEST shared_mutex_test SOURCES SharedMutexTest.cpp
639       # SingletonTest requires Subprocess
640       #TEST singleton_test SOURCES SingletonTest.cpp
641       TEST singleton_test_global SOURCES SingletonTestGlobal.cpp
642       TEST singleton_thread_local_test SOURCES SingletonThreadLocalTest.cpp
643       TEST small_vector_test SOURCES small_vector_test.cpp
644       TEST sorted_vector_types_test SOURCES sorted_vector_test.cpp
645       TEST string_test SOURCES StringTest.cpp
646       TEST synchronized_test SOURCES SynchronizedTest.cpp
647       TEST thread_cached_int_test SOURCES ThreadCachedIntTest.cpp
648       TEST thread_local_test SOURCES ThreadLocalTest.cpp
649       TEST timeout_queue_test SOURCES TimeoutQueueTest.cpp
650       TEST token_bucket_test SOURCES TokenBucketTest.cpp
651       TEST traits_test SOURCES TraitsTest.cpp
652       TEST try_test SOURCES TryTest.cpp
653       TEST unit_test SOURCES UnitTest.cpp
654       TEST uri_test SOURCES UriTest.cpp
655       TEST varint_test SOURCES VarintTest.cpp
656   )
657 endif()