blob: 491d343c38270dd3c55862f9ac6737969b73d5b9 [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
Martin Haimberger0ad6ee92015-11-13 03:18:50 -080095set( TInterruptTest_SOURCES
96 TSocketInterruptTest.cpp
97 TSSLSocketInterruptTest.cpp
98)
ben-craigaf2d9c82015-07-16 08:11:21 -050099if (WIN32)
100 list(APPEND TInterruptTest_SOURCES
101 TPipeInterruptTest.cpp
102 )
103endif()
104add_executable(TInterruptTest ${TInterruptTest_SOURCES})
105target_link_libraries(TInterruptTest
Ben Craig1684c422015-04-24 08:52:44 -0500106 testgencpp
107 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800108 ${ZLIB_LIBRARIES}
Ben Craig1684c422015-04-24 08:52:44 -0500109)
ben-craigaf2d9c82015-07-16 08:11:21 -0500110LINK_AGAINST_THRIFT_LIBRARY(TInterruptTest thrift)
Thomas Bartelmess9e78ed82015-05-01 13:57:44 -0400111if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
ben-craigaf2d9c82015-07-16 08:11:21 -0500112target_link_libraries(TInterruptTest -lrt)
Ben Craig1684c422015-04-24 08:52:44 -0500113endif ()
Martin Haimberger0ad6ee92015-11-13 03:18:50 -0800114add_test(NAME TInterruptTest COMMAND TInterruptTest "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
Ben Craig1684c422015-04-24 08:52:44 -0500115
116add_executable(TServerIntegrationTest TServerIntegrationTest.cpp)
117target_link_libraries(TServerIntegrationTest
118 testgencpp_cob
119 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800120 ${ZLIB_LIBRARIES}
Ben Craig1684c422015-04-24 08:52:44 -0500121)
Jim King9de9b1f2015-04-30 16:03:34 -0400122LINK_AGAINST_THRIFT_LIBRARY(TServerIntegrationTest thrift)
Thomas Bartelmess9e78ed82015-05-01 13:57:44 -0400123if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
Ben Craig1684c422015-04-24 08:52:44 -0500124target_link_libraries(TServerIntegrationTest -lrt)
125endif ()
126add_test(NAME TServerIntegrationTest COMMAND TServerIntegrationTest)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100127
128if(WITH_ZLIB)
129add_executable(TransportTest TransportTest.cpp)
130target_link_libraries(TransportTest
131 testgencpp
Pascal Bachd5f87e12014-12-12 15:59:17 +0100132 ${Boost_LIBRARIES}
133 ${ZLIB_LIBRARIES}
134)
Jim King9de9b1f2015-04-30 16:03:34 -0400135LINK_AGAINST_THRIFT_LIBRARY(TransportTest thrift)
136LINK_AGAINST_THRIFT_LIBRARY(TransportTest thriftz)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100137add_test(NAME TransportTest COMMAND TransportTest)
138
139add_executable(ZlibTest ZlibTest.cpp)
140target_link_libraries(ZlibTest
141 testgencpp
Pascal Bachd5f87e12014-12-12 15:59:17 +0100142 ${Boost_LIBRARIES}
143 ${ZLIB_LIBRARIES}
144)
Jim King9de9b1f2015-04-30 16:03:34 -0400145LINK_AGAINST_THRIFT_LIBRARY(ZlibTest thrift)
146LINK_AGAINST_THRIFT_LIBRARY(ZlibTest thriftz)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100147add_test(NAME ZlibTest COMMAND ZlibTest)
148endif(WITH_ZLIB)
149
150
151add_executable(EnumTest EnumTest.cpp)
152target_link_libraries(EnumTest
153 testgencpp
154 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800155 ${ZLIB_LIBRARIES}
Pascal Bachd5f87e12014-12-12 15:59:17 +0100156)
Jim King9de9b1f2015-04-30 16:03:34 -0400157LINK_AGAINST_THRIFT_LIBRARY(EnumTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100158add_test(NAME EnumTest COMMAND EnumTest)
159
Jim King9de9b1f2015-04-30 16:03:34 -0400160if(HAVE_GETOPT_H)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100161add_executable(TFileTransportTest TFileTransportTest.cpp)
162target_link_libraries(TFileTransportTest
163 testgencpp
164 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800165 ${ZLIB_LIBRARIES}
Pascal Bachd5f87e12014-12-12 15:59:17 +0100166)
Jim King9de9b1f2015-04-30 16:03:34 -0400167LINK_AGAINST_THRIFT_LIBRARY(TFileTransportTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100168add_test(NAME TFileTransportTest COMMAND TFileTransportTest)
Jim King9de9b1f2015-04-30 16:03:34 -0400169endif()
Pascal Bachd5f87e12014-12-12 15:59:17 +0100170
171add_executable(TFDTransportTest TFDTransportTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200172target_link_libraries(TFDTransportTest
173 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800174 ${ZLIB_LIBRARIES}
Claudius Heine5ef662b2015-06-24 10:03:50 +0200175)
Jim King9de9b1f2015-04-30 16:03:34 -0400176LINK_AGAINST_THRIFT_LIBRARY(TFDTransportTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100177add_test(NAME TFDTransportTest COMMAND TFDTransportTest)
178
179add_executable(TPipedTransportTest TPipedTransportTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200180target_link_libraries(TPipedTransportTest
181 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800182 ${ZLIB_LIBRARIES}
Claudius Heine5ef662b2015-06-24 10:03:50 +0200183)
Jim King9de9b1f2015-04-30 16:03:34 -0400184LINK_AGAINST_THRIFT_LIBRARY(TPipedTransportTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100185add_test(NAME TPipedTransportTest COMMAND TPipedTransportTest)
186
187set(AllProtocolsTest_SOURCES
188 AllProtocolTests.cpp
189 AllProtocolTests.tcc
190 GenericHelpers
191 )
192
193add_executable(AllProtocolsTest ${AllProtocolsTest_SOURCES})
Claudius Heine5ef662b2015-06-24 10:03:50 +0200194target_link_libraries(AllProtocolsTest
195 testgencpp
196 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800197 ${ZLIB_LIBRARIES}
Claudius Heine5ef662b2015-06-24 10:03:50 +0200198)
Jim King9de9b1f2015-04-30 16:03:34 -0400199LINK_AGAINST_THRIFT_LIBRARY(AllProtocolsTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100200add_test(NAME AllProtocolsTest COMMAND AllProtocolsTest)
201
Jim King9de9b1f2015-04-30 16:03:34 -0400202# The debug run-time in Windows asserts on isprint() with negative inputs
203if (NOT MSVC OR (MSVC AND CMAKE_BUILD_TYPE EQUAL "DEBUG"))
Pascal Bachd5f87e12014-12-12 15:59:17 +0100204add_executable(DebugProtoTest DebugProtoTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200205target_link_libraries(DebugProtoTest
206 testgencpp
207 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800208 ${ZLIB_LIBRARIES}
Claudius Heine5ef662b2015-06-24 10:03:50 +0200209)
Jim King9de9b1f2015-04-30 16:03:34 -0400210LINK_AGAINST_THRIFT_LIBRARY(DebugProtoTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100211add_test(NAME DebugProtoTest COMMAND DebugProtoTest)
Jim King9de9b1f2015-04-30 16:03:34 -0400212endif()
Pascal Bachd5f87e12014-12-12 15:59:17 +0100213
214add_executable(JSONProtoTest JSONProtoTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200215target_link_libraries(JSONProtoTest
216 testgencpp
217 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800218 ${ZLIB_LIBRARIES}
Claudius Heine5ef662b2015-06-24 10:03:50 +0200219)
Jim King9de9b1f2015-04-30 16:03:34 -0400220LINK_AGAINST_THRIFT_LIBRARY(JSONProtoTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100221add_test(NAME JSONProtoTest COMMAND JSONProtoTest)
222
223add_executable(OptionalRequiredTest OptionalRequiredTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200224target_link_libraries(OptionalRequiredTest
225 testgencpp
226 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800227 ${ZLIB_LIBRARIES}
Claudius Heine5ef662b2015-06-24 10:03:50 +0200228)
Jim King9de9b1f2015-04-30 16:03:34 -0400229LINK_AGAINST_THRIFT_LIBRARY(OptionalRequiredTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100230add_test(NAME OptionalRequiredTest COMMAND OptionalRequiredTest)
231
232add_executable(RecursiveTest RecursiveTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200233target_link_libraries(RecursiveTest
234 testgencpp
235 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800236 ${ZLIB_LIBRARIES}
Claudius Heine5ef662b2015-06-24 10:03:50 +0200237)
Jim King9de9b1f2015-04-30 16:03:34 -0400238LINK_AGAINST_THRIFT_LIBRARY(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}
Dave Watson792db4e2015-01-16 11:22:01 -0800245 ${ZLIB_LIBRARIES}
Claudius Heine5ef662b2015-06-24 10:03:50 +0200246)
Jim King9de9b1f2015-04-30 16:03:34 -0400247LINK_AGAINST_THRIFT_LIBRARY(SpecializationTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100248add_test(NAME SpecializationTest COMMAND SpecializationTest)
249
250set(concurrency_test_SOURCES
251 concurrency/Tests.cpp
252 concurrency/ThreadFactoryTests.h
253 concurrency/ThreadManagerTests.h
254 concurrency/TimerManagerTests.h
255)
256add_executable(concurrency_test ${concurrency_test_SOURCES})
Jim King9de9b1f2015-04-30 16:03:34 -0400257LINK_AGAINST_THRIFT_LIBRARY(concurrency_test thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100258add_test(NAME concurrency_test COMMAND concurrency_test)
Dave Watson792db4e2015-01-16 11:22:01 -0800259target_link_libraries(concurrency_test ${ZLIB_LIBRARIES})
Pascal Bachd5f87e12014-12-12 15:59:17 +0100260
261set(link_test_SOURCES
262 link/LinkTest.cpp
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900263 gen-cpp/ParentService.h
Pascal Bachd5f87e12014-12-12 15:59:17 +0100264 link/TemplatedService1.cpp
265 link/TemplatedService2.cpp
Pascal Bachd5f87e12014-12-12 15:59:17 +0100266)
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900267
Pascal Bachd5f87e12014-12-12 15:59:17 +0100268add_executable(link_test ${link_test_SOURCES})
Jim King9de9b1f2015-04-30 16:03:34 -0400269target_link_libraries(link_test testgencpp_cob)
270LINK_AGAINST_THRIFT_LIBRARY(link_test thrift)
Dave Watson792db4e2015-01-16 11:22:01 -0800271target_link_libraries(link_test testgencpp ${ZLIB_LIBRARIES})
Pascal Bachd5f87e12014-12-12 15:59:17 +0100272add_test(NAME link_test COMMAND link_test)
273
274if(WITH_LIBEVENT)
275set(processor_test_SOURCES
276 processor/ProcessorTest.cpp
277 processor/EventLog.cpp
278 processor/ServerThread.cpp
279 processor/EventLog.h
280 processor/Handlers.h
281 processor/ServerThread.h
282)
283add_executable(processor_test ${processor_test_SOURCES})
284target_link_libraries(processor_test
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900285 testgencpp_cob
Pascal Bachd5f87e12014-12-12 15:59:17 +0100286 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800287 ${ZLIB_LIBRARIES}
Pascal Bachd5f87e12014-12-12 15:59:17 +0100288)
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}
Dave Watson792db4e2015-01-16 11:22:01 -0800300 ${ZLIB_LIBRARIES}
Nobuaki Sukegawa8016af82015-01-02 23:14:22 +0900301)
Jim King9de9b1f2015-04-30 16:03:34 -0400302LINK_AGAINST_THRIFT_LIBRARY(TNonblockingServerTest thrift)
303LINK_AGAINST_THRIFT_LIBRARY(TNonblockingServerTest thriftnb)
Nobuaki Sukegawa8016af82015-01-02 23:14:22 +0900304add_test(NAME TNonblockingServerTest COMMAND TNonblockingServerTest)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100305endif()
306
307if(OPENSSL_FOUND AND WITH_OPENSSL)
308add_executable(OpenSSLManualInitTest OpenSSLManualInitTest.cpp)
309target_link_libraries(OpenSSLManualInitTest
Pascal Bachd5f87e12014-12-12 15:59:17 +0100310 ${OPENSSL_LIBRARIES}
311 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800312 ${ZLIB_LIBRARIES}
Pascal Bachd5f87e12014-12-12 15:59:17 +0100313)
Jim King9de9b1f2015-04-30 16:03:34 -0400314LINK_AGAINST_THRIFT_LIBRARY(OpenSSLManualInitTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100315add_test(NAME OpenSSLManualInitTest COMMAND OpenSSLManualInitTest)
Sergei Nikulov34e0bb62015-09-02 13:06:22 +0300316
317add_executable(SecurityTest SecurityTest.cpp)
318target_link_libraries(SecurityTest
319 testgencpp
320 ${Boost_LIBRARIES}
Dave Watson792db4e2015-01-16 11:22:01 -0800321 ${ZLIB_LIBRARIES}
Sergei Nikulov34e0bb62015-09-02 13:06:22 +0300322)
323LINK_AGAINST_THRIFT_LIBRARY(SecurityTest thrift)
324if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
325target_link_libraries(SecurityTest -lrt)
326endif ()
327add_test(NAME SecurityTest COMMAND SecurityTest "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
328
Pascal Bachd5f87e12014-12-12 15:59:17 +0100329endif()
330
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900331if(WITH_QT4)
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900332set(CMAKE_AUTOMOC ON)
333find_package(Qt4 REQUIRED COMPONENTS QtTest)
334set(TQTcpServerTest_SOURCES
335 qt/TQTcpServerTest.cpp
336)
337add_executable(TQTcpServerTest ${TQTcpServerTest_SOURCES})
Jim King9de9b1f2015-04-30 16:03:34 -0400338target_link_libraries(TQTcpServerTest testgencpp_cob thriftqt Qt4::QtTest)
339LINK_AGAINST_THRIFT_LIBRARY(TQTcpServerTest thrift)
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900340add_test(NAME TQTcpServerTest COMMAND TQTcpServerTest)
341endif()
342
Nobuaki Sukegawa66228772014-12-07 21:45:33 +0900343if(WITH_QT5)
344add_subdirectory(qt)
345endif()
346
Pascal Bachd5f87e12014-12-12 15:59:17 +0100347#
348# Common thrift code generation rules
349#
350
351
Ben Craig1684c422015-04-24 08:52:44 -0500352add_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 +0900353 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/DebugProtoTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100354)
355
356add_custom_command(OUTPUT gen-cpp/EnumTest_types.cpp gen-cpp/EnumTest_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900357 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/EnumTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100358)
359
360add_custom_command(OUTPUT gen-cpp/TypedefTest_types.cpp gen-cpp/TypedefTest_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900361 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/TypedefTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100362)
363
364add_custom_command(OUTPUT gen-cpp/OptionalRequiredTest_types.cpp gen-cpp/OptionalRequiredTest_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900365 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/OptionalRequiredTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100366)
367
368add_custom_command(OUTPUT gen-cpp/Recursive_types.cpp gen-cpp/Recursive_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900369 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/Recursive.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100370)
371
372add_custom_command(OUTPUT gen-cpp/Service.cpp gen-cpp/StressTest_types.cpp
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900373 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/StressTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100374)
375
376add_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 +0900377 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100378)
379
380add_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 +0900381 COMMAND ${THRIFT_COMPILER} --gen cpp:templates,cob_style ${CMAKE_CURRENT_SOURCE_DIR}/processor/proc.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100382)