blob: b30ef1780b9f73bab3a24d253159b81f21b5afe1 [file] [log] [blame]
James E. King III3ae30422018-03-12 07:33:22 -04001#
Pascal Bachd5f87e12014-12-12 15:59:17 +01002# 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
James E. King IIIc9ac8d22019-01-07 16:46:45 -050020# Unit tests still require boost
21include(BoostMacros)
22REQUIRE_BOOST_HEADERS()
23set(BOOST_COMPONENTS chrono date_time filesystem random thread unit_test_framework)
24REQUIRE_BOOST_LIBRARIES(BOOST_COMPONENTS)
Pascal Bachd5f87e12014-12-12 15:59:17 +010025
James E. King IIIc9ac8d22019-01-07 16:46:45 -050026include(ThriftMacros)
James E. King, III7edc8fa2017-01-20 10:11:41 -050027
28# Make sure gen-cpp files can be included
Pascal Bachd5f87e12014-12-12 15:59:17 +010029include_directories("${CMAKE_CURRENT_BINARY_DIR}")
30
31# Create the thrift C++ test library
32set(testgencpp_SOURCES
James E. King, IIIb4c190b2017-02-13 16:39:59 -050033 gen-cpp/AnnotationTest_types.cpp
34 gen-cpp/AnnotationTest_types.h
Pascal Bachd5f87e12014-12-12 15:59:17 +010035 gen-cpp/DebugProtoTest_types.cpp
36 gen-cpp/DebugProtoTest_types.h
37 gen-cpp/EnumTest_types.cpp
38 gen-cpp/EnumTest_types.h
39 gen-cpp/OptionalRequiredTest_types.cpp
40 gen-cpp/OptionalRequiredTest_types.h
41 gen-cpp/Recursive_types.cpp
42 gen-cpp/Recursive_types.h
43 gen-cpp/ThriftTest_types.cpp
44 gen-cpp/ThriftTest_types.h
Chet Murthyad08a8b2017-12-19 15:55:56 -080045 gen-cpp/OneWayTest_types.cpp
46 gen-cpp/OneWayTest_types.h
47 gen-cpp/OneWayService.cpp
48 gen-cpp/OneWayService.h
Pascal Bachd5f87e12014-12-12 15:59:17 +010049 gen-cpp/TypedefTest_types.cpp
50 gen-cpp/TypedefTest_types.h
51 ThriftTest_extras.cpp
52 DebugProtoTest_extras.cpp
53)
54
55add_library(testgencpp STATIC ${testgencpp_SOURCES})
Pascal Bachd5f87e12014-12-12 15:59:17 +010056
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +090057set(testgencpp_cob_SOURCES
Pascal Bachd5f87e12014-12-12 15:59:17 +010058 gen-cpp/ChildService.cpp
59 gen-cpp/ChildService.h
Ben Craig1684c422015-04-24 08:52:44 -050060 gen-cpp/EmptyService.cpp
61 gen-cpp/EmptyService.h
Pascal Bachd5f87e12014-12-12 15:59:17 +010062 gen-cpp/ParentService.cpp
63 gen-cpp/ParentService.h
64 gen-cpp/proc_types.cpp
65 gen-cpp/proc_types.h
66)
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +090067add_library(testgencpp_cob STATIC ${testgencpp_cob_SOURCES})
Pascal Bachd5f87e12014-12-12 15:59:17 +010068
Pascal Bachd5f87e12014-12-12 15:59:17 +010069add_executable(Benchmark Benchmark.cpp)
70target_link_libraries(Benchmark testgencpp)
Jim King9de9b1f2015-04-30 16:03:34 -040071LINK_AGAINST_THRIFT_LIBRARY(Benchmark thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +010072add_test(NAME Benchmark COMMAND Benchmark)
Nobuaki Sukegawae8c71d82015-11-23 19:51:37 +090073target_link_libraries(Benchmark testgencpp)
Pascal Bachd5f87e12014-12-12 15:59:17 +010074
75set(UnitTest_SOURCES
76 UnitTestMain.cpp
Chet Murthyad08a8b2017-12-19 15:55:56 -080077 OneWayHTTPTest.cpp
Pascal Bachd5f87e12014-12-12 15:59:17 +010078 TMemoryBufferTest.cpp
79 TBufferBaseTest.cpp
80 Base64Test.cpp
81 ToStringTest.cpp
82 TypedefTest.cpp
Roger Meier3815e0b2015-04-04 16:26:30 +020083 TServerSocketTest.cpp
Ben Craig1684c422015-04-24 08:52:44 -050084 TServerTransportTest.cpp
Pascal Bachd5f87e12014-12-12 15:59:17 +010085)
86
cyyc109e012019-01-05 13:45:07 +080087if(NOT WITH_STDTHREADS AND NOT MSVC AND NOT MINGW)
James E. King, III00d42522017-04-04 09:32:45 -040088 list(APPEND UnitTest_SOURCES concurrency/MutexTest.cpp)
89 list(APPEND UnitTest_SOURCES concurrency/RWMutexStarveTest.cpp)
Pascal Bachd5f87e12014-12-12 15:59:17 +010090endif()
91
92add_executable(UnitTests ${UnitTest_SOURCES})
Nobuaki Sukegawae8c71d82015-11-23 19:51:37 +090093target_link_libraries(UnitTests testgencpp ${Boost_LIBRARIES})
Jim King9de9b1f2015-04-30 16:03:34 -040094LINK_AGAINST_THRIFT_LIBRARY(UnitTests thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +010095add_test(NAME UnitTests COMMAND UnitTests)
ben-craigfae08e72015-07-15 11:34:47 -050096if ( MSVC )
97 # Disable C4503: decorated name length exceeded, name was truncated
98 # 'insanity' results in very long decorated names
99 set_property( TARGET UnitTests APPEND_STRING PROPERTY COMPILE_FLAGS /wd4503 )
100endif ( MSVC )
Pascal Bachd5f87e12014-12-12 15:59:17 +0100101
ben-craigaf2d9c82015-07-16 08:11:21 -0500102
Martin Haimberger0ad6ee92015-11-13 03:18:50 -0800103set( TInterruptTest_SOURCES
104 TSocketInterruptTest.cpp
105 TSSLSocketInterruptTest.cpp
106)
ben-craigaf2d9c82015-07-16 08:11:21 -0500107if (WIN32)
108 list(APPEND TInterruptTest_SOURCES
109 TPipeInterruptTest.cpp
110 )
111endif()
112add_executable(TInterruptTest ${TInterruptTest_SOURCES})
113target_link_libraries(TInterruptTest
Ben Craig1684c422015-04-24 08:52:44 -0500114 testgencpp
115 ${Boost_LIBRARIES}
Ben Craig1684c422015-04-24 08:52:44 -0500116)
ben-craigaf2d9c82015-07-16 08:11:21 -0500117LINK_AGAINST_THRIFT_LIBRARY(TInterruptTest thrift)
Antonio Di Monaco796667b2016-01-04 23:05:19 +0100118if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW)
ben-craigaf2d9c82015-07-16 08:11:21 -0500119target_link_libraries(TInterruptTest -lrt)
Ben Craig1684c422015-04-24 08:52:44 -0500120endif ()
James E. King, III07f59972017-03-10 06:18:33 -0500121add_test(NAME TInterruptTest COMMAND TInterruptTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
Ben Craig1684c422015-04-24 08:52:44 -0500122
123add_executable(TServerIntegrationTest TServerIntegrationTest.cpp)
124target_link_libraries(TServerIntegrationTest
125 testgencpp_cob
126 ${Boost_LIBRARIES}
127)
Jim King9de9b1f2015-04-30 16:03:34 -0400128LINK_AGAINST_THRIFT_LIBRARY(TServerIntegrationTest thrift)
Antonio Di Monaco796667b2016-01-04 23:05:19 +0100129if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW)
Ben Craig1684c422015-04-24 08:52:44 -0500130target_link_libraries(TServerIntegrationTest -lrt)
131endif ()
132add_test(NAME TServerIntegrationTest COMMAND TServerIntegrationTest)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100133
134if(WITH_ZLIB)
Nobuaki Sukegawa3e5b9c22016-02-22 21:47:23 +0900135include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}")
Pascal Bachd5f87e12014-12-12 15:59:17 +0100136add_executable(TransportTest TransportTest.cpp)
137target_link_libraries(TransportTest
138 testgencpp
Pascal Bachd5f87e12014-12-12 15:59:17 +0100139 ${Boost_LIBRARIES}
140 ${ZLIB_LIBRARIES}
141)
Jim King9de9b1f2015-04-30 16:03:34 -0400142LINK_AGAINST_THRIFT_LIBRARY(TransportTest thrift)
143LINK_AGAINST_THRIFT_LIBRARY(TransportTest thriftz)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100144add_test(NAME TransportTest COMMAND TransportTest)
145
146add_executable(ZlibTest ZlibTest.cpp)
147target_link_libraries(ZlibTest
148 testgencpp
Pascal Bachd5f87e12014-12-12 15:59:17 +0100149 ${Boost_LIBRARIES}
150 ${ZLIB_LIBRARIES}
151)
Jim King9de9b1f2015-04-30 16:03:34 -0400152LINK_AGAINST_THRIFT_LIBRARY(ZlibTest thrift)
153LINK_AGAINST_THRIFT_LIBRARY(ZlibTest thriftz)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100154add_test(NAME ZlibTest COMMAND ZlibTest)
155endif(WITH_ZLIB)
156
James E. King, IIIb4c190b2017-02-13 16:39:59 -0500157add_executable(AnnotationTest AnnotationTest.cpp)
158target_link_libraries(AnnotationTest
159 testgencpp
160 ${Boost_LIBRARIES}
161)
162LINK_AGAINST_THRIFT_LIBRARY(AnnotationTest thrift)
163add_test(NAME AnnotationTest COMMAND AnnotationTest)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100164
165add_executable(EnumTest EnumTest.cpp)
166target_link_libraries(EnumTest
167 testgencpp
168 ${Boost_LIBRARIES}
169)
Jim King9de9b1f2015-04-30 16:03:34 -0400170LINK_AGAINST_THRIFT_LIBRARY(EnumTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100171add_test(NAME EnumTest COMMAND EnumTest)
172
Jim King9de9b1f2015-04-30 16:03:34 -0400173if(HAVE_GETOPT_H)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100174add_executable(TFileTransportTest TFileTransportTest.cpp)
175target_link_libraries(TFileTransportTest
176 testgencpp
177 ${Boost_LIBRARIES}
178)
Jim King9de9b1f2015-04-30 16:03:34 -0400179LINK_AGAINST_THRIFT_LIBRARY(TFileTransportTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100180add_test(NAME TFileTransportTest COMMAND TFileTransportTest)
Jim King9de9b1f2015-04-30 16:03:34 -0400181endif()
Pascal Bachd5f87e12014-12-12 15:59:17 +0100182
183add_executable(TFDTransportTest TFDTransportTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200184target_link_libraries(TFDTransportTest
185 ${Boost_LIBRARIES}
186)
Jim King9de9b1f2015-04-30 16:03:34 -0400187LINK_AGAINST_THRIFT_LIBRARY(TFDTransportTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100188add_test(NAME TFDTransportTest COMMAND TFDTransportTest)
189
190add_executable(TPipedTransportTest TPipedTransportTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200191target_link_libraries(TPipedTransportTest
192 ${Boost_LIBRARIES}
193)
Jim King9de9b1f2015-04-30 16:03:34 -0400194LINK_AGAINST_THRIFT_LIBRARY(TPipedTransportTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100195add_test(NAME TPipedTransportTest COMMAND TPipedTransportTest)
196
197set(AllProtocolsTest_SOURCES
198 AllProtocolTests.cpp
199 AllProtocolTests.tcc
200 GenericHelpers
201 )
202
203add_executable(AllProtocolsTest ${AllProtocolsTest_SOURCES})
Claudius Heine5ef662b2015-06-24 10:03:50 +0200204target_link_libraries(AllProtocolsTest
205 testgencpp
206 ${Boost_LIBRARIES}
207)
Jim King9de9b1f2015-04-30 16:03:34 -0400208LINK_AGAINST_THRIFT_LIBRARY(AllProtocolsTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100209add_test(NAME AllProtocolsTest COMMAND AllProtocolsTest)
210
Jim King9de9b1f2015-04-30 16:03:34 -0400211# The debug run-time in Windows asserts on isprint() with negative inputs
212if (NOT MSVC OR (MSVC AND CMAKE_BUILD_TYPE EQUAL "DEBUG"))
Pascal Bachd5f87e12014-12-12 15:59:17 +0100213add_executable(DebugProtoTest DebugProtoTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200214target_link_libraries(DebugProtoTest
215 testgencpp
216 ${Boost_LIBRARIES}
217)
Jim King9de9b1f2015-04-30 16:03:34 -0400218LINK_AGAINST_THRIFT_LIBRARY(DebugProtoTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100219add_test(NAME DebugProtoTest COMMAND DebugProtoTest)
Jim King9de9b1f2015-04-30 16:03:34 -0400220endif()
Pascal Bachd5f87e12014-12-12 15:59:17 +0100221
222add_executable(JSONProtoTest JSONProtoTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200223target_link_libraries(JSONProtoTest
224 testgencpp
225 ${Boost_LIBRARIES}
226)
Jim King9de9b1f2015-04-30 16:03:34 -0400227LINK_AGAINST_THRIFT_LIBRARY(JSONProtoTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100228add_test(NAME JSONProtoTest COMMAND JSONProtoTest)
229
230add_executable(OptionalRequiredTest OptionalRequiredTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200231target_link_libraries(OptionalRequiredTest
232 testgencpp
233 ${Boost_LIBRARIES}
234)
Jim King9de9b1f2015-04-30 16:03:34 -0400235LINK_AGAINST_THRIFT_LIBRARY(OptionalRequiredTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100236add_test(NAME OptionalRequiredTest COMMAND OptionalRequiredTest)
237
238add_executable(RecursiveTest RecursiveTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200239target_link_libraries(RecursiveTest
240 testgencpp
241 ${Boost_LIBRARIES}
242)
Jim King9de9b1f2015-04-30 16:03:34 -0400243LINK_AGAINST_THRIFT_LIBRARY(RecursiveTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100244add_test(NAME RecursiveTest COMMAND RecursiveTest)
245
246add_executable(SpecializationTest SpecializationTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200247target_link_libraries(SpecializationTest
248 testgencpp
249 ${Boost_LIBRARIES}
250)
Jim King9de9b1f2015-04-30 16:03:34 -0400251LINK_AGAINST_THRIFT_LIBRARY(SpecializationTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100252add_test(NAME SpecializationTest COMMAND SpecializationTest)
253
254set(concurrency_test_SOURCES
255 concurrency/Tests.cpp
256 concurrency/ThreadFactoryTests.h
257 concurrency/ThreadManagerTests.h
258 concurrency/TimerManagerTests.h
259)
260add_executable(concurrency_test ${concurrency_test_SOURCES})
Jim King9de9b1f2015-04-30 16:03:34 -0400261LINK_AGAINST_THRIFT_LIBRARY(concurrency_test thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100262add_test(NAME concurrency_test COMMAND concurrency_test)
263
264set(link_test_SOURCES
265 link/LinkTest.cpp
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900266 gen-cpp/ParentService.h
Pascal Bachd5f87e12014-12-12 15:59:17 +0100267 link/TemplatedService1.cpp
268 link/TemplatedService2.cpp
Pascal Bachd5f87e12014-12-12 15:59:17 +0100269)
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900270
Pascal Bachd5f87e12014-12-12 15:59:17 +0100271add_executable(link_test ${link_test_SOURCES})
Jim King9de9b1f2015-04-30 16:03:34 -0400272target_link_libraries(link_test testgencpp_cob)
273LINK_AGAINST_THRIFT_LIBRARY(link_test thrift)
Nobuaki Sukegawae8c71d82015-11-23 19:51:37 +0900274target_link_libraries(link_test testgencpp)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100275add_test(NAME link_test COMMAND link_test)
276
277if(WITH_LIBEVENT)
278set(processor_test_SOURCES
279 processor/ProcessorTest.cpp
280 processor/EventLog.cpp
281 processor/ServerThread.cpp
282 processor/EventLog.h
283 processor/Handlers.h
284 processor/ServerThread.h
285)
286add_executable(processor_test ${processor_test_SOURCES})
287target_link_libraries(processor_test
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900288 testgencpp_cob
Pascal Bachd5f87e12014-12-12 15:59:17 +0100289 ${Boost_LIBRARIES}
290)
Jim King9de9b1f2015-04-30 16:03:34 -0400291LINK_AGAINST_THRIFT_LIBRARY(processor_test thrift)
292LINK_AGAINST_THRIFT_LIBRARY(processor_test thriftnb)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100293add_test(NAME processor_test COMMAND processor_test)
Nobuaki Sukegawa8016af82015-01-02 23:14:22 +0900294
295set(TNonblockingServerTest_SOURCES TNonblockingServerTest.cpp)
296add_executable(TNonblockingServerTest ${TNonblockingServerTest_SOURCES})
297include_directories(${LIBEVENT_INCLUDE_DIRS})
298target_link_libraries(TNonblockingServerTest
299 testgencpp_cob
Nobuaki Sukegawa8016af82015-01-02 23:14:22 +0900300 ${LIBEVENT_LIBRARIES}
301 ${Boost_LIBRARIES}
302)
Jim King9de9b1f2015-04-30 16:03:34 -0400303LINK_AGAINST_THRIFT_LIBRARY(TNonblockingServerTest thrift)
304LINK_AGAINST_THRIFT_LIBRARY(TNonblockingServerTest thriftnb)
Nobuaki Sukegawa8016af82015-01-02 23:14:22 +0900305add_test(NAME TNonblockingServerTest COMMAND TNonblockingServerTest)
James E. King, III82ae9572017-08-05 12:23:54 -0400306
307if(OPENSSL_FOUND AND WITH_OPENSSL)
308 set(TNonblockingSSLServerTest_SOURCES TNonblockingSSLServerTest.cpp)
309 add_executable(TNonblockingSSLServerTest ${TNonblockingSSLServerTest_SOURCES})
310 include_directories(${LIBEVENT_INCLUDE_DIRS})
311 target_link_libraries(TNonblockingSSLServerTest
312 testgencpp_cob
313 ${LIBEVENT_LIBRARIES}
314 ${Boost_LIBRARIES}
315 )
316 LINK_AGAINST_THRIFT_LIBRARY(TNonblockingSSLServerTest thrift)
317 LINK_AGAINST_THRIFT_LIBRARY(TNonblockingSSLServerTest thriftnb)
318 add_test(NAME TNonblockingSSLServerTest COMMAND TNonblockingSSLServerTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
319endif(OPENSSL_FOUND AND WITH_OPENSSL)
320endif(WITH_LIBEVENT)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100321
322if(OPENSSL_FOUND AND WITH_OPENSSL)
323add_executable(OpenSSLManualInitTest OpenSSLManualInitTest.cpp)
324target_link_libraries(OpenSSLManualInitTest
Pascal Bachd5f87e12014-12-12 15:59:17 +0100325 ${OPENSSL_LIBRARIES}
326 ${Boost_LIBRARIES}
327)
Jim King9de9b1f2015-04-30 16:03:34 -0400328LINK_AGAINST_THRIFT_LIBRARY(OpenSSLManualInitTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100329add_test(NAME OpenSSLManualInitTest COMMAND OpenSSLManualInitTest)
Sergei Nikulov34e0bb62015-09-02 13:06:22 +0300330
331add_executable(SecurityTest SecurityTest.cpp)
332target_link_libraries(SecurityTest
333 testgencpp
334 ${Boost_LIBRARIES}
335)
336LINK_AGAINST_THRIFT_LIBRARY(SecurityTest thrift)
Antonio Di Monaco796667b2016-01-04 23:05:19 +0100337if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW)
Sergei Nikulov34e0bb62015-09-02 13:06:22 +0300338target_link_libraries(SecurityTest -lrt)
339endif ()
James E. King, III07f59972017-03-10 06:18:33 -0500340add_test(NAME SecurityTest COMMAND SecurityTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
Sergei Nikulov34e0bb62015-09-02 13:06:22 +0300341
Pascal Bachd5f87e12014-12-12 15:59:17 +0100342endif()
343
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900344if(WITH_QT4)
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900345set(CMAKE_AUTOMOC ON)
346find_package(Qt4 REQUIRED COMPONENTS QtTest)
347set(TQTcpServerTest_SOURCES
348 qt/TQTcpServerTest.cpp
349)
350add_executable(TQTcpServerTest ${TQTcpServerTest_SOURCES})
Jim King9de9b1f2015-04-30 16:03:34 -0400351target_link_libraries(TQTcpServerTest testgencpp_cob thriftqt Qt4::QtTest)
352LINK_AGAINST_THRIFT_LIBRARY(TQTcpServerTest thrift)
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900353add_test(NAME TQTcpServerTest COMMAND TQTcpServerTest)
354endif()
355
Nobuaki Sukegawa66228772014-12-07 21:45:33 +0900356if(WITH_QT5)
357add_subdirectory(qt)
358endif()
359
Pascal Bachd5f87e12014-12-12 15:59:17 +0100360#
361# Common thrift code generation rules
362#
363
James E. King, IIIb4c190b2017-02-13 16:39:59 -0500364add_custom_command(OUTPUT gen-cpp/AnnotationTest_constants.cpp
365 gen-cpp/AnnotationTest_constants.h
366 gen-cpp/AnnotationTest_types.cpp
367 gen-cpp/AnnotationTest_types.h
368 gen-cpp/foo_service.cpp
369 gen-cpp/foo_service.h
370 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/AnnotationTest.thrift
371)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100372
James E. King, IIIb4c190b2017-02-13 16:39:59 -0500373add_custom_command(OUTPUT gen-cpp/DebugProtoTest_types.cpp gen-cpp/DebugProtoTest_types.h gen-cpp/EmptyService.cpp gen-cpp/EmptyService.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900374 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/DebugProtoTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100375)
376
377add_custom_command(OUTPUT gen-cpp/EnumTest_types.cpp gen-cpp/EnumTest_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900378 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/EnumTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100379)
380
381add_custom_command(OUTPUT gen-cpp/TypedefTest_types.cpp gen-cpp/TypedefTest_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900382 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/TypedefTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100383)
384
385add_custom_command(OUTPUT gen-cpp/OptionalRequiredTest_types.cpp gen-cpp/OptionalRequiredTest_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900386 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/OptionalRequiredTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100387)
388
389add_custom_command(OUTPUT gen-cpp/Recursive_types.cpp gen-cpp/Recursive_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900390 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/Recursive.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100391)
392
393add_custom_command(OUTPUT gen-cpp/Service.cpp gen-cpp/StressTest_types.cpp
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900394 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/StressTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100395)
396
397add_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 Sukegawaca939362015-11-14 00:23:40 +0900398 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100399)
400
Chet Murthyad08a8b2017-12-19 15:55:56 -0800401add_custom_command(OUTPUT gen-cpp/OneWayService.cpp gen-cpp/OneWayTest_constants.cpp gen-cpp/OneWayTest_types.h gen-cpp/OneWayService.h gen-cpp/OneWayTest_constants.h gen-cpp/OneWayTest_types.cpp
402 COMMAND ${THRIFT_COMPILER} --gen cpp ${CMAKE_CURRENT_SOURCE_DIR}/OneWayTest.thrift
403)
404
Pascal Bachd5f87e12014-12-12 15:59:17 +0100405add_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 Sukegawaca939362015-11-14 00:23:40 +0900406 COMMAND ${THRIFT_COMPILER} --gen cpp:templates,cob_style ${CMAKE_CURRENT_SOURCE_DIR}/processor/proc.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100407)