]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/thrift/lib/cpp/CMakeLists.txt
buildsys: switch source download to quincy
[ceph.git] / ceph / src / jaegertracing / thrift / lib / cpp / CMakeLists.txt
CommitLineData
f67539c2
TL
1#
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
20# Remove the following once lib/cpp no longer depends on boost headers:
21include(BoostMacros)
22REQUIRE_BOOST_HEADERS()
23
24include_directories(src)
25
26if(NOT BUILD_SHARED_LIBS)
27 add_definitions("-DTHRIFT_STATIC_DEFINE")
28endif()
29
30# SYSLIBS contains libraries that need to be linked to all lib targets
31set(SYSLIBS "")
32
33# Create the thrift C++ library
34set( thriftcpp_SOURCES
35 src/thrift/TApplicationException.cpp
36 src/thrift/TOutput.cpp
37 src/thrift/async/TAsyncChannel.cpp
38 src/thrift/async/TAsyncProtocolProcessor.cpp
39 src/thrift/async/TConcurrentClientSyncInfo.h
40 src/thrift/async/TConcurrentClientSyncInfo.cpp
41 src/thrift/concurrency/ThreadManager.cpp
42 src/thrift/concurrency/TimerManager.cpp
43 src/thrift/processor/PeekProcessor.cpp
44 src/thrift/protocol/TBase64Utils.cpp
45 src/thrift/protocol/TDebugProtocol.cpp
46 src/thrift/protocol/TJSONProtocol.cpp
47 src/thrift/protocol/TMultiplexedProtocol.cpp
48 src/thrift/protocol/TProtocol.cpp
49 src/thrift/transport/TTransportException.cpp
50 src/thrift/transport/TFDTransport.cpp
51 src/thrift/transport/TSimpleFileTransport.cpp
52 src/thrift/transport/THttpTransport.cpp
53 src/thrift/transport/THttpClient.cpp
54 src/thrift/transport/THttpServer.cpp
55 src/thrift/transport/TSocket.cpp
56 src/thrift/transport/TSocketPool.cpp
57 src/thrift/transport/TServerSocket.cpp
58 src/thrift/transport/TTransportUtils.cpp
59 src/thrift/transport/TBufferTransports.cpp
60 src/thrift/server/TConnectedClient.cpp
61 src/thrift/server/TServerFramework.cpp
62 src/thrift/server/TSimpleServer.cpp
63 src/thrift/server/TThreadPoolServer.cpp
64 src/thrift/server/TThreadedServer.cpp
65)
66
67# These files don't work on Windows CE as there is no pipe support
68# TODO: These files won't work with UNICODE support on windows. If fixed this can be re-added.
69if (NOT WINCE)
70 list(APPEND thriftcpp_SOURCES
71 src/thrift/transport/TPipe.cpp
72 src/thrift/transport/TPipeServer.cpp
73 src/thrift/transport/TFileTransport.cpp
74 )
75endif()
76
77
78if (WIN32)
79 list(APPEND thriftcpp_SOURCES
80 src/thrift/windows/TWinsockSingleton.cpp
81 src/thrift/windows/SocketPair.cpp
82 src/thrift/windows/GetTimeOfDay.cpp
83 src/thrift/windows/WinFcntl.cpp
84 )
85 if(NOT WINCE)
86 # This file uses pipes so it currently won't work on Windows CE
87 list(APPEND thriftcpp_SOURCES
88 src/thrift/windows/OverlappedSubmissionThread.cpp
89 )
90 endif()
91else()
92 # These files evaluate to nothing on Windows, so omit them from the
93 # Windows build
94 list(APPEND thriftcpp_SOURCES
95 src/thrift/VirtualProfiling.cpp
96 src/thrift/server/TServer.cpp
97 )
98endif()
99
100# If OpenSSL is not found or disabled just ignore the OpenSSL stuff
101if(OPENSSL_FOUND AND WITH_OPENSSL)
102 list( APPEND thriftcpp_SOURCES
103 src/thrift/transport/TSSLSocket.cpp
104 src/thrift/transport/TSSLServerSocket.cpp
105 )
106 include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}")
107 list(APPEND SYSLIBS "${OPENSSL_LIBRARIES}")
108endif()
109
110if(UNIX)
111 if(ANDROID)
112 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
113 else()
114 list(APPEND SYSLIBS pthread)
115 endif()
116endif()
117set( thriftcpp_threads_SOURCES
118 src/thrift/concurrency/ThreadFactory.cpp
119 src/thrift/concurrency/Thread.cpp
120 src/thrift/concurrency/Monitor.cpp
121 src/thrift/concurrency/Mutex.cpp
122)
123
124# Thrift non blocking server
125set( thriftcppnb_SOURCES
126 src/thrift/server/TNonblockingServer.cpp
127 src/thrift/transport/TNonblockingServerSocket.cpp
128 src/thrift/transport/TNonblockingSSLServerSocket.cpp
129 src/thrift/async/TEvhttpServer.cpp
130 src/thrift/async/TEvhttpClientChannel.cpp
131)
132
133# Thrift zlib transport
134set( thriftcppz_SOURCES
135 src/thrift/transport/TZlibTransport.cpp
136 src/thrift/protocol/THeaderProtocol.cpp
137 src/thrift/transport/THeaderTransport.cpp
138 src/thrift/protocol/THeaderProtocol.cpp
139 src/thrift/transport/THeaderTransport.cpp
140)
141
142# Contains the thrift specific ADD_LIBRARY_THRIFT and TARGET_LINK_LIBRARIES_THRIFT
143include(ThriftMacros)
144
145ADD_LIBRARY_THRIFT(thrift ${thriftcpp_SOURCES} ${thriftcpp_threads_SOURCES})
146if(WIN32)
147 TARGET_LINK_LIBRARIES_THRIFT(thrift ${SYSLIBS} ws2_32)
148else()
149 TARGET_LINK_LIBRARIES_THRIFT(thrift ${SYSLIBS})
150endif()
151ADD_PKGCONFIG_THRIFT(thrift)
152
153if(WITH_LIBEVENT)
154 find_package(Libevent REQUIRED) # Libevent comes with CMake support form upstream
155 include_directories(SYSTEM ${LIBEVENT_INCLUDE_DIRS})
156
157 ADD_LIBRARY_THRIFT(thriftnb ${thriftcppnb_SOURCES})
158 LINK_AGAINST_THRIFT_LIBRARY(thriftnb thrift)
159 TARGET_LINK_LIBRARIES_THRIFT(thriftnb ${SYSLIBS} ${LIBEVENT_LIBRARIES})
160 ADD_PKGCONFIG_THRIFT(thrift-nb)
161endif()
162
163if(WITH_ZLIB)
164 find_package(ZLIB REQUIRED)
165 include_directories(SYSTEM ${ZLIB_INCLUDE_DIRS})
166
167 ADD_LIBRARY_THRIFT(thriftz ${thriftcppz_SOURCES})
168 TARGET_LINK_LIBRARIES_THRIFT(thriftz ${SYSLIBS} ${ZLIB_LIBRARIES})
169 TARGET_LINK_LIBRARIES_THRIFT_AGAINST_THRIFT_LIBRARY(thriftz thrift)
170 ADD_PKGCONFIG_THRIFT(thrift-z)
171endif()
172
173if(WITH_QT5)
174 add_subdirectory(src/thrift/qt)
175 ADD_PKGCONFIG_THRIFT(thrift-qt5)
176endif()
177
178if(MSVC)
179 add_definitions("-DUNICODE -D_UNICODE")
180endif()
181
182# Install the headers
183install(DIRECTORY "src/thrift" DESTINATION "${INCLUDE_INSTALL_DIR}"
184 FILES_MATCHING PATTERN "*.h" PATTERN "*.tcc")
185# Copy config.h file
186install(DIRECTORY "${CMAKE_BINARY_DIR}/thrift" DESTINATION "${INCLUDE_INSTALL_DIR}"
187 FILES_MATCHING PATTERN "*.h")
188
189if(BUILD_TESTING)
190 add_subdirectory(test)
191endif()