blob: 261382f6584bd84a4520a1fd4d39c6fa11baee1a [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
Nobuaki Sukegawac444fb52015-01-02 23:16:55 +090020include_directories(SYSTEM "${Boost_INCLUDE_DIRS}")
Pascal Bachd5f87e12014-12-12 15:59:17 +010021
James E. King, III7edc8fa2017-01-20 10:11:41 -050022if (WITH_DYN_LINK_TEST)
23 add_definitions( -DBOOST_TEST_DYN_LINK )
24endif()
25
26# Make sure gen-cpp files can be included
Pascal Bachd5f87e12014-12-12 15:59:17 +010027include_directories("${CMAKE_CURRENT_BINARY_DIR}")
28
29# Create the thrift C++ test library
30set(testgencpp_SOURCES
James E. King, IIIb4c190b2017-02-13 16:39:59 -050031 gen-cpp/AnnotationTest_types.cpp
32 gen-cpp/AnnotationTest_types.h
Pascal Bachd5f87e12014-12-12 15:59:17 +010033 gen-cpp/DebugProtoTest_types.cpp
34 gen-cpp/DebugProtoTest_types.h
35 gen-cpp/EnumTest_types.cpp
36 gen-cpp/EnumTest_types.h
37 gen-cpp/OptionalRequiredTest_types.cpp
38 gen-cpp/OptionalRequiredTest_types.h
39 gen-cpp/Recursive_types.cpp
40 gen-cpp/Recursive_types.h
41 gen-cpp/ThriftTest_types.cpp
42 gen-cpp/ThriftTest_types.h
Chet Murthyad08a8b2017-12-19 15:55:56 -080043 gen-cpp/OneWayTest_types.cpp
44 gen-cpp/OneWayTest_types.h
45 gen-cpp/OneWayService.cpp
46 gen-cpp/OneWayService.h
Pascal Bachd5f87e12014-12-12 15:59:17 +010047 gen-cpp/TypedefTest_types.cpp
48 gen-cpp/TypedefTest_types.h
49 ThriftTest_extras.cpp
50 DebugProtoTest_extras.cpp
51)
52
53add_library(testgencpp STATIC ${testgencpp_SOURCES})
Pascal Bachd5f87e12014-12-12 15:59:17 +010054
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +090055set(testgencpp_cob_SOURCES
Pascal Bachd5f87e12014-12-12 15:59:17 +010056 gen-cpp/ChildService.cpp
57 gen-cpp/ChildService.h
Ben Craig1684c422015-04-24 08:52:44 -050058 gen-cpp/EmptyService.cpp
59 gen-cpp/EmptyService.h
Pascal Bachd5f87e12014-12-12 15:59:17 +010060 gen-cpp/ParentService.cpp
61 gen-cpp/ParentService.h
62 gen-cpp/proc_types.cpp
63 gen-cpp/proc_types.h
64)
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +090065add_library(testgencpp_cob STATIC ${testgencpp_cob_SOURCES})
Pascal Bachd5f87e12014-12-12 15:59:17 +010066
Pascal Bachd5f87e12014-12-12 15:59:17 +010067add_executable(Benchmark Benchmark.cpp)
68target_link_libraries(Benchmark testgencpp)
Jim King9de9b1f2015-04-30 16:03:34 -040069LINK_AGAINST_THRIFT_LIBRARY(Benchmark thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +010070add_test(NAME Benchmark COMMAND Benchmark)
Nobuaki Sukegawae8c71d82015-11-23 19:51:37 +090071target_link_libraries(Benchmark testgencpp)
Pascal Bachd5f87e12014-12-12 15:59:17 +010072
73set(UnitTest_SOURCES
74 UnitTestMain.cpp
Chet Murthyad08a8b2017-12-19 15:55:56 -080075 OneWayHTTPTest.cpp
Pascal Bachd5f87e12014-12-12 15:59:17 +010076 TMemoryBufferTest.cpp
77 TBufferBaseTest.cpp
78 Base64Test.cpp
79 ToStringTest.cpp
80 TypedefTest.cpp
Roger Meier3815e0b2015-04-04 16:26:30 +020081 TServerSocketTest.cpp
Ben Craig1684c422015-04-24 08:52:44 -050082 TServerTransportTest.cpp
Pascal Bachd5f87e12014-12-12 15:59:17 +010083)
84
James E. King, III07f59972017-03-10 06:18:33 -050085if(NOT WITH_BOOSTTHREADS AND NOT WITH_STDTHREADS AND NOT MSVC AND NOT MINGW)
James E. King, III00d42522017-04-04 09:32:45 -040086 list(APPEND UnitTest_SOURCES concurrency/MutexTest.cpp)
87 list(APPEND UnitTest_SOURCES concurrency/RWMutexStarveTest.cpp)
Pascal Bachd5f87e12014-12-12 15:59:17 +010088endif()
89
90add_executable(UnitTests ${UnitTest_SOURCES})
Nobuaki Sukegawae8c71d82015-11-23 19:51:37 +090091target_link_libraries(UnitTests testgencpp ${Boost_LIBRARIES})
Jim King9de9b1f2015-04-30 16:03:34 -040092LINK_AGAINST_THRIFT_LIBRARY(UnitTests thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +010093add_test(NAME UnitTests COMMAND UnitTests)
ben-craigfae08e72015-07-15 11:34:47 -050094if ( MSVC )
95 # Disable C4503: decorated name length exceeded, name was truncated
96 # 'insanity' results in very long decorated names
97 set_property( TARGET UnitTests APPEND_STRING PROPERTY COMPILE_FLAGS /wd4503 )
98endif ( MSVC )
Pascal Bachd5f87e12014-12-12 15:59:17 +010099
ben-craigaf2d9c82015-07-16 08:11:21 -0500100
Martin Haimberger0ad6ee92015-11-13 03:18:50 -0800101set( TInterruptTest_SOURCES
102 TSocketInterruptTest.cpp
103 TSSLSocketInterruptTest.cpp
104)
ben-craigaf2d9c82015-07-16 08:11:21 -0500105if (WIN32)
106 list(APPEND TInterruptTest_SOURCES
107 TPipeInterruptTest.cpp
108 )
109endif()
110add_executable(TInterruptTest ${TInterruptTest_SOURCES})
111target_link_libraries(TInterruptTest
Ben Craig1684c422015-04-24 08:52:44 -0500112 testgencpp
113 ${Boost_LIBRARIES}
Ben Craig1684c422015-04-24 08:52:44 -0500114)
ben-craigaf2d9c82015-07-16 08:11:21 -0500115LINK_AGAINST_THRIFT_LIBRARY(TInterruptTest thrift)
Antonio Di Monaco796667b2016-01-04 23:05:19 +0100116if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW)
ben-craigaf2d9c82015-07-16 08:11:21 -0500117target_link_libraries(TInterruptTest -lrt)
Ben Craig1684c422015-04-24 08:52:44 -0500118endif ()
James E. King, III07f59972017-03-10 06:18:33 -0500119add_test(NAME TInterruptTest COMMAND TInterruptTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
Ben Craig1684c422015-04-24 08:52:44 -0500120
121add_executable(TServerIntegrationTest TServerIntegrationTest.cpp)
122target_link_libraries(TServerIntegrationTest
123 testgencpp_cob
124 ${Boost_LIBRARIES}
125)
Jim King9de9b1f2015-04-30 16:03:34 -0400126LINK_AGAINST_THRIFT_LIBRARY(TServerIntegrationTest thrift)
Antonio Di Monaco796667b2016-01-04 23:05:19 +0100127if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW)
Ben Craig1684c422015-04-24 08:52:44 -0500128target_link_libraries(TServerIntegrationTest -lrt)
129endif ()
130add_test(NAME TServerIntegrationTest COMMAND TServerIntegrationTest)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100131
132if(WITH_ZLIB)
Nobuaki Sukegawa3e5b9c22016-02-22 21:47:23 +0900133include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}")
Pascal Bachd5f87e12014-12-12 15:59:17 +0100134add_executable(TransportTest TransportTest.cpp)
135target_link_libraries(TransportTest
136 testgencpp
Pascal Bachd5f87e12014-12-12 15:59:17 +0100137 ${Boost_LIBRARIES}
138 ${ZLIB_LIBRARIES}
139)
Jim King9de9b1f2015-04-30 16:03:34 -0400140LINK_AGAINST_THRIFT_LIBRARY(TransportTest thrift)
141LINK_AGAINST_THRIFT_LIBRARY(TransportTest thriftz)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100142add_test(NAME TransportTest COMMAND TransportTest)
143
144add_executable(ZlibTest ZlibTest.cpp)
145target_link_libraries(ZlibTest
146 testgencpp
Pascal Bachd5f87e12014-12-12 15:59:17 +0100147 ${Boost_LIBRARIES}
148 ${ZLIB_LIBRARIES}
149)
Jim King9de9b1f2015-04-30 16:03:34 -0400150LINK_AGAINST_THRIFT_LIBRARY(ZlibTest thrift)
151LINK_AGAINST_THRIFT_LIBRARY(ZlibTest thriftz)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100152add_test(NAME ZlibTest COMMAND ZlibTest)
153endif(WITH_ZLIB)
154
James E. King, IIIb4c190b2017-02-13 16:39:59 -0500155add_executable(AnnotationTest AnnotationTest.cpp)
156target_link_libraries(AnnotationTest
157 testgencpp
158 ${Boost_LIBRARIES}
159)
160LINK_AGAINST_THRIFT_LIBRARY(AnnotationTest thrift)
161add_test(NAME AnnotationTest COMMAND AnnotationTest)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100162
163add_executable(EnumTest EnumTest.cpp)
164target_link_libraries(EnumTest
165 testgencpp
166 ${Boost_LIBRARIES}
167)
Jim King9de9b1f2015-04-30 16:03:34 -0400168LINK_AGAINST_THRIFT_LIBRARY(EnumTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100169add_test(NAME EnumTest COMMAND EnumTest)
170
Jim King9de9b1f2015-04-30 16:03:34 -0400171if(HAVE_GETOPT_H)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100172add_executable(TFileTransportTest TFileTransportTest.cpp)
173target_link_libraries(TFileTransportTest
174 testgencpp
175 ${Boost_LIBRARIES}
176)
Jim King9de9b1f2015-04-30 16:03:34 -0400177LINK_AGAINST_THRIFT_LIBRARY(TFileTransportTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100178add_test(NAME TFileTransportTest COMMAND TFileTransportTest)
Jim King9de9b1f2015-04-30 16:03:34 -0400179endif()
Pascal Bachd5f87e12014-12-12 15:59:17 +0100180
181add_executable(TFDTransportTest TFDTransportTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200182target_link_libraries(TFDTransportTest
183 ${Boost_LIBRARIES}
184)
Jim King9de9b1f2015-04-30 16:03:34 -0400185LINK_AGAINST_THRIFT_LIBRARY(TFDTransportTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100186add_test(NAME TFDTransportTest COMMAND TFDTransportTest)
187
188add_executable(TPipedTransportTest TPipedTransportTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200189target_link_libraries(TPipedTransportTest
190 ${Boost_LIBRARIES}
191)
Jim King9de9b1f2015-04-30 16:03:34 -0400192LINK_AGAINST_THRIFT_LIBRARY(TPipedTransportTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100193add_test(NAME TPipedTransportTest COMMAND TPipedTransportTest)
194
195set(AllProtocolsTest_SOURCES
196 AllProtocolTests.cpp
197 AllProtocolTests.tcc
198 GenericHelpers
199 )
200
201add_executable(AllProtocolsTest ${AllProtocolsTest_SOURCES})
Claudius Heine5ef662b2015-06-24 10:03:50 +0200202target_link_libraries(AllProtocolsTest
203 testgencpp
204 ${Boost_LIBRARIES}
205)
Jim King9de9b1f2015-04-30 16:03:34 -0400206LINK_AGAINST_THRIFT_LIBRARY(AllProtocolsTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100207add_test(NAME AllProtocolsTest COMMAND AllProtocolsTest)
208
Jim King9de9b1f2015-04-30 16:03:34 -0400209# The debug run-time in Windows asserts on isprint() with negative inputs
210if (NOT MSVC OR (MSVC AND CMAKE_BUILD_TYPE EQUAL "DEBUG"))
Pascal Bachd5f87e12014-12-12 15:59:17 +0100211add_executable(DebugProtoTest DebugProtoTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200212target_link_libraries(DebugProtoTest
213 testgencpp
214 ${Boost_LIBRARIES}
215)
Jim King9de9b1f2015-04-30 16:03:34 -0400216LINK_AGAINST_THRIFT_LIBRARY(DebugProtoTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100217add_test(NAME DebugProtoTest COMMAND DebugProtoTest)
Jim King9de9b1f2015-04-30 16:03:34 -0400218endif()
Pascal Bachd5f87e12014-12-12 15:59:17 +0100219
220add_executable(JSONProtoTest JSONProtoTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200221target_link_libraries(JSONProtoTest
222 testgencpp
223 ${Boost_LIBRARIES}
224)
Jim King9de9b1f2015-04-30 16:03:34 -0400225LINK_AGAINST_THRIFT_LIBRARY(JSONProtoTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100226add_test(NAME JSONProtoTest COMMAND JSONProtoTest)
227
228add_executable(OptionalRequiredTest OptionalRequiredTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200229target_link_libraries(OptionalRequiredTest
230 testgencpp
231 ${Boost_LIBRARIES}
232)
Jim King9de9b1f2015-04-30 16:03:34 -0400233LINK_AGAINST_THRIFT_LIBRARY(OptionalRequiredTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100234add_test(NAME OptionalRequiredTest COMMAND OptionalRequiredTest)
235
236add_executable(RecursiveTest RecursiveTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200237target_link_libraries(RecursiveTest
238 testgencpp
239 ${Boost_LIBRARIES}
240)
Jim King9de9b1f2015-04-30 16:03:34 -0400241LINK_AGAINST_THRIFT_LIBRARY(RecursiveTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100242add_test(NAME RecursiveTest COMMAND RecursiveTest)
243
244add_executable(SpecializationTest SpecializationTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200245target_link_libraries(SpecializationTest
246 testgencpp
247 ${Boost_LIBRARIES}
248)
Jim King9de9b1f2015-04-30 16:03:34 -0400249LINK_AGAINST_THRIFT_LIBRARY(SpecializationTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100250add_test(NAME SpecializationTest COMMAND SpecializationTest)
251
252set(concurrency_test_SOURCES
253 concurrency/Tests.cpp
254 concurrency/ThreadFactoryTests.h
255 concurrency/ThreadManagerTests.h
256 concurrency/TimerManagerTests.h
257)
258add_executable(concurrency_test ${concurrency_test_SOURCES})
Jim King9de9b1f2015-04-30 16:03:34 -0400259LINK_AGAINST_THRIFT_LIBRARY(concurrency_test thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100260add_test(NAME concurrency_test COMMAND concurrency_test)
261
262set(link_test_SOURCES
263 link/LinkTest.cpp
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900264 gen-cpp/ParentService.h
Pascal Bachd5f87e12014-12-12 15:59:17 +0100265 link/TemplatedService1.cpp
266 link/TemplatedService2.cpp
Pascal Bachd5f87e12014-12-12 15:59:17 +0100267)
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900268
Pascal Bachd5f87e12014-12-12 15:59:17 +0100269add_executable(link_test ${link_test_SOURCES})
Jim King9de9b1f2015-04-30 16:03:34 -0400270target_link_libraries(link_test testgencpp_cob)
271LINK_AGAINST_THRIFT_LIBRARY(link_test thrift)
Nobuaki Sukegawae8c71d82015-11-23 19:51:37 +0900272target_link_libraries(link_test testgencpp)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100273add_test(NAME link_test COMMAND link_test)
274
275if(WITH_LIBEVENT)
276set(processor_test_SOURCES
277 processor/ProcessorTest.cpp
278 processor/EventLog.cpp
279 processor/ServerThread.cpp
280 processor/EventLog.h
281 processor/Handlers.h
282 processor/ServerThread.h
283)
284add_executable(processor_test ${processor_test_SOURCES})
285target_link_libraries(processor_test
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900286 testgencpp_cob
Pascal Bachd5f87e12014-12-12 15:59:17 +0100287 ${Boost_LIBRARIES}
288)
Jim King9de9b1f2015-04-30 16:03:34 -0400289LINK_AGAINST_THRIFT_LIBRARY(processor_test thrift)
290LINK_AGAINST_THRIFT_LIBRARY(processor_test thriftnb)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100291add_test(NAME processor_test COMMAND processor_test)
Nobuaki Sukegawa8016af82015-01-02 23:14:22 +0900292
293set(TNonblockingServerTest_SOURCES TNonblockingServerTest.cpp)
294add_executable(TNonblockingServerTest ${TNonblockingServerTest_SOURCES})
295include_directories(${LIBEVENT_INCLUDE_DIRS})
296target_link_libraries(TNonblockingServerTest
297 testgencpp_cob
Nobuaki Sukegawa8016af82015-01-02 23:14:22 +0900298 ${LIBEVENT_LIBRARIES}
299 ${Boost_LIBRARIES}
300)
Jim King9de9b1f2015-04-30 16:03:34 -0400301LINK_AGAINST_THRIFT_LIBRARY(TNonblockingServerTest thrift)
302LINK_AGAINST_THRIFT_LIBRARY(TNonblockingServerTest thriftnb)
Nobuaki Sukegawa8016af82015-01-02 23:14:22 +0900303add_test(NAME TNonblockingServerTest COMMAND TNonblockingServerTest)
James E. King, III82ae9572017-08-05 12:23:54 -0400304
305if(OPENSSL_FOUND AND WITH_OPENSSL)
306 set(TNonblockingSSLServerTest_SOURCES TNonblockingSSLServerTest.cpp)
307 add_executable(TNonblockingSSLServerTest ${TNonblockingSSLServerTest_SOURCES})
308 include_directories(${LIBEVENT_INCLUDE_DIRS})
309 target_link_libraries(TNonblockingSSLServerTest
310 testgencpp_cob
311 ${LIBEVENT_LIBRARIES}
312 ${Boost_LIBRARIES}
313 )
314 LINK_AGAINST_THRIFT_LIBRARY(TNonblockingSSLServerTest thrift)
315 LINK_AGAINST_THRIFT_LIBRARY(TNonblockingSSLServerTest thriftnb)
316 add_test(NAME TNonblockingSSLServerTest COMMAND TNonblockingSSLServerTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
317endif(OPENSSL_FOUND AND WITH_OPENSSL)
318endif(WITH_LIBEVENT)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100319
320if(OPENSSL_FOUND AND WITH_OPENSSL)
321add_executable(OpenSSLManualInitTest OpenSSLManualInitTest.cpp)
322target_link_libraries(OpenSSLManualInitTest
Pascal Bachd5f87e12014-12-12 15:59:17 +0100323 ${OPENSSL_LIBRARIES}
324 ${Boost_LIBRARIES}
325)
Jim King9de9b1f2015-04-30 16:03:34 -0400326LINK_AGAINST_THRIFT_LIBRARY(OpenSSLManualInitTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100327add_test(NAME OpenSSLManualInitTest COMMAND OpenSSLManualInitTest)
Sergei Nikulov34e0bb62015-09-02 13:06:22 +0300328
329add_executable(SecurityTest SecurityTest.cpp)
330target_link_libraries(SecurityTest
331 testgencpp
332 ${Boost_LIBRARIES}
333)
334LINK_AGAINST_THRIFT_LIBRARY(SecurityTest thrift)
Antonio Di Monaco796667b2016-01-04 23:05:19 +0100335if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW)
Sergei Nikulov34e0bb62015-09-02 13:06:22 +0300336target_link_libraries(SecurityTest -lrt)
337endif ()
James E. King, III07f59972017-03-10 06:18:33 -0500338add_test(NAME SecurityTest COMMAND SecurityTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
Sergei Nikulov34e0bb62015-09-02 13:06:22 +0300339
Pascal Bachd5f87e12014-12-12 15:59:17 +0100340endif()
341
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900342if(WITH_QT4)
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900343set(CMAKE_AUTOMOC ON)
344find_package(Qt4 REQUIRED COMPONENTS QtTest)
345set(TQTcpServerTest_SOURCES
346 qt/TQTcpServerTest.cpp
347)
348add_executable(TQTcpServerTest ${TQTcpServerTest_SOURCES})
Jim King9de9b1f2015-04-30 16:03:34 -0400349target_link_libraries(TQTcpServerTest testgencpp_cob thriftqt Qt4::QtTest)
350LINK_AGAINST_THRIFT_LIBRARY(TQTcpServerTest thrift)
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900351add_test(NAME TQTcpServerTest COMMAND TQTcpServerTest)
352endif()
353
Nobuaki Sukegawa66228772014-12-07 21:45:33 +0900354if(WITH_QT5)
355add_subdirectory(qt)
356endif()
357
Pascal Bachd5f87e12014-12-12 15:59:17 +0100358#
359# Common thrift code generation rules
360#
361
James E. King, IIIb4c190b2017-02-13 16:39:59 -0500362add_custom_command(OUTPUT gen-cpp/AnnotationTest_constants.cpp
363 gen-cpp/AnnotationTest_constants.h
364 gen-cpp/AnnotationTest_types.cpp
365 gen-cpp/AnnotationTest_types.h
366 gen-cpp/foo_service.cpp
367 gen-cpp/foo_service.h
368 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/AnnotationTest.thrift
369)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100370
James E. King, IIIb4c190b2017-02-13 16:39:59 -0500371add_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 +0900372 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/DebugProtoTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100373)
374
375add_custom_command(OUTPUT gen-cpp/EnumTest_types.cpp gen-cpp/EnumTest_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900376 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/EnumTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100377)
378
379add_custom_command(OUTPUT gen-cpp/TypedefTest_types.cpp gen-cpp/TypedefTest_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900380 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/TypedefTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100381)
382
383add_custom_command(OUTPUT gen-cpp/OptionalRequiredTest_types.cpp gen-cpp/OptionalRequiredTest_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900384 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/OptionalRequiredTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100385)
386
387add_custom_command(OUTPUT gen-cpp/Recursive_types.cpp gen-cpp/Recursive_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900388 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/Recursive.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100389)
390
391add_custom_command(OUTPUT gen-cpp/Service.cpp gen-cpp/StressTest_types.cpp
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900392 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/StressTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100393)
394
395add_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 +0900396 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100397)
398
Chet Murthyad08a8b2017-12-19 15:55:56 -0800399add_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
400 COMMAND ${THRIFT_COMPILER} --gen cpp ${CMAKE_CURRENT_SOURCE_DIR}/OneWayTest.thrift
401)
402
Pascal Bachd5f87e12014-12-12 15:59:17 +0100403add_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 +0900404 COMMAND ${THRIFT_COMPILER} --gen cpp:templates,cob_style ${CMAKE_CURRENT_SOURCE_DIR}/processor/proc.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100405)