James E. King, III | 82ae957 | 2017-08-05 12:23:54 -0400 | [diff] [blame] | 1 | # |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 2 | # Licensed to the Apache Software Foundation (ASF) under one |
| 3 | # or more contributor license agreements. See the NOTICE file |
| 4 | # distributed with this work for additional information |
| 5 | # regarding copyright ownership. The ASF licenses this file |
| 6 | # to you under the Apache License, Version 2.0 (the |
| 7 | # "License"); you may not use this file except in compliance |
| 8 | # with the License. You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, |
| 13 | # software distributed under the License is distributed on an |
| 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | # KIND, either express or implied. See the License for the |
| 16 | # specific language governing permissions and limitations |
| 17 | # under the License. |
| 18 | # |
| 19 | |
Nobuaki Sukegawa | c444fb5 | 2015-01-02 23:16:55 +0900 | [diff] [blame] | 20 | include_directories(SYSTEM "${Boost_INCLUDE_DIRS}") |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 21 | |
James E. King, III | d7142b7 | 2017-09-01 13:00:36 -0700 | [diff] [blame] | 22 | add_definitions("-D__STDC_FORMAT_MACROS") |
James E. King, III | 7edc8fa | 2017-01-20 10:11:41 -0500 | [diff] [blame] | 23 | add_definitions("-D__STDC_LIMIT_MACROS") |
| 24 | |
| 25 | if (WITH_DYN_LINK_TEST) |
| 26 | add_definitions( -DBOOST_TEST_DYN_LINK ) |
| 27 | endif() |
| 28 | |
| 29 | # Make sure gen-cpp files can be included |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 30 | include_directories("${CMAKE_CURRENT_BINARY_DIR}") |
| 31 | |
| 32 | # Create the thrift C++ test library |
| 33 | set(testgencpp_SOURCES |
James E. King, III | b4c190b | 2017-02-13 16:39:59 -0500 | [diff] [blame] | 34 | gen-cpp/AnnotationTest_types.cpp |
| 35 | gen-cpp/AnnotationTest_types.h |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 36 | gen-cpp/DebugProtoTest_types.cpp |
| 37 | gen-cpp/DebugProtoTest_types.h |
| 38 | gen-cpp/EnumTest_types.cpp |
| 39 | gen-cpp/EnumTest_types.h |
| 40 | gen-cpp/OptionalRequiredTest_types.cpp |
| 41 | gen-cpp/OptionalRequiredTest_types.h |
| 42 | gen-cpp/Recursive_types.cpp |
| 43 | gen-cpp/Recursive_types.h |
| 44 | gen-cpp/ThriftTest_types.cpp |
| 45 | gen-cpp/ThriftTest_types.h |
| 46 | gen-cpp/TypedefTest_types.cpp |
| 47 | gen-cpp/TypedefTest_types.h |
| 48 | ThriftTest_extras.cpp |
| 49 | DebugProtoTest_extras.cpp |
| 50 | ) |
| 51 | |
| 52 | add_library(testgencpp STATIC ${testgencpp_SOURCES}) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 53 | |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 54 | set(testgencpp_cob_SOURCES |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 55 | gen-cpp/ChildService.cpp |
| 56 | gen-cpp/ChildService.h |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 57 | gen-cpp/EmptyService.cpp |
| 58 | gen-cpp/EmptyService.h |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 59 | gen-cpp/ParentService.cpp |
| 60 | gen-cpp/ParentService.h |
| 61 | gen-cpp/proc_types.cpp |
| 62 | gen-cpp/proc_types.h |
| 63 | ) |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 64 | add_library(testgencpp_cob STATIC ${testgencpp_cob_SOURCES}) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 65 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 66 | add_executable(Benchmark Benchmark.cpp) |
| 67 | target_link_libraries(Benchmark testgencpp) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 68 | LINK_AGAINST_THRIFT_LIBRARY(Benchmark thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 69 | add_test(NAME Benchmark COMMAND Benchmark) |
Nobuaki Sukegawa | e8c71d8 | 2015-11-23 19:51:37 +0900 | [diff] [blame] | 70 | target_link_libraries(Benchmark testgencpp) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 71 | |
| 72 | set(UnitTest_SOURCES |
| 73 | UnitTestMain.cpp |
| 74 | TMemoryBufferTest.cpp |
| 75 | TBufferBaseTest.cpp |
| 76 | Base64Test.cpp |
| 77 | ToStringTest.cpp |
| 78 | TypedefTest.cpp |
Roger Meier | 3815e0b | 2015-04-04 16:26:30 +0200 | [diff] [blame] | 79 | TServerSocketTest.cpp |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 80 | TServerTransportTest.cpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 81 | ) |
| 82 | |
James E. King, III | 07f5997 | 2017-03-10 06:18:33 -0500 | [diff] [blame] | 83 | if(NOT WITH_BOOSTTHREADS AND NOT WITH_STDTHREADS AND NOT MSVC AND NOT MINGW) |
James E. King, III | 00d4252 | 2017-04-04 09:32:45 -0400 | [diff] [blame] | 84 | list(APPEND UnitTest_SOURCES concurrency/MutexTest.cpp) |
| 85 | list(APPEND UnitTest_SOURCES concurrency/RWMutexStarveTest.cpp) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 86 | endif() |
| 87 | |
| 88 | add_executable(UnitTests ${UnitTest_SOURCES}) |
Nobuaki Sukegawa | e8c71d8 | 2015-11-23 19:51:37 +0900 | [diff] [blame] | 89 | target_link_libraries(UnitTests testgencpp ${Boost_LIBRARIES}) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 90 | LINK_AGAINST_THRIFT_LIBRARY(UnitTests thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 91 | add_test(NAME UnitTests COMMAND UnitTests) |
ben-craig | fae08e7 | 2015-07-15 11:34:47 -0500 | [diff] [blame] | 92 | if ( MSVC ) |
| 93 | # Disable C4503: decorated name length exceeded, name was truncated |
| 94 | # 'insanity' results in very long decorated names |
| 95 | set_property( TARGET UnitTests APPEND_STRING PROPERTY COMPILE_FLAGS /wd4503 ) |
| 96 | endif ( MSVC ) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 97 | |
ben-craig | af2d9c8 | 2015-07-16 08:11:21 -0500 | [diff] [blame] | 98 | |
Martin Haimberger | 0ad6ee9 | 2015-11-13 03:18:50 -0800 | [diff] [blame] | 99 | set( TInterruptTest_SOURCES |
| 100 | TSocketInterruptTest.cpp |
| 101 | TSSLSocketInterruptTest.cpp |
| 102 | ) |
ben-craig | af2d9c8 | 2015-07-16 08:11:21 -0500 | [diff] [blame] | 103 | if (WIN32) |
| 104 | list(APPEND TInterruptTest_SOURCES |
| 105 | TPipeInterruptTest.cpp |
| 106 | ) |
| 107 | endif() |
| 108 | add_executable(TInterruptTest ${TInterruptTest_SOURCES}) |
| 109 | target_link_libraries(TInterruptTest |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 110 | testgencpp |
| 111 | ${Boost_LIBRARIES} |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 112 | ) |
ben-craig | af2d9c8 | 2015-07-16 08:11:21 -0500 | [diff] [blame] | 113 | LINK_AGAINST_THRIFT_LIBRARY(TInterruptTest thrift) |
Antonio Di Monaco | 796667b | 2016-01-04 23:05:19 +0100 | [diff] [blame] | 114 | if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW) |
ben-craig | af2d9c8 | 2015-07-16 08:11:21 -0500 | [diff] [blame] | 115 | target_link_libraries(TInterruptTest -lrt) |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 116 | endif () |
James E. King, III | 07f5997 | 2017-03-10 06:18:33 -0500 | [diff] [blame] | 117 | add_test(NAME TInterruptTest COMMAND TInterruptTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys") |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 118 | |
| 119 | add_executable(TServerIntegrationTest TServerIntegrationTest.cpp) |
| 120 | target_link_libraries(TServerIntegrationTest |
| 121 | testgencpp_cob |
| 122 | ${Boost_LIBRARIES} |
| 123 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 124 | LINK_AGAINST_THRIFT_LIBRARY(TServerIntegrationTest thrift) |
Antonio Di Monaco | 796667b | 2016-01-04 23:05:19 +0100 | [diff] [blame] | 125 | if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW) |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 126 | target_link_libraries(TServerIntegrationTest -lrt) |
| 127 | endif () |
| 128 | add_test(NAME TServerIntegrationTest COMMAND TServerIntegrationTest) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 129 | |
| 130 | if(WITH_ZLIB) |
Nobuaki Sukegawa | 3e5b9c2 | 2016-02-22 21:47:23 +0900 | [diff] [blame] | 131 | include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}") |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 132 | add_executable(TransportTest TransportTest.cpp) |
| 133 | target_link_libraries(TransportTest |
| 134 | testgencpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 135 | ${Boost_LIBRARIES} |
| 136 | ${ZLIB_LIBRARIES} |
| 137 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 138 | LINK_AGAINST_THRIFT_LIBRARY(TransportTest thrift) |
| 139 | LINK_AGAINST_THRIFT_LIBRARY(TransportTest thriftz) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 140 | add_test(NAME TransportTest COMMAND TransportTest) |
| 141 | |
| 142 | add_executable(ZlibTest ZlibTest.cpp) |
| 143 | target_link_libraries(ZlibTest |
| 144 | testgencpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 145 | ${Boost_LIBRARIES} |
| 146 | ${ZLIB_LIBRARIES} |
| 147 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 148 | LINK_AGAINST_THRIFT_LIBRARY(ZlibTest thrift) |
| 149 | LINK_AGAINST_THRIFT_LIBRARY(ZlibTest thriftz) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 150 | add_test(NAME ZlibTest COMMAND ZlibTest) |
| 151 | endif(WITH_ZLIB) |
| 152 | |
James E. King, III | b4c190b | 2017-02-13 16:39:59 -0500 | [diff] [blame] | 153 | add_executable(AnnotationTest AnnotationTest.cpp) |
| 154 | target_link_libraries(AnnotationTest |
| 155 | testgencpp |
| 156 | ${Boost_LIBRARIES} |
| 157 | ) |
| 158 | LINK_AGAINST_THRIFT_LIBRARY(AnnotationTest thrift) |
| 159 | add_test(NAME AnnotationTest COMMAND AnnotationTest) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 160 | |
| 161 | add_executable(EnumTest EnumTest.cpp) |
| 162 | target_link_libraries(EnumTest |
| 163 | testgencpp |
| 164 | ${Boost_LIBRARIES} |
| 165 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 166 | LINK_AGAINST_THRIFT_LIBRARY(EnumTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 167 | add_test(NAME EnumTest COMMAND EnumTest) |
| 168 | |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 169 | if(HAVE_GETOPT_H) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 170 | add_executable(TFileTransportTest TFileTransportTest.cpp) |
| 171 | target_link_libraries(TFileTransportTest |
| 172 | testgencpp |
| 173 | ${Boost_LIBRARIES} |
| 174 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 175 | LINK_AGAINST_THRIFT_LIBRARY(TFileTransportTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 176 | add_test(NAME TFileTransportTest COMMAND TFileTransportTest) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 177 | endif() |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 178 | |
| 179 | add_executable(TFDTransportTest TFDTransportTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 180 | target_link_libraries(TFDTransportTest |
| 181 | ${Boost_LIBRARIES} |
| 182 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 183 | LINK_AGAINST_THRIFT_LIBRARY(TFDTransportTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 184 | add_test(NAME TFDTransportTest COMMAND TFDTransportTest) |
| 185 | |
| 186 | add_executable(TPipedTransportTest TPipedTransportTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 187 | target_link_libraries(TPipedTransportTest |
| 188 | ${Boost_LIBRARIES} |
| 189 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 190 | LINK_AGAINST_THRIFT_LIBRARY(TPipedTransportTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 191 | add_test(NAME TPipedTransportTest COMMAND TPipedTransportTest) |
| 192 | |
| 193 | set(AllProtocolsTest_SOURCES |
| 194 | AllProtocolTests.cpp |
| 195 | AllProtocolTests.tcc |
| 196 | GenericHelpers |
| 197 | ) |
| 198 | |
| 199 | add_executable(AllProtocolsTest ${AllProtocolsTest_SOURCES}) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 200 | target_link_libraries(AllProtocolsTest |
| 201 | testgencpp |
| 202 | ${Boost_LIBRARIES} |
| 203 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 204 | LINK_AGAINST_THRIFT_LIBRARY(AllProtocolsTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 205 | add_test(NAME AllProtocolsTest COMMAND AllProtocolsTest) |
| 206 | |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 207 | # The debug run-time in Windows asserts on isprint() with negative inputs |
| 208 | if (NOT MSVC OR (MSVC AND CMAKE_BUILD_TYPE EQUAL "DEBUG")) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 209 | add_executable(DebugProtoTest DebugProtoTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 210 | target_link_libraries(DebugProtoTest |
| 211 | testgencpp |
| 212 | ${Boost_LIBRARIES} |
| 213 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 214 | LINK_AGAINST_THRIFT_LIBRARY(DebugProtoTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 215 | add_test(NAME DebugProtoTest COMMAND DebugProtoTest) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 216 | endif() |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 217 | |
| 218 | add_executable(JSONProtoTest JSONProtoTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 219 | target_link_libraries(JSONProtoTest |
| 220 | testgencpp |
| 221 | ${Boost_LIBRARIES} |
| 222 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 223 | LINK_AGAINST_THRIFT_LIBRARY(JSONProtoTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 224 | add_test(NAME JSONProtoTest COMMAND JSONProtoTest) |
| 225 | |
| 226 | add_executable(OptionalRequiredTest OptionalRequiredTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 227 | target_link_libraries(OptionalRequiredTest |
| 228 | testgencpp |
| 229 | ${Boost_LIBRARIES} |
| 230 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 231 | LINK_AGAINST_THRIFT_LIBRARY(OptionalRequiredTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 232 | add_test(NAME OptionalRequiredTest COMMAND OptionalRequiredTest) |
| 233 | |
| 234 | add_executable(RecursiveTest RecursiveTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 235 | target_link_libraries(RecursiveTest |
| 236 | testgencpp |
| 237 | ${Boost_LIBRARIES} |
| 238 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 239 | LINK_AGAINST_THRIFT_LIBRARY(RecursiveTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 240 | add_test(NAME RecursiveTest COMMAND RecursiveTest) |
| 241 | |
| 242 | add_executable(SpecializationTest SpecializationTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 243 | target_link_libraries(SpecializationTest |
| 244 | testgencpp |
| 245 | ${Boost_LIBRARIES} |
| 246 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 247 | LINK_AGAINST_THRIFT_LIBRARY(SpecializationTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 248 | add_test(NAME SpecializationTest COMMAND SpecializationTest) |
| 249 | |
| 250 | set(concurrency_test_SOURCES |
| 251 | concurrency/Tests.cpp |
| 252 | concurrency/ThreadFactoryTests.h |
| 253 | concurrency/ThreadManagerTests.h |
| 254 | concurrency/TimerManagerTests.h |
| 255 | ) |
| 256 | add_executable(concurrency_test ${concurrency_test_SOURCES}) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 257 | LINK_AGAINST_THRIFT_LIBRARY(concurrency_test thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 258 | add_test(NAME concurrency_test COMMAND concurrency_test) |
| 259 | |
| 260 | set(link_test_SOURCES |
| 261 | link/LinkTest.cpp |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 262 | gen-cpp/ParentService.h |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 263 | link/TemplatedService1.cpp |
| 264 | link/TemplatedService2.cpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 265 | ) |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 266 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 267 | add_executable(link_test ${link_test_SOURCES}) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 268 | target_link_libraries(link_test testgencpp_cob) |
| 269 | LINK_AGAINST_THRIFT_LIBRARY(link_test thrift) |
Nobuaki Sukegawa | e8c71d8 | 2015-11-23 19:51:37 +0900 | [diff] [blame] | 270 | target_link_libraries(link_test testgencpp) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 271 | add_test(NAME link_test COMMAND link_test) |
| 272 | |
| 273 | if(WITH_LIBEVENT) |
| 274 | set(processor_test_SOURCES |
| 275 | processor/ProcessorTest.cpp |
| 276 | processor/EventLog.cpp |
| 277 | processor/ServerThread.cpp |
| 278 | processor/EventLog.h |
| 279 | processor/Handlers.h |
| 280 | processor/ServerThread.h |
| 281 | ) |
| 282 | add_executable(processor_test ${processor_test_SOURCES}) |
| 283 | target_link_libraries(processor_test |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 284 | testgencpp_cob |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 285 | ${Boost_LIBRARIES} |
| 286 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 287 | LINK_AGAINST_THRIFT_LIBRARY(processor_test thrift) |
| 288 | LINK_AGAINST_THRIFT_LIBRARY(processor_test thriftnb) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 289 | add_test(NAME processor_test COMMAND processor_test) |
Nobuaki Sukegawa | 8016af8 | 2015-01-02 23:14:22 +0900 | [diff] [blame] | 290 | |
| 291 | set(TNonblockingServerTest_SOURCES TNonblockingServerTest.cpp) |
| 292 | add_executable(TNonblockingServerTest ${TNonblockingServerTest_SOURCES}) |
| 293 | include_directories(${LIBEVENT_INCLUDE_DIRS}) |
| 294 | target_link_libraries(TNonblockingServerTest |
| 295 | testgencpp_cob |
Nobuaki Sukegawa | 8016af8 | 2015-01-02 23:14:22 +0900 | [diff] [blame] | 296 | ${LIBEVENT_LIBRARIES} |
| 297 | ${Boost_LIBRARIES} |
| 298 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 299 | LINK_AGAINST_THRIFT_LIBRARY(TNonblockingServerTest thrift) |
| 300 | LINK_AGAINST_THRIFT_LIBRARY(TNonblockingServerTest thriftnb) |
Nobuaki Sukegawa | 8016af8 | 2015-01-02 23:14:22 +0900 | [diff] [blame] | 301 | add_test(NAME TNonblockingServerTest COMMAND TNonblockingServerTest) |
James E. King, III | 82ae957 | 2017-08-05 12:23:54 -0400 | [diff] [blame] | 302 | |
| 303 | if(OPENSSL_FOUND AND WITH_OPENSSL) |
| 304 | set(TNonblockingSSLServerTest_SOURCES TNonblockingSSLServerTest.cpp) |
| 305 | add_executable(TNonblockingSSLServerTest ${TNonblockingSSLServerTest_SOURCES}) |
| 306 | include_directories(${LIBEVENT_INCLUDE_DIRS}) |
| 307 | target_link_libraries(TNonblockingSSLServerTest |
| 308 | testgencpp_cob |
| 309 | ${LIBEVENT_LIBRARIES} |
| 310 | ${Boost_LIBRARIES} |
| 311 | ) |
| 312 | LINK_AGAINST_THRIFT_LIBRARY(TNonblockingSSLServerTest thrift) |
| 313 | LINK_AGAINST_THRIFT_LIBRARY(TNonblockingSSLServerTest thriftnb) |
| 314 | add_test(NAME TNonblockingSSLServerTest COMMAND TNonblockingSSLServerTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys") |
| 315 | endif(OPENSSL_FOUND AND WITH_OPENSSL) |
| 316 | endif(WITH_LIBEVENT) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 317 | |
| 318 | if(OPENSSL_FOUND AND WITH_OPENSSL) |
| 319 | add_executable(OpenSSLManualInitTest OpenSSLManualInitTest.cpp) |
| 320 | target_link_libraries(OpenSSLManualInitTest |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 321 | ${OPENSSL_LIBRARIES} |
| 322 | ${Boost_LIBRARIES} |
| 323 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 324 | LINK_AGAINST_THRIFT_LIBRARY(OpenSSLManualInitTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 325 | add_test(NAME OpenSSLManualInitTest COMMAND OpenSSLManualInitTest) |
Sergei Nikulov | 34e0bb6 | 2015-09-02 13:06:22 +0300 | [diff] [blame] | 326 | |
| 327 | add_executable(SecurityTest SecurityTest.cpp) |
| 328 | target_link_libraries(SecurityTest |
| 329 | testgencpp |
| 330 | ${Boost_LIBRARIES} |
| 331 | ) |
| 332 | LINK_AGAINST_THRIFT_LIBRARY(SecurityTest thrift) |
Antonio Di Monaco | 796667b | 2016-01-04 23:05:19 +0100 | [diff] [blame] | 333 | if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW) |
Sergei Nikulov | 34e0bb6 | 2015-09-02 13:06:22 +0300 | [diff] [blame] | 334 | target_link_libraries(SecurityTest -lrt) |
| 335 | endif () |
James E. King, III | 07f5997 | 2017-03-10 06:18:33 -0500 | [diff] [blame] | 336 | add_test(NAME SecurityTest COMMAND SecurityTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys") |
Sergei Nikulov | 34e0bb6 | 2015-09-02 13:06:22 +0300 | [diff] [blame] | 337 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 338 | endif() |
| 339 | |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 340 | if(WITH_QT4) |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 341 | set(CMAKE_AUTOMOC ON) |
| 342 | find_package(Qt4 REQUIRED COMPONENTS QtTest) |
| 343 | set(TQTcpServerTest_SOURCES |
| 344 | qt/TQTcpServerTest.cpp |
| 345 | ) |
| 346 | add_executable(TQTcpServerTest ${TQTcpServerTest_SOURCES}) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 347 | target_link_libraries(TQTcpServerTest testgencpp_cob thriftqt Qt4::QtTest) |
| 348 | LINK_AGAINST_THRIFT_LIBRARY(TQTcpServerTest thrift) |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 349 | add_test(NAME TQTcpServerTest COMMAND TQTcpServerTest) |
| 350 | endif() |
| 351 | |
Nobuaki Sukegawa | 6622877 | 2014-12-07 21:45:33 +0900 | [diff] [blame] | 352 | if(WITH_QT5) |
| 353 | add_subdirectory(qt) |
| 354 | endif() |
| 355 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 356 | # |
| 357 | # Common thrift code generation rules |
| 358 | # |
| 359 | |
James E. King, III | b4c190b | 2017-02-13 16:39:59 -0500 | [diff] [blame] | 360 | add_custom_command(OUTPUT gen-cpp/AnnotationTest_constants.cpp |
| 361 | gen-cpp/AnnotationTest_constants.h |
| 362 | gen-cpp/AnnotationTest_types.cpp |
| 363 | gen-cpp/AnnotationTest_types.h |
| 364 | gen-cpp/foo_service.cpp |
| 365 | gen-cpp/foo_service.h |
| 366 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/AnnotationTest.thrift |
| 367 | ) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 368 | |
James E. King, III | b4c190b | 2017-02-13 16:39:59 -0500 | [diff] [blame] | 369 | add_custom_command(OUTPUT gen-cpp/DebugProtoTest_types.cpp gen-cpp/DebugProtoTest_types.h gen-cpp/EmptyService.cpp gen-cpp/EmptyService.h |
Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 370 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/DebugProtoTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 371 | ) |
| 372 | |
| 373 | add_custom_command(OUTPUT gen-cpp/EnumTest_types.cpp gen-cpp/EnumTest_types.h |
Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 374 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/EnumTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 375 | ) |
| 376 | |
| 377 | add_custom_command(OUTPUT gen-cpp/TypedefTest_types.cpp gen-cpp/TypedefTest_types.h |
Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 378 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/TypedefTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 379 | ) |
| 380 | |
| 381 | add_custom_command(OUTPUT gen-cpp/OptionalRequiredTest_types.cpp gen-cpp/OptionalRequiredTest_types.h |
Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 382 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/OptionalRequiredTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 383 | ) |
| 384 | |
| 385 | add_custom_command(OUTPUT gen-cpp/Recursive_types.cpp gen-cpp/Recursive_types.h |
Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 386 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/Recursive.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 387 | ) |
| 388 | |
| 389 | add_custom_command(OUTPUT gen-cpp/Service.cpp gen-cpp/StressTest_types.cpp |
Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 390 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/StressTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 391 | ) |
| 392 | |
| 393 | add_custom_command(OUTPUT gen-cpp/SecondService.cpp gen-cpp/ThriftTest_constants.cpp gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_types.h |
Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 394 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 395 | ) |
| 396 | |
| 397 | add_custom_command(OUTPUT gen-cpp/ChildService.cpp gen-cpp/ChildService.h gen-cpp/ParentService.cpp gen-cpp/ParentService.h gen-cpp/proc_types.cpp gen-cpp/proc_types.h |
Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 398 | COMMAND ${THRIFT_COMPILER} --gen cpp:templates,cob_style ${CMAKE_CURRENT_SOURCE_DIR}/processor/proc.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 399 | ) |