Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 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 | |
James E. King III | c9ac8d2 | 2019-01-07 16:46:45 -0500 | [diff] [blame] | 20 | # Remove the following once lib/cpp no longer depends on boost headers: |
| 21 | include(BoostMacros) |
| 22 | REQUIRE_BOOST_HEADERS() |
| 23 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 24 | include_directories(src) |
| 25 | |
| 26 | # SYSLIBS contains libraries that need to be linked to all lib targets |
| 27 | set(SYSLIBS "") |
| 28 | |
| 29 | # Create the thrift C++ library |
| 30 | set( thriftcpp_SOURCES |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 31 | src/thrift/TApplicationException.cpp |
Konrad Grochowski | 24ea0bf | 2015-05-07 14:59:29 +0200 | [diff] [blame] | 32 | src/thrift/TOutput.cpp |
Jim King | 79c9911 | 2015-04-30 07:10:08 -0400 | [diff] [blame] | 33 | src/thrift/async/TAsyncChannel.cpp |
Stefan Bolus | 9edecce | 2018-06-06 20:32:52 +0200 | [diff] [blame] | 34 | src/thrift/async/TAsyncProtocolProcessor.cpp |
ben-craig | 02bade1 | 2015-07-17 08:40:48 -0500 | [diff] [blame] | 35 | src/thrift/async/TConcurrentClientSyncInfo.h |
| 36 | src/thrift/async/TConcurrentClientSyncInfo.cpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 37 | src/thrift/concurrency/ThreadManager.cpp |
| 38 | src/thrift/concurrency/TimerManager.cpp |
Jim King | 79c9911 | 2015-04-30 07:10:08 -0400 | [diff] [blame] | 39 | src/thrift/processor/PeekProcessor.cpp |
Ben Craig | cfaadcc | 2015-07-08 20:50:33 -0500 | [diff] [blame] | 40 | src/thrift/protocol/TBase64Utils.cpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 41 | src/thrift/protocol/TDebugProtocol.cpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 42 | src/thrift/protocol/TJSONProtocol.cpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 43 | src/thrift/protocol/TMultiplexedProtocol.cpp |
Ben Craig | cfaadcc | 2015-07-08 20:50:33 -0500 | [diff] [blame] | 44 | src/thrift/protocol/TProtocol.cpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 45 | src/thrift/transport/TTransportException.cpp |
| 46 | src/thrift/transport/TFDTransport.cpp |
| 47 | src/thrift/transport/TSimpleFileTransport.cpp |
| 48 | src/thrift/transport/THttpTransport.cpp |
| 49 | src/thrift/transport/THttpClient.cpp |
| 50 | src/thrift/transport/THttpServer.cpp |
| 51 | src/thrift/transport/TSocket.cpp |
| 52 | src/thrift/transport/TSocketPool.cpp |
| 53 | src/thrift/transport/TServerSocket.cpp |
| 54 | src/thrift/transport/TTransportUtils.cpp |
| 55 | src/thrift/transport/TBufferTransports.cpp |
Jim King | 5ec805b | 2015-04-26 07:52:40 -0400 | [diff] [blame] | 56 | src/thrift/server/TConnectedClient.cpp |
Jim King | 21b6852 | 2015-04-26 18:30:26 -0400 | [diff] [blame] | 57 | src/thrift/server/TServerFramework.cpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 58 | src/thrift/server/TSimpleServer.cpp |
| 59 | src/thrift/server/TThreadPoolServer.cpp |
| 60 | src/thrift/server/TThreadedServer.cpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 61 | ) |
| 62 | |
Mario Emmenlauer | 3db41fa | 2017-04-07 23:24:07 +0200 | [diff] [blame] | 63 | # These files don't work on Windows CE as there is no pipe support |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 64 | # TODO: These files won't work with UNICODE support on windows. If fixed this can be re-added. |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 65 | if (NOT WINCE) |
| 66 | list(APPEND thriftcpp_SOURCES |
| 67 | src/thrift/transport/TPipe.cpp |
| 68 | src/thrift/transport/TPipeServer.cpp |
| 69 | src/thrift/transport/TFileTransport.cpp |
| 70 | ) |
| 71 | endif() |
| 72 | |
| 73 | |
Mario Emmenlauer | 3db41fa | 2017-04-07 23:24:07 +0200 | [diff] [blame] | 74 | if (WIN32) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 75 | list(APPEND thriftcpp_SOURCES |
| 76 | src/thrift/windows/TWinsockSingleton.cpp |
| 77 | src/thrift/windows/SocketPair.cpp |
| 78 | src/thrift/windows/GetTimeOfDay.cpp |
| 79 | src/thrift/windows/WinFcntl.cpp |
| 80 | ) |
| 81 | if(NOT WINCE) |
| 82 | # This file uses pipes so it currently won't work on Windows CE |
| 83 | list(APPEND thriftcpp_SOURCES |
| 84 | src/thrift/windows/OverlappedSubmissionThread.cpp |
| 85 | ) |
| 86 | endif() |
Ben Craig | 7207c22 | 2015-07-06 08:40:35 -0500 | [diff] [blame] | 87 | else() |
| 88 | # These files evaluate to nothing on Windows, so omit them from the |
| 89 | # Windows build |
| 90 | list(APPEND thriftcpp_SOURCES |
| 91 | src/thrift/VirtualProfiling.cpp |
| 92 | src/thrift/server/TServer.cpp |
| 93 | ) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 94 | endif() |
| 95 | |
James E. King III | 1735542 | 2019-01-11 23:06:08 -0500 | [diff] [blame] | 96 | # If OpenSSL is not found or disabled just ignore the OpenSSL stuff |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 97 | if(OPENSSL_FOUND AND WITH_OPENSSL) |
| 98 | list( APPEND thriftcpp_SOURCES |
| 99 | src/thrift/transport/TSSLSocket.cpp |
| 100 | src/thrift/transport/TSSLServerSocket.cpp |
| 101 | ) |
Nobuaki Sukegawa | c444fb5 | 2015-01-02 23:16:55 +0900 | [diff] [blame] | 102 | include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}") |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 103 | list(APPEND SYSLIBS "${OPENSSL_LIBRARIES}") |
| 104 | endif() |
| 105 | |
cyy | ca8af9b | 2019-01-11 22:13:12 +0800 | [diff] [blame] | 106 | if(UNIX) |
Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 107 | if(ANDROID) |
| 108 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") |
| 109 | else() |
| 110 | list(APPEND SYSLIBS pthread) |
| 111 | endif() |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 112 | endif() |
cyy | ca8af9b | 2019-01-11 22:13:12 +0800 | [diff] [blame] | 113 | set( thriftcpp_threads_SOURCES |
| 114 | src/thrift/concurrency/ThreadFactory.cpp |
| 115 | src/thrift/concurrency/Thread.cpp |
| 116 | src/thrift/concurrency/Monitor.cpp |
| 117 | src/thrift/concurrency/Mutex.cpp |
| 118 | ) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 119 | |
| 120 | # Thrift non blocking server |
| 121 | set( thriftcppnb_SOURCES |
| 122 | src/thrift/server/TNonblockingServer.cpp |
Divya Thaluru | 808d143 | 2017-08-06 16:36:36 -0700 | [diff] [blame] | 123 | src/thrift/transport/TNonblockingServerSocket.cpp |
| 124 | src/thrift/transport/TNonblockingSSLServerSocket.cpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 125 | src/thrift/async/TEvhttpServer.cpp |
| 126 | src/thrift/async/TEvhttpClientChannel.cpp |
| 127 | ) |
| 128 | |
James E. King III | 1735542 | 2019-01-11 23:06:08 -0500 | [diff] [blame] | 129 | # Thrift zlib transport |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 130 | set( thriftcppz_SOURCES |
| 131 | src/thrift/transport/TZlibTransport.cpp |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 132 | src/thrift/protocol/THeaderProtocol.cpp |
| 133 | src/thrift/transport/THeaderTransport.cpp |
Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 134 | src/thrift/protocol/THeaderProtocol.cpp |
| 135 | src/thrift/transport/THeaderTransport.cpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 136 | ) |
| 137 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 138 | # Contains the thrift specific ADD_LIBRARY_THRIFT and TARGET_LINK_LIBRARIES_THRIFT |
| 139 | include(ThriftMacros) |
| 140 | |
| 141 | ADD_LIBRARY_THRIFT(thrift ${thriftcpp_SOURCES} ${thriftcpp_threads_SOURCES}) |
Antonio Di Monaco | 796667b | 2016-01-04 23:05:19 +0100 | [diff] [blame] | 142 | if(WIN32) |
| 143 | TARGET_LINK_LIBRARIES_THRIFT(thrift ${SYSLIBS} ws2_32) |
| 144 | else() |
| 145 | TARGET_LINK_LIBRARIES_THRIFT(thrift ${SYSLIBS}) |
| 146 | endif() |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 147 | |
| 148 | if(WITH_LIBEVENT) |
| 149 | find_package(Libevent REQUIRED) # Libevent comes with CMake support form upstream |
Nobuaki Sukegawa | c444fb5 | 2015-01-02 23:16:55 +0900 | [diff] [blame] | 150 | include_directories(SYSTEM ${LIBEVENT_INCLUDE_DIRS}) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 151 | |
| 152 | ADD_LIBRARY_THRIFT(thriftnb ${thriftcppnb_SOURCES}) |
James E. King III | 278528c | 2019-01-11 12:17:44 -0500 | [diff] [blame] | 153 | LINK_AGAINST_THRIFT_LIBRARY(thriftnb thrift) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 154 | TARGET_LINK_LIBRARIES_THRIFT(thriftnb ${SYSLIBS} ${LIBEVENT_LIBRARIES}) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 155 | endif() |
| 156 | |
| 157 | if(WITH_ZLIB) |
| 158 | find_package(ZLIB REQUIRED) |
Nobuaki Sukegawa | c444fb5 | 2015-01-02 23:16:55 +0900 | [diff] [blame] | 159 | include_directories(SYSTEM ${ZLIB_INCLUDE_DIRS}) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 160 | |
| 161 | ADD_LIBRARY_THRIFT(thriftz ${thriftcppz_SOURCES}) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 162 | TARGET_LINK_LIBRARIES_THRIFT(thriftz ${SYSLIBS} ${ZLIB_LIBRARIES}) |
| 163 | TARGET_LINK_LIBRARIES_THRIFT_AGAINST_THRIFT_LIBRARY(thriftz thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 164 | endif() |
| 165 | |
Nobuaki Sukegawa | 6622877 | 2014-12-07 21:45:33 +0900 | [diff] [blame] | 166 | if(WITH_QT5) |
Nobuaki Sukegawa | 6622877 | 2014-12-07 21:45:33 +0900 | [diff] [blame] | 167 | add_subdirectory(src/thrift/qt) |
| 168 | endif() |
| 169 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 170 | if(MSVC) |
| 171 | add_definitions("-DUNICODE -D_UNICODE") |
| 172 | endif() |
| 173 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 174 | # Install the headers |
| 175 | install(DIRECTORY "src/thrift" DESTINATION "${INCLUDE_INSTALL_DIR}" |
| 176 | FILES_MATCHING PATTERN "*.h" PATTERN "*.tcc") |
| 177 | # Copy config.h file |
| 178 | install(DIRECTORY "${CMAKE_BINARY_DIR}/thrift" DESTINATION "${INCLUDE_INSTALL_DIR}" |
| 179 | FILES_MATCHING PATTERN "*.h") |
| 180 | |
| 181 | if(BUILD_TESTING) |
| 182 | add_subdirectory(test) |
| 183 | endif() |