CMakeLists.txt revision fb3e20e0
1# Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. 2INCLUDE_DIRECTORIES(../src/liblsquic) 3 4ENABLE_TESTING() 5 6SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLSQUIC_TEST=1") 7 8IF (MSVC) 9 SET(ADDL_SOURCES ../wincompat/getopt.c ../wincompat/getopt1.c) 10 SET(LIB_FLAGS "-FORCE:MULTIPLE") 11ELSE() 12 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-value") 13 IF (CMAKE_C_COMPILER_ID STREQUAL GNU) 14 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-override-init") 15 ENDIF() 16 IF (CMAKE_C_COMPILER_ID STREQUAL Clang) 17 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-initializer-overrides") 18 ENDIF() 19ENDIF() 20 21include_directories(../src/liblsquic/ls-qpack) 22INCLUDE_DIRECTORIES(../src/lshpack) 23 24SET(TESTS 25 ack 26 ackgen_gquic_be 27 ackparse_gquic_be 28 ackparse_ietf 29 alarmset 30 alt_svc_ver 31 arr 32 attq 33 blocked_gquic_be 34 bw_sampler 35 conn_close_gquic_be 36 crypto_gen 37 cubic 38 dec 39 di_nocopy 40 elision 41 engine_ctor 42 export_key 43 frame_chop 44 frame_reader 45 frame_writer 46 goaway_gquic_be 47 h3_framing 48 hkdf 49 lsquic_hash 50 packet_out 51 packno_len 52 parse_packet_in 53 purga 54 qlog 55 quic_be_floats 56 rechist 57 reg_pkt_headergen 58 rst_stream_gquic_be 59 rtt 60 send_headers 61 senhist 62 set 63 sfcw 64 shi 65 spi 66 stop_waiting_gquic_be 67 streamgen 68 streamparse 69 tokgen 70 trapa 71 varint 72 ver_nego 73 wuf_gquic_be 74) 75 76IF (CMAKE_SYSTEM_NAME STREQUAL "Linux") 77 # Linux has fmemopen 78 SET(TESTS ${TESTS} frame_rw) 79ENDIF() 80 81IF (NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") 82 # No regexes on Windows 83 SET(TESTS ${TESTS} ack_merge) 84 # No open_memstream() on Windows 85 SET(TESTS ${TESTS} hcsi_reader) 86ENDIF() 87 88 89FOREACH(TEST_NAME ${TESTS}) 90 ADD_EXECUTABLE(test_${TEST_NAME} test_${TEST_NAME}.c ${ADDL_SOURCES}) 91 TARGET_LINK_LIBRARIES(test_${TEST_NAME} ${LIBS} ${LIB_FLAGS}) 92 ADD_TEST(${TEST_NAME} test_${TEST_NAME}) 93ENDFOREACH() 94 95ADD_EXECUTABLE(test_stream test_stream.c ${ADDL_SOURCES}) 96TARGET_LINK_LIBRARIES(test_stream ${LIBS} ${LIB_FLAGS}) 97ADD_TEST(stream test_stream) 98ADD_TEST(stream_hash test_stream -h) 99ADD_TEST(stream_A test_stream -A) 100ADD_TEST(stream_hash_A test_stream -A -h) 101 102IF(NOT MSVC) 103ADD_EXECUTABLE(graph_cubic graph_cubic.c ${ADDL_SOURCES}) 104TARGET_LINK_LIBRARIES(graph_cubic ${LIBS}) 105 106ADD_EXECUTABLE(mini_parse mini_parse.c ${ADDL_SOURCES}) 107TARGET_LINK_LIBRARIES(mini_parse ${LIBS}) 108ENDIF() 109 110ADD_EXECUTABLE(test_min_heap test_min_heap.c ../src/liblsquic/lsquic_min_heap.c) 111ADD_TEST(min_heap test_min_heap) 112 113SET(MALO_SRC test_malo.c ../src/liblsquic/lsquic_malo.c) 114IF(MSVC) 115 LIST(APPEND MALO_SRC ../wincompat/getopt.c) 116ENDIF() 117ADD_EXECUTABLE(test_malo_pooled ${MALO_SRC}) 118SET_TARGET_PROPERTIES(test_malo_pooled 119 PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -DLSQUIC_USE_POOLS=1") 120ADD_TEST(malo_pooled test_malo_pooled) 121 122ADD_EXECUTABLE(test_malo_nopool ${MALO_SRC}) 123SET_TARGET_PROPERTIES(test_malo_nopool 124 PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -DLSQUIC_USE_POOLS=0") 125ADD_TEST(malo_nopool test_malo_nopool) 126 127ADD_EXECUTABLE(test_minmax test_minmax.c ../src/liblsquic/lsquic_minmax.c) 128ADD_TEST(minmax test_minmax) 129