blob: 87ed1094cb4ba788940451ac7aa744cdc4e83030 [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()
Mario Emmenlauerb0136812021-08-02 21:55:34 +020023set(BOOST_COMPONENTS filesystem thread unit_test_framework chrono)
James E. King IIIc9ac8d22019-01-07 16:46:45 -050024REQUIRE_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.h
46 gen-cpp/OneWayService.cpp
47 gen-cpp/OneWayService.h
Pascal Bachd5f87e12014-12-12 15:59:17 +010048 gen-cpp/TypedefTest_types.cpp
49 gen-cpp/TypedefTest_types.h
50 ThriftTest_extras.cpp
51 DebugProtoTest_extras.cpp
52)
53
54add_library(testgencpp STATIC ${testgencpp_SOURCES})
Pascal Bachd5f87e12014-12-12 15:59:17 +010055
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +090056set(testgencpp_cob_SOURCES
Pascal Bachd5f87e12014-12-12 15:59:17 +010057 gen-cpp/ChildService.cpp
58 gen-cpp/ChildService.h
Ben Craig1684c422015-04-24 08:52:44 -050059 gen-cpp/EmptyService.cpp
60 gen-cpp/EmptyService.h
Pascal Bachd5f87e12014-12-12 15:59:17 +010061 gen-cpp/ParentService.cpp
62 gen-cpp/ParentService.h
63 gen-cpp/proc_types.cpp
64 gen-cpp/proc_types.h
65)
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +090066add_library(testgencpp_cob STATIC ${testgencpp_cob_SOURCES})
Pascal Bachd5f87e12014-12-12 15:59:17 +010067
Pascal Bachd5f87e12014-12-12 15:59:17 +010068add_executable(Benchmark Benchmark.cpp)
69target_link_libraries(Benchmark testgencpp)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +020070target_link_libraries(Benchmark thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +010071add_test(NAME Benchmark COMMAND Benchmark)
Nobuaki Sukegawae8c71d82015-11-23 19:51:37 +090072target_link_libraries(Benchmark testgencpp)
Pascal Bachd5f87e12014-12-12 15:59:17 +010073
74set(UnitTest_SOURCES
75 UnitTestMain.cpp
Chet Murthyad08a8b2017-12-19 15:55:56 -080076 OneWayHTTPTest.cpp
Pascal Bachd5f87e12014-12-12 15:59:17 +010077 TMemoryBufferTest.cpp
78 TBufferBaseTest.cpp
79 Base64Test.cpp
80 ToStringTest.cpp
81 TypedefTest.cpp
Roger Meier3815e0b2015-04-04 16:26:30 +020082 TServerSocketTest.cpp
Ben Craig1684c422015-04-24 08:52:44 -050083 TServerTransportTest.cpp
zeshuai00786352b42020-06-15 17:00:33 +080084 ThrifttReadCheckTests.cpp
Pascal Bachd5f87e12014-12-12 15:59:17 +010085)
86
Pascal Bachd5f87e12014-12-12 15:59:17 +010087add_executable(UnitTests ${UnitTest_SOURCES})
Nobuaki Sukegawae8c71d82015-11-23 19:51:37 +090088target_link_libraries(UnitTests testgencpp ${Boost_LIBRARIES})
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +020089target_link_libraries(UnitTests thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +010090add_test(NAME UnitTests COMMAND UnitTests)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +010091if(MSVC)
ben-craigfae08e72015-07-15 11:34:47 -050092 # Disable C4503: decorated name length exceeded, name was truncated
93 # 'insanity' results in very long decorated names
94 set_property( TARGET UnitTests APPEND_STRING PROPERTY COMPILE_FLAGS /wd4503 )
Mario Emmenlauer9fab2382021-02-04 21:10:43 +010095endif()
Pascal Bachd5f87e12014-12-12 15:59:17 +010096
ben-craigaf2d9c82015-07-16 08:11:21 -050097
Martin Haimberger0ad6ee92015-11-13 03:18:50 -080098set( TInterruptTest_SOURCES
99 TSocketInterruptTest.cpp
100 TSSLSocketInterruptTest.cpp
101)
ben-craigaf2d9c82015-07-16 08:11:21 -0500102if (WIN32)
103 list(APPEND TInterruptTest_SOURCES
104 TPipeInterruptTest.cpp
105 )
106endif()
107add_executable(TInterruptTest ${TInterruptTest_SOURCES})
108target_link_libraries(TInterruptTest
Ben Craig1684c422015-04-24 08:52:44 -0500109 testgencpp
110 ${Boost_LIBRARIES}
Ben Craig1684c422015-04-24 08:52:44 -0500111)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200112target_link_libraries(TInterruptTest thrift)
Antonio Di Monaco796667b2016-01-04 23:05:19 +0100113if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100114 target_link_libraries(TInterruptTest -lrt)
Ben Craig1684c422015-04-24 08:52:44 -0500115endif ()
James E. King, III07f59972017-03-10 06:18:33 -0500116add_test(NAME TInterruptTest COMMAND TInterruptTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
Ben Craig1684c422015-04-24 08:52:44 -0500117
118add_executable(TServerIntegrationTest TServerIntegrationTest.cpp)
119target_link_libraries(TServerIntegrationTest
120 testgencpp_cob
121 ${Boost_LIBRARIES}
122)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200123target_link_libraries(TServerIntegrationTest thrift)
Antonio Di Monaco796667b2016-01-04 23:05:19 +0100124if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100125 target_link_libraries(TServerIntegrationTest -lrt)
Ben Craig1684c422015-04-24 08:52:44 -0500126endif ()
127add_test(NAME TServerIntegrationTest COMMAND TServerIntegrationTest)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100128
129if(WITH_ZLIB)
Nobuaki Sukegawa3e5b9c22016-02-22 21:47:23 +0900130include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}")
Pascal Bachd5f87e12014-12-12 15:59:17 +0100131add_executable(TransportTest TransportTest.cpp)
132target_link_libraries(TransportTest
133 testgencpp
Pascal Bachd5f87e12014-12-12 15:59:17 +0100134 ${Boost_LIBRARIES}
135 ${ZLIB_LIBRARIES}
136)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200137target_link_libraries(TransportTest thrift)
138target_link_libraries(TransportTest thriftz)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100139add_test(NAME TransportTest COMMAND TransportTest)
140
141add_executable(ZlibTest ZlibTest.cpp)
142target_link_libraries(ZlibTest
143 testgencpp
Pascal Bachd5f87e12014-12-12 15:59:17 +0100144 ${Boost_LIBRARIES}
145 ${ZLIB_LIBRARIES}
146)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200147target_link_libraries(ZlibTest thrift)
148target_link_libraries(ZlibTest thriftz)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100149add_test(NAME ZlibTest COMMAND ZlibTest)
150endif(WITH_ZLIB)
151
James E. King, IIIb4c190b2017-02-13 16:39:59 -0500152add_executable(AnnotationTest AnnotationTest.cpp)
153target_link_libraries(AnnotationTest
154 testgencpp
155 ${Boost_LIBRARIES}
156)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200157target_link_libraries(AnnotationTest thrift)
James E. King, IIIb4c190b2017-02-13 16:39:59 -0500158add_test(NAME AnnotationTest COMMAND AnnotationTest)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100159
160add_executable(EnumTest EnumTest.cpp)
161target_link_libraries(EnumTest
162 testgencpp
163 ${Boost_LIBRARIES}
164)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200165target_link_libraries(EnumTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100166add_test(NAME EnumTest COMMAND EnumTest)
167
Jim King9de9b1f2015-04-30 16:03:34 -0400168if(HAVE_GETOPT_H)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100169add_executable(TFileTransportTest TFileTransportTest.cpp)
170target_link_libraries(TFileTransportTest
171 testgencpp
172 ${Boost_LIBRARIES}
173)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200174target_link_libraries(TFileTransportTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100175add_test(NAME TFileTransportTest COMMAND TFileTransportTest)
Jim King9de9b1f2015-04-30 16:03:34 -0400176endif()
Pascal Bachd5f87e12014-12-12 15:59:17 +0100177
178add_executable(TFDTransportTest TFDTransportTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200179target_link_libraries(TFDTransportTest
180 ${Boost_LIBRARIES}
181)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200182target_link_libraries(TFDTransportTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100183add_test(NAME TFDTransportTest COMMAND TFDTransportTest)
184
185add_executable(TPipedTransportTest TPipedTransportTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200186target_link_libraries(TPipedTransportTest
187 ${Boost_LIBRARIES}
188)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200189target_link_libraries(TPipedTransportTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100190add_test(NAME TPipedTransportTest COMMAND TPipedTransportTest)
191
192set(AllProtocolsTest_SOURCES
193 AllProtocolTests.cpp
194 AllProtocolTests.tcc
Mario Emmenlauerf97176b2022-01-21 22:55:28 +0100195 GenericHelpers.h
196)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100197
198add_executable(AllProtocolsTest ${AllProtocolsTest_SOURCES})
Claudius Heine5ef662b2015-06-24 10:03:50 +0200199target_link_libraries(AllProtocolsTest
200 testgencpp
201 ${Boost_LIBRARIES}
202)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200203target_link_libraries(AllProtocolsTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100204add_test(NAME AllProtocolsTest COMMAND AllProtocolsTest)
205
Jim King9de9b1f2015-04-30 16:03:34 -0400206# The debug run-time in Windows asserts on isprint() with negative inputs
207if (NOT MSVC OR (MSVC AND CMAKE_BUILD_TYPE EQUAL "DEBUG"))
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100208 add_executable(DebugProtoTest DebugProtoTest.cpp)
209 target_link_libraries(DebugProtoTest
210 testgencpp
211 ${Boost_LIBRARIES}
212 )
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200213 target_link_libraries(DebugProtoTest thrift)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100214 add_test(NAME DebugProtoTest COMMAND DebugProtoTest)
Jim King9de9b1f2015-04-30 16:03:34 -0400215endif()
Pascal Bachd5f87e12014-12-12 15:59:17 +0100216
217add_executable(JSONProtoTest JSONProtoTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200218target_link_libraries(JSONProtoTest
219 testgencpp
220 ${Boost_LIBRARIES}
221)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200222target_link_libraries(JSONProtoTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100223add_test(NAME JSONProtoTest COMMAND JSONProtoTest)
224
225add_executable(OptionalRequiredTest OptionalRequiredTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200226target_link_libraries(OptionalRequiredTest
227 testgencpp
228 ${Boost_LIBRARIES}
229)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200230target_link_libraries(OptionalRequiredTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100231add_test(NAME OptionalRequiredTest COMMAND OptionalRequiredTest)
232
233add_executable(RecursiveTest RecursiveTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200234target_link_libraries(RecursiveTest
235 testgencpp
236 ${Boost_LIBRARIES}
237)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200238target_link_libraries(RecursiveTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100239add_test(NAME RecursiveTest COMMAND RecursiveTest)
240
241add_executable(SpecializationTest SpecializationTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200242target_link_libraries(SpecializationTest
243 testgencpp
244 ${Boost_LIBRARIES}
245)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200246target_link_libraries(SpecializationTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100247add_test(NAME SpecializationTest COMMAND SpecializationTest)
248
249set(concurrency_test_SOURCES
250 concurrency/Tests.cpp
251 concurrency/ThreadFactoryTests.h
252 concurrency/ThreadManagerTests.h
253 concurrency/TimerManagerTests.h
254)
255add_executable(concurrency_test ${concurrency_test_SOURCES})
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200256target_link_libraries(concurrency_test thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100257add_test(NAME concurrency_test COMMAND concurrency_test)
258
259set(link_test_SOURCES
260 link/LinkTest.cpp
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900261 gen-cpp/ParentService.h
Pascal Bachd5f87e12014-12-12 15:59:17 +0100262 link/TemplatedService1.cpp
263 link/TemplatedService2.cpp
Pascal Bachd5f87e12014-12-12 15:59:17 +0100264)
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900265
Pascal Bachd5f87e12014-12-12 15:59:17 +0100266add_executable(link_test ${link_test_SOURCES})
Jim King9de9b1f2015-04-30 16:03:34 -0400267target_link_libraries(link_test testgencpp_cob)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200268target_link_libraries(link_test thrift)
Nobuaki Sukegawae8c71d82015-11-23 19:51:37 +0900269target_link_libraries(link_test testgencpp)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100270add_test(NAME link_test COMMAND link_test)
271
272if(WITH_LIBEVENT)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100273 set(processor_test_SOURCES
274 processor/ProcessorTest.cpp
275 processor/EventLog.cpp
276 processor/ServerThread.cpp
277 processor/EventLog.h
278 processor/Handlers.h
279 processor/ServerThread.h
280 )
281 add_executable(processor_test ${processor_test_SOURCES})
282 target_link_libraries(processor_test
283 testgencpp_cob
284 ${Boost_LIBRARIES}
285 )
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200286 target_link_libraries(processor_test thriftnb)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100287 add_test(NAME processor_test COMMAND processor_test)
Nobuaki Sukegawa8016af82015-01-02 23:14:22 +0900288
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100289 set(TNonblockingServerTest_SOURCES TNonblockingServerTest.cpp)
290 add_executable(TNonblockingServerTest ${TNonblockingServerTest_SOURCES})
291 include_directories(${LIBEVENT_INCLUDE_DIRS})
292 target_link_libraries(TNonblockingServerTest
293 testgencpp_cob
294 ${Boost_LIBRARIES}
295 )
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200296 target_link_libraries(TNonblockingServerTest thriftnb)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100297 add_test(NAME TNonblockingServerTest COMMAND TNonblockingServerTest)
James E. King, III82ae9572017-08-05 12:23:54 -0400298
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100299 if(OPENSSL_FOUND AND WITH_OPENSSL)
300 set(TNonblockingSSLServerTest_SOURCES TNonblockingSSLServerTest.cpp)
301 add_executable(TNonblockingSSLServerTest ${TNonblockingSSLServerTest_SOURCES})
302 include_directories(${LIBEVENT_INCLUDE_DIRS})
303 target_link_libraries(TNonblockingSSLServerTest
304 testgencpp_cob
305 ${Boost_LIBRARIES}
306 )
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200307 target_link_libraries(TNonblockingSSLServerTest thriftnb)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100308 add_test(NAME TNonblockingSSLServerTest COMMAND TNonblockingSSLServerTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
309 endif(OPENSSL_FOUND AND WITH_OPENSSL)
310endif()
Pascal Bachd5f87e12014-12-12 15:59:17 +0100311
312if(OPENSSL_FOUND AND WITH_OPENSSL)
313add_executable(OpenSSLManualInitTest OpenSSLManualInitTest.cpp)
314target_link_libraries(OpenSSLManualInitTest
Pascal Bachd5f87e12014-12-12 15:59:17 +0100315 ${OPENSSL_LIBRARIES}
316 ${Boost_LIBRARIES}
317)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200318target_link_libraries(OpenSSLManualInitTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100319add_test(NAME OpenSSLManualInitTest COMMAND OpenSSLManualInitTest)
Sergei Nikulov34e0bb62015-09-02 13:06:22 +0300320
321add_executable(SecurityTest SecurityTest.cpp)
322target_link_libraries(SecurityTest
323 testgencpp
324 ${Boost_LIBRARIES}
325)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200326target_link_libraries(SecurityTest thrift)
Antonio Di Monaco796667b2016-01-04 23:05:19 +0100327if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100328 target_link_libraries(SecurityTest -lrt)
Sergei Nikulov34e0bb62015-09-02 13:06:22 +0300329endif ()
James E. King, III07f59972017-03-10 06:18:33 -0500330add_test(NAME SecurityTest COMMAND SecurityTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
Sergei Nikulov34e0bb62015-09-02 13:06:22 +0300331
Mario Emmenlauer0f14e2f2019-10-15 11:25:10 +0200332add_executable(SecurityFromBufferTest SecurityFromBufferTest.cpp)
333target_link_libraries(SecurityFromBufferTest
334 testgencpp
335 ${Boost_LIBRARIES}
336)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200337target_link_libraries(SecurityFromBufferTest thrift)
Mario Emmenlauer0f14e2f2019-10-15 11:25:10 +0200338if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100339 target_link_libraries(SecurityFromBufferTest -lrt)
Mario Emmenlauer0f14e2f2019-10-15 11:25:10 +0200340endif ()
341add_test(NAME SecurityFromBufferTest COMMAND SecurityFromBufferTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
342
Pascal Bachd5f87e12014-12-12 15:59:17 +0100343endif()
344
Nobuaki Sukegawa66228772014-12-07 21:45:33 +0900345if(WITH_QT5)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100346 add_subdirectory(qt)
Nobuaki Sukegawa66228772014-12-07 21:45:33 +0900347endif()
348
Pascal Bachd5f87e12014-12-12 15:59:17 +0100349#
350# Common thrift code generation rules
351#
352
James E. King, IIIb4c190b2017-02-13 16:39:59 -0500353add_custom_command(OUTPUT gen-cpp/AnnotationTest_constants.cpp
354 gen-cpp/AnnotationTest_constants.h
355 gen-cpp/AnnotationTest_types.cpp
356 gen-cpp/AnnotationTest_types.h
357 gen-cpp/foo_service.cpp
358 gen-cpp/foo_service.h
359 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/AnnotationTest.thrift
360)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100361
James E. King, IIIb4c190b2017-02-13 16:39:59 -0500362add_custom_command(OUTPUT gen-cpp/DebugProtoTest_types.cpp gen-cpp/DebugProtoTest_types.h gen-cpp/EmptyService.cpp gen-cpp/EmptyService.h
CJCombrink1d886ca2024-03-23 21:32:28 +0100363 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/DebugProtoTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100364)
365
366add_custom_command(OUTPUT gen-cpp/EnumTest_types.cpp gen-cpp/EnumTest_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900367 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/EnumTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100368)
369
370add_custom_command(OUTPUT gen-cpp/TypedefTest_types.cpp gen-cpp/TypedefTest_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900371 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/TypedefTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100372)
373
374add_custom_command(OUTPUT gen-cpp/OptionalRequiredTest_types.cpp gen-cpp/OptionalRequiredTest_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900375 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/OptionalRequiredTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100376)
377
378add_custom_command(OUTPUT gen-cpp/Recursive_types.cpp gen-cpp/Recursive_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900379 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/Recursive.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100380)
381
382add_custom_command(OUTPUT gen-cpp/Service.cpp gen-cpp/StressTest_types.cpp
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900383 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/StressTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100384)
385
386add_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
CJCombrink1d886ca2024-03-23 21:32:28 +0100387 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100388)
389
zeshuai00757c25072020-04-09 11:17:05 +0800390add_custom_command(OUTPUT gen-cpp/OneWayService.cpp gen-cpp/OneWayTest_types.h gen-cpp/OneWayService.h
Chet Murthyad08a8b2017-12-19 15:55:56 -0800391 COMMAND ${THRIFT_COMPILER} --gen cpp ${CMAKE_CURRENT_SOURCE_DIR}/OneWayTest.thrift
392)
393
Pascal Bachd5f87e12014-12-12 15:59:17 +0100394add_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 +0900395 COMMAND ${THRIFT_COMPILER} --gen cpp:templates,cob_style ${CMAKE_CURRENT_SOURCE_DIR}/processor/proc.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100396)