blob: 033b4d24f7e0c577ed04bbc9dc3cc55d56b75b17 [file] [log] [blame]
Pascal Bachd5f87e12014-12-12 15:59:17 +01001#
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
Pascal Bachd5f87e12014-12-12 15:59:17 +010020# Find required packages
21set(Boost_USE_STATIC_LIBS ON) # Force the use of static boost test framework
Jim Kingb0b710a2015-07-28 13:31:27 -040022find_package(Boost 1.53.0 REQUIRED COMPONENTS chrono filesystem system thread unit_test_framework)
Nobuaki Sukegawac444fb52015-01-02 23:16:55 +090023include_directories(SYSTEM "${Boost_INCLUDE_DIRS}")
Dave Watson792db4e2015-01-16 11:22:01 -080024include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}")
Pascal Bachd5f87e12014-12-12 15:59:17 +010025
26#Make sure gen-cpp files can be included
27include_directories("${CMAKE_CURRENT_BINARY_DIR}")
28
29# Create the thrift C++ test library
30set(testgencpp_SOURCES
31 gen-cpp/DebugProtoTest_types.cpp
32 gen-cpp/DebugProtoTest_types.h
33 gen-cpp/EnumTest_types.cpp
34 gen-cpp/EnumTest_types.h
35 gen-cpp/OptionalRequiredTest_types.cpp
36 gen-cpp/OptionalRequiredTest_types.h
37 gen-cpp/Recursive_types.cpp
38 gen-cpp/Recursive_types.h
39 gen-cpp/ThriftTest_types.cpp
40 gen-cpp/ThriftTest_types.h
41 gen-cpp/TypedefTest_types.cpp
42 gen-cpp/TypedefTest_types.h
43 ThriftTest_extras.cpp
44 DebugProtoTest_extras.cpp
45)
46
47add_library(testgencpp STATIC ${testgencpp_SOURCES})
Pascal Bachd5f87e12014-12-12 15:59:17 +010048
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +090049set(testgencpp_cob_SOURCES
Pascal Bachd5f87e12014-12-12 15:59:17 +010050 gen-cpp/ChildService.cpp
51 gen-cpp/ChildService.h
Ben Craig1684c422015-04-24 08:52:44 -050052 gen-cpp/EmptyService.cpp
53 gen-cpp/EmptyService.h
Pascal Bachd5f87e12014-12-12 15:59:17 +010054 gen-cpp/ParentService.cpp
55 gen-cpp/ParentService.h
56 gen-cpp/proc_types.cpp
57 gen-cpp/proc_types.h
58)
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +090059add_library(testgencpp_cob STATIC ${testgencpp_cob_SOURCES})
Pascal Bachd5f87e12014-12-12 15:59:17 +010060
61
62add_executable(Benchmark Benchmark.cpp)
63target_link_libraries(Benchmark testgencpp)
Jim King9de9b1f2015-04-30 16:03:34 -040064LINK_AGAINST_THRIFT_LIBRARY(Benchmark thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +010065add_test(NAME Benchmark COMMAND Benchmark)
Dave Watson792db4e2015-01-16 11:22:01 -080066target_link_libraries(Benchmark testgencpp ${ZLIB_LIBRARIES})
Pascal Bachd5f87e12014-12-12 15:59:17 +010067
68set(UnitTest_SOURCES
69 UnitTestMain.cpp
70 TMemoryBufferTest.cpp
71 TBufferBaseTest.cpp
72 Base64Test.cpp
73 ToStringTest.cpp
74 TypedefTest.cpp
Roger Meier3815e0b2015-04-04 16:26:30 +020075 TServerSocketTest.cpp
Ben Craig1684c422015-04-24 08:52:44 -050076 TServerTransportTest.cpp
Pascal Bachd5f87e12014-12-12 15:59:17 +010077)
78
Roger Meiera6b66332015-05-15 15:21:50 +020079if(NOT WITH_BOOSTTHREADS AND NOT WITH_STDTHREADS AND NOT MSVC)
Pascal Bachd5f87e12014-12-12 15:59:17 +010080 list(APPEND UnitTest_SOURCES RWMutexStarveTest.cpp)
81endif()
82
83add_executable(UnitTests ${UnitTest_SOURCES})
Dave Watson792db4e2015-01-16 11:22:01 -080084target_link_libraries(UnitTests testgencpp ${Boost_LIBRARIES}
85 ${ZLIB_LIBRARIES})
Jim King9de9b1f2015-04-30 16:03:34 -040086LINK_AGAINST_THRIFT_LIBRARY(UnitTests thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +010087add_test(NAME UnitTests COMMAND UnitTests)
ben-craigfae08e72015-07-15 11:34:47 -050088if ( MSVC )
89 # Disable C4503: decorated name length exceeded, name was truncated
90 # 'insanity' results in very long decorated names
91 set_property( TARGET UnitTests APPEND_STRING PROPERTY COMPILE_FLAGS /wd4503 )
92endif ( MSVC )
Pascal Bachd5f87e12014-12-12 15:59:17 +010093
ben-craigaf2d9c82015-07-16 08:11:21 -050094
95set( TInterruptTest_SOURCES TSocketInterruptTest.cpp )
96if (WIN32)
97 list(APPEND TInterruptTest_SOURCES
98 TPipeInterruptTest.cpp
99 )
100endif()
101add_executable(TInterruptTest ${TInterruptTest_SOURCES})
102target_link_libraries(TInterruptTest
Ben Craig1684c422015-04-24 08:52:44 -0500103 testgencpp
104 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800105 ${ZLIB_LIBRARIES}
Ben Craig1684c422015-04-24 08:52:44 -0500106)
ben-craigaf2d9c82015-07-16 08:11:21 -0500107LINK_AGAINST_THRIFT_LIBRARY(TInterruptTest thrift)
Thomas Bartelmess9e78ed82015-05-01 13:57:44 -0400108if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
ben-craigaf2d9c82015-07-16 08:11:21 -0500109target_link_libraries(TInterruptTest -lrt)
Ben Craig1684c422015-04-24 08:52:44 -0500110endif ()
ben-craigaf2d9c82015-07-16 08:11:21 -0500111add_test(NAME TInterruptTest COMMAND TInterruptTest)
Ben Craig1684c422015-04-24 08:52:44 -0500112
113add_executable(TServerIntegrationTest TServerIntegrationTest.cpp)
114target_link_libraries(TServerIntegrationTest
115 testgencpp_cob
116 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800117 ${ZLIB_LIBRARIES}
Ben Craig1684c422015-04-24 08:52:44 -0500118)
Jim King9de9b1f2015-04-30 16:03:34 -0400119LINK_AGAINST_THRIFT_LIBRARY(TServerIntegrationTest thrift)
Thomas Bartelmess9e78ed82015-05-01 13:57:44 -0400120if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
Ben Craig1684c422015-04-24 08:52:44 -0500121target_link_libraries(TServerIntegrationTest -lrt)
122endif ()
123add_test(NAME TServerIntegrationTest COMMAND TServerIntegrationTest)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100124
125if(WITH_ZLIB)
126add_executable(TransportTest TransportTest.cpp)
127target_link_libraries(TransportTest
128 testgencpp
Pascal Bachd5f87e12014-12-12 15:59:17 +0100129 ${Boost_LIBRARIES}
130 ${ZLIB_LIBRARIES}
131)
Jim King9de9b1f2015-04-30 16:03:34 -0400132LINK_AGAINST_THRIFT_LIBRARY(TransportTest thrift)
133LINK_AGAINST_THRIFT_LIBRARY(TransportTest thriftz)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100134add_test(NAME TransportTest COMMAND TransportTest)
135
136add_executable(ZlibTest ZlibTest.cpp)
137target_link_libraries(ZlibTest
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(ZlibTest thrift)
143LINK_AGAINST_THRIFT_LIBRARY(ZlibTest thriftz)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100144add_test(NAME ZlibTest COMMAND ZlibTest)
145endif(WITH_ZLIB)
146
147
148add_executable(EnumTest EnumTest.cpp)
149target_link_libraries(EnumTest
150 testgencpp
151 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800152 ${ZLIB_LIBRARIES}
Pascal Bachd5f87e12014-12-12 15:59:17 +0100153)
Jim King9de9b1f2015-04-30 16:03:34 -0400154LINK_AGAINST_THRIFT_LIBRARY(EnumTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100155add_test(NAME EnumTest COMMAND EnumTest)
156
Jim King9de9b1f2015-04-30 16:03:34 -0400157if(HAVE_GETOPT_H)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100158add_executable(TFileTransportTest TFileTransportTest.cpp)
159target_link_libraries(TFileTransportTest
160 testgencpp
161 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800162 ${ZLIB_LIBRARIES}
Pascal Bachd5f87e12014-12-12 15:59:17 +0100163)
Jim King9de9b1f2015-04-30 16:03:34 -0400164LINK_AGAINST_THRIFT_LIBRARY(TFileTransportTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100165add_test(NAME TFileTransportTest COMMAND TFileTransportTest)
Jim King9de9b1f2015-04-30 16:03:34 -0400166endif()
Pascal Bachd5f87e12014-12-12 15:59:17 +0100167
168add_executable(TFDTransportTest TFDTransportTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200169target_link_libraries(TFDTransportTest
170 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800171 ${ZLIB_LIBRARIES}
Claudius Heine5ef662b2015-06-24 10:03:50 +0200172)
Jim King9de9b1f2015-04-30 16:03:34 -0400173LINK_AGAINST_THRIFT_LIBRARY(TFDTransportTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100174add_test(NAME TFDTransportTest COMMAND TFDTransportTest)
175
176add_executable(TPipedTransportTest TPipedTransportTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200177target_link_libraries(TPipedTransportTest
178 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800179 ${ZLIB_LIBRARIES}
Claudius Heine5ef662b2015-06-24 10:03:50 +0200180)
Jim King9de9b1f2015-04-30 16:03:34 -0400181LINK_AGAINST_THRIFT_LIBRARY(TPipedTransportTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100182add_test(NAME TPipedTransportTest COMMAND TPipedTransportTest)
183
184set(AllProtocolsTest_SOURCES
185 AllProtocolTests.cpp
186 AllProtocolTests.tcc
187 GenericHelpers
188 )
189
190add_executable(AllProtocolsTest ${AllProtocolsTest_SOURCES})
Claudius Heine5ef662b2015-06-24 10:03:50 +0200191target_link_libraries(AllProtocolsTest
192 testgencpp
193 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800194 ${ZLIB_LIBRARIES}
Claudius Heine5ef662b2015-06-24 10:03:50 +0200195)
Jim King9de9b1f2015-04-30 16:03:34 -0400196LINK_AGAINST_THRIFT_LIBRARY(AllProtocolsTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100197add_test(NAME AllProtocolsTest COMMAND AllProtocolsTest)
198
Jim King9de9b1f2015-04-30 16:03:34 -0400199# The debug run-time in Windows asserts on isprint() with negative inputs
200if (NOT MSVC OR (MSVC AND CMAKE_BUILD_TYPE EQUAL "DEBUG"))
Pascal Bachd5f87e12014-12-12 15:59:17 +0100201add_executable(DebugProtoTest DebugProtoTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200202target_link_libraries(DebugProtoTest
203 testgencpp
204 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800205 ${ZLIB_LIBRARIES}
Claudius Heine5ef662b2015-06-24 10:03:50 +0200206)
Jim King9de9b1f2015-04-30 16:03:34 -0400207LINK_AGAINST_THRIFT_LIBRARY(DebugProtoTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100208add_test(NAME DebugProtoTest COMMAND DebugProtoTest)
Jim King9de9b1f2015-04-30 16:03:34 -0400209endif()
Pascal Bachd5f87e12014-12-12 15:59:17 +0100210
211add_executable(JSONProtoTest JSONProtoTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200212target_link_libraries(JSONProtoTest
213 testgencpp
214 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800215 ${ZLIB_LIBRARIES}
Claudius Heine5ef662b2015-06-24 10:03:50 +0200216)
Jim King9de9b1f2015-04-30 16:03:34 -0400217LINK_AGAINST_THRIFT_LIBRARY(JSONProtoTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100218add_test(NAME JSONProtoTest COMMAND JSONProtoTest)
219
220add_executable(OptionalRequiredTest OptionalRequiredTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200221target_link_libraries(OptionalRequiredTest
222 testgencpp
223 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800224 ${ZLIB_LIBRARIES}
Claudius Heine5ef662b2015-06-24 10:03:50 +0200225)
Jim King9de9b1f2015-04-30 16:03:34 -0400226LINK_AGAINST_THRIFT_LIBRARY(OptionalRequiredTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100227add_test(NAME OptionalRequiredTest COMMAND OptionalRequiredTest)
228
229add_executable(RecursiveTest RecursiveTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200230target_link_libraries(RecursiveTest
231 testgencpp
232 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800233 ${ZLIB_LIBRARIES}
Claudius Heine5ef662b2015-06-24 10:03:50 +0200234)
Jim King9de9b1f2015-04-30 16:03:34 -0400235LINK_AGAINST_THRIFT_LIBRARY(RecursiveTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100236add_test(NAME RecursiveTest COMMAND RecursiveTest)
237
238add_executable(SpecializationTest SpecializationTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200239target_link_libraries(SpecializationTest
240 testgencpp
241 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800242 ${ZLIB_LIBRARIES}
Claudius Heine5ef662b2015-06-24 10:03:50 +0200243)
Jim King9de9b1f2015-04-30 16:03:34 -0400244LINK_AGAINST_THRIFT_LIBRARY(SpecializationTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100245add_test(NAME SpecializationTest COMMAND SpecializationTest)
246
247set(concurrency_test_SOURCES
248 concurrency/Tests.cpp
249 concurrency/ThreadFactoryTests.h
250 concurrency/ThreadManagerTests.h
251 concurrency/TimerManagerTests.h
252)
253add_executable(concurrency_test ${concurrency_test_SOURCES})
Jim King9de9b1f2015-04-30 16:03:34 -0400254LINK_AGAINST_THRIFT_LIBRARY(concurrency_test thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100255add_test(NAME concurrency_test COMMAND concurrency_test)
Dave Watson792db4e2015-01-16 11:22:01 -0800256target_link_libraries(concurrency_test ${ZLIB_LIBRARIES})
Pascal Bachd5f87e12014-12-12 15:59:17 +0100257
258set(link_test_SOURCES
259 link/LinkTest.cpp
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900260 gen-cpp/ParentService.h
Pascal Bachd5f87e12014-12-12 15:59:17 +0100261 link/TemplatedService1.cpp
262 link/TemplatedService2.cpp
Pascal Bachd5f87e12014-12-12 15:59:17 +0100263)
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900264
Pascal Bachd5f87e12014-12-12 15:59:17 +0100265add_executable(link_test ${link_test_SOURCES})
Jim King9de9b1f2015-04-30 16:03:34 -0400266target_link_libraries(link_test testgencpp_cob)
267LINK_AGAINST_THRIFT_LIBRARY(link_test thrift)
Dave Watson792db4e2015-01-16 11:22:01 -0800268target_link_libraries(link_test testgencpp ${ZLIB_LIBRARIES})
Pascal Bachd5f87e12014-12-12 15:59:17 +0100269add_test(NAME link_test COMMAND link_test)
270
271if(WITH_LIBEVENT)
272set(processor_test_SOURCES
273 processor/ProcessorTest.cpp
274 processor/EventLog.cpp
275 processor/ServerThread.cpp
276 processor/EventLog.h
277 processor/Handlers.h
278 processor/ServerThread.h
279)
280add_executable(processor_test ${processor_test_SOURCES})
281target_link_libraries(processor_test
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900282 testgencpp_cob
Pascal Bachd5f87e12014-12-12 15:59:17 +0100283 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800284 ${ZLIB_LIBRARIES}
Pascal Bachd5f87e12014-12-12 15:59:17 +0100285)
Jim King9de9b1f2015-04-30 16:03:34 -0400286LINK_AGAINST_THRIFT_LIBRARY(processor_test thrift)
287LINK_AGAINST_THRIFT_LIBRARY(processor_test thriftnb)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100288add_test(NAME processor_test COMMAND processor_test)
Nobuaki Sukegawa8016af82015-01-02 23:14:22 +0900289
290set(TNonblockingServerTest_SOURCES TNonblockingServerTest.cpp)
291add_executable(TNonblockingServerTest ${TNonblockingServerTest_SOURCES})
292include_directories(${LIBEVENT_INCLUDE_DIRS})
293target_link_libraries(TNonblockingServerTest
294 testgencpp_cob
Nobuaki Sukegawa8016af82015-01-02 23:14:22 +0900295 ${LIBEVENT_LIBRARIES}
296 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800297 ${ZLIB_LIBRARIES}
Nobuaki Sukegawa8016af82015-01-02 23:14:22 +0900298)
Jim King9de9b1f2015-04-30 16:03:34 -0400299LINK_AGAINST_THRIFT_LIBRARY(TNonblockingServerTest thrift)
300LINK_AGAINST_THRIFT_LIBRARY(TNonblockingServerTest thriftnb)
Nobuaki Sukegawa8016af82015-01-02 23:14:22 +0900301add_test(NAME TNonblockingServerTest COMMAND TNonblockingServerTest)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100302endif()
303
304if(OPENSSL_FOUND AND WITH_OPENSSL)
305add_executable(OpenSSLManualInitTest OpenSSLManualInitTest.cpp)
306target_link_libraries(OpenSSLManualInitTest
Pascal Bachd5f87e12014-12-12 15:59:17 +0100307 ${OPENSSL_LIBRARIES}
308 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800309 ${ZLIB_LIBRARIES}
Pascal Bachd5f87e12014-12-12 15:59:17 +0100310)
Jim King9de9b1f2015-04-30 16:03:34 -0400311LINK_AGAINST_THRIFT_LIBRARY(OpenSSLManualInitTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100312add_test(NAME OpenSSLManualInitTest COMMAND OpenSSLManualInitTest)
Sergei Nikulov34e0bb62015-09-02 13:06:22 +0300313
314add_executable(SecurityTest SecurityTest.cpp)
315target_link_libraries(SecurityTest
316 testgencpp
317 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800318 ${ZLIB_LIBRARIES}
Sergei Nikulov34e0bb62015-09-02 13:06:22 +0300319)
320LINK_AGAINST_THRIFT_LIBRARY(SecurityTest thrift)
321if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
322target_link_libraries(SecurityTest -lrt)
323endif ()
324add_test(NAME SecurityTest COMMAND SecurityTest "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
325
Pascal Bachd5f87e12014-12-12 15:59:17 +0100326endif()
327
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900328if(WITH_QT4)
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900329set(CMAKE_AUTOMOC ON)
330find_package(Qt4 REQUIRED COMPONENTS QtTest)
331set(TQTcpServerTest_SOURCES
332 qt/TQTcpServerTest.cpp
333)
334add_executable(TQTcpServerTest ${TQTcpServerTest_SOURCES})
Jim King9de9b1f2015-04-30 16:03:34 -0400335target_link_libraries(TQTcpServerTest testgencpp_cob thriftqt Qt4::QtTest)
336LINK_AGAINST_THRIFT_LIBRARY(TQTcpServerTest thrift)
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900337add_test(NAME TQTcpServerTest COMMAND TQTcpServerTest)
338endif()
339
Nobuaki Sukegawa66228772014-12-07 21:45:33 +0900340if(WITH_QT5)
341add_subdirectory(qt)
342endif()
343
Pascal Bachd5f87e12014-12-12 15:59:17 +0100344#
345# Common thrift code generation rules
346#
347
348
Ben Craig1684c422015-04-24 08:52:44 -0500349add_custom_command(OUTPUT gen-cpp/DebugProtoTest_types.cpp gen-cpp/DebugProtoTest_types.h gen-cpp/EmptyService.cpp gen-cpp/EmptyService.h
Randy Abernethy8dbe5f62015-08-01 22:57:02 -0700350 COMMAND thrift-compiler --gen cpp ${PROJECT_SOURCE_DIR}/test/DebugProtoTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100351)
352
353add_custom_command(OUTPUT gen-cpp/EnumTest_types.cpp gen-cpp/EnumTest_types.h
354 COMMAND thrift-compiler --gen cpp ${PROJECT_SOURCE_DIR}/test/EnumTest.thrift
355)
356
357add_custom_command(OUTPUT gen-cpp/TypedefTest_types.cpp gen-cpp/TypedefTest_types.h
358 COMMAND thrift-compiler --gen cpp ${PROJECT_SOURCE_DIR}/test/TypedefTest.thrift
359)
360
361add_custom_command(OUTPUT gen-cpp/OptionalRequiredTest_types.cpp gen-cpp/OptionalRequiredTest_types.h
Randy Abernethy8dbe5f62015-08-01 22:57:02 -0700362 COMMAND thrift-compiler --gen cpp ${PROJECT_SOURCE_DIR}/test/OptionalRequiredTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100363)
364
365add_custom_command(OUTPUT gen-cpp/Recursive_types.cpp gen-cpp/Recursive_types.h
366 COMMAND thrift-compiler --gen cpp ${PROJECT_SOURCE_DIR}/test/Recursive.thrift
367)
368
369add_custom_command(OUTPUT gen-cpp/Service.cpp gen-cpp/StressTest_types.cpp
Randy Abernethy8dbe5f62015-08-01 22:57:02 -0700370 COMMAND thrift-compiler --gen cpp ${PROJECT_SOURCE_DIR}/test/StressTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100371)
372
373add_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
Randy Abernethy8dbe5f62015-08-01 22:57:02 -0700374 COMMAND thrift-compiler --gen cpp ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100375)
376
377add_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
378 COMMAND thrift-compiler --gen cpp:templates,cob_style ${CMAKE_CURRENT_SOURCE_DIR}/processor/proc.thrift
379)