CMakeLists.txt revision 9a690580
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 hcsi_reader 49 hkdf 50 lsquic_hash 51 packet_out 52 packno_len 53 parse_packet_in 54 purga 55 qlog 56 quic_be_floats 57 rechist 58 reg_pkt_headergen 59 rst_stream_gquic_be 60 rtt 61 send_headers 62 senhist 63 set 64 sfcw 65 shi 66 spi 67 stop_waiting_gquic_be 68 streamgen 69 streamparse 70 tokgen 71 trapa 72 varint 73 ver_nego 74 wuf_gquic_be 75) 76 77IF (CMAKE_SYSTEM_NAME STREQUAL "Linux") 78 # Linux has fmemopen 79 SET(TESTS ${TESTS} frame_rw) 80ENDIF() 81 82IF (NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") 83 # No regexes on Windows 84 SET(TESTS ${TESTS} ack_merge) 85ENDIF() 86 87 88FOREACH(TEST_NAME ${TESTS}) 89 ADD_EXECUTABLE(test_${TEST_NAME} test_${TEST_NAME}.c ${ADDL_SOURCES}) 90 TARGET_LINK_LIBRARIES(test_${TEST_NAME} ${LIBS} ${LIB_FLAGS}) 91 ADD_TEST(${TEST_NAME} test_${TEST_NAME}) 92ENDFOREACH() 93 94ADD_EXECUTABLE(test_stream test_stream.c ${ADDL_SOURCES}) 95TARGET_LINK_LIBRARIES(test_stream ${LIBS} ${LIB_FLAGS}) 96ADD_TEST(stream test_stream) 97ADD_TEST(stream_hash test_stream -h) 98ADD_TEST(stream_A test_stream -A) 99ADD_TEST(stream_hash_A test_stream -A -h) 100 101ADD_EXECUTABLE(graph_cubic graph_cubic.c ${ADDL_SOURCES}) 102TARGET_LINK_LIBRARIES(graph_cubic ${LIBS}) 103 104ADD_EXECUTABLE(mini_parse mini_parse.c ${ADDL_SOURCES}) 105TARGET_LINK_LIBRARIES(mini_parse ${LIBS}) 106 107ADD_EXECUTABLE(test_min_heap test_min_heap.c ../src/liblsquic/lsquic_min_heap.c) 108ADD_TEST(min_heap test_min_heap) 109 110ADD_EXECUTABLE(test_malo_pooled test_malo.c ../src/liblsquic/lsquic_malo.c) 111SET_TARGET_PROPERTIES(test_malo_pooled 112 PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -DLSQUIC_USE_POOLS=1") 113ADD_TEST(malo_pooled test_malo_pooled) 114 115ADD_EXECUTABLE(test_malo_nopool test_malo.c ../src/liblsquic/lsquic_malo.c) 116SET_TARGET_PROPERTIES(test_malo_nopool 117 PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -DLSQUIC_USE_POOLS=0") 118ADD_TEST(malo_nopool test_malo_nopool) 119 120ADD_EXECUTABLE(test_minmax test_minmax.c ../src/liblsquic/lsquic_minmax.c) 121ADD_TEST(minmax test_minmax) 122