| Roger Meier | 2659381 | 2015-04-12 16:10:35 +0200 | [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 |  | 
| Ben Craig | 7207c22 | 2015-07-06 08:40:35 -0500 | [diff] [blame] | 20 | # Contains the thrift specific LINK_AGAINST_THRIFT_LIBRARY | 
 | 21 | include(ThriftMacros) | 
 | 22 |  | 
| Roger Meier | 2659381 | 2015-04-12 16:10:35 +0200 | [diff] [blame] | 23 | set(Boost_USE_STATIC_LIBS ON) | 
 | 24 | find_package(Boost 1.53.0 REQUIRED COMPONENTS program_options system filesystem) | 
 | 25 | include_directories(SYSTEM "${Boost_INCLUDE_DIRS}") | 
 | 26 |  | 
| Ben Craig | 7207c22 | 2015-07-06 08:40:35 -0500 | [diff] [blame] | 27 | find_package(OpenSSL REQUIRED) | 
 | 28 | include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}") | 
 | 29 |  | 
 | 30 | find_package(Libevent REQUIRED)  # Libevent comes with CMake support from upstream | 
 | 31 | include_directories(SYSTEM ${LIBEVENT_INCLUDE_DIRS}) | 
 | 32 |  | 
| Roger Meier | 2659381 | 2015-04-12 16:10:35 +0200 | [diff] [blame] | 33 | #Make sure gen-cpp files can be included | 
 | 34 | include_directories("${CMAKE_CURRENT_BINARY_DIR}") | 
 | 35 | include_directories("${CMAKE_CURRENT_BINARY_DIR}/gen-cpp") | 
 | 36 | include_directories("${PROJECT_SOURCE_DIR}/lib/cpp/src") | 
 | 37 |  | 
 | 38 |  | 
 | 39 | set(crosstestgencpp_SOURCES | 
 | 40 |     gen-cpp/ThriftTest.cpp | 
 | 41 |     gen-cpp/ThriftTest_types.cpp | 
 | 42 |     gen-cpp/ThriftTest_constants.cpp | 
| Marco Molteni | 8349425 | 2015-04-16 13:50:20 +0200 | [diff] [blame] | 43 |     src/ThriftTest_extras.cpp | 
| Roger Meier | 2659381 | 2015-04-12 16:10:35 +0200 | [diff] [blame] | 44 | ) | 
 | 45 | add_library(crosstestgencpp STATIC ${crosstestgencpp_SOURCES}) | 
| Ben Craig | 7207c22 | 2015-07-06 08:40:35 -0500 | [diff] [blame] | 46 | LINK_AGAINST_THRIFT_LIBRARY(crosstestgencpp thrift) | 
| Roger Meier | 2659381 | 2015-04-12 16:10:35 +0200 | [diff] [blame] | 47 |  | 
 | 48 | set(crossstressgencpp_SOURCES | 
 | 49 |     gen-cpp/Service.cpp | 
| Ben Craig | 7207c22 | 2015-07-06 08:40:35 -0500 | [diff] [blame] | 50 |     #gen-cpp/StressTest_types.cpp #basically empty, so omitting | 
| Roger Meier | 2659381 | 2015-04-12 16:10:35 +0200 | [diff] [blame] | 51 |     gen-cpp/StressTest_constants.cpp | 
 | 52 | ) | 
 | 53 | add_library(crossstressgencpp STATIC ${crossstressgencpp_SOURCES}) | 
| Ben Craig | 7207c22 | 2015-07-06 08:40:35 -0500 | [diff] [blame] | 54 | LINK_AGAINST_THRIFT_LIBRARY(crossstressgencpp thrift) | 
| Roger Meier | 2659381 | 2015-04-12 16:10:35 +0200 | [diff] [blame] | 55 |  | 
 | 56 | add_executable(TestServer src/TestServer.cpp) | 
| Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 57 | target_link_libraries(TestServer crosstestgencpp ${Boost_LIBRARIES} ${LIBEVENT_LIB}) | 
| Ben Craig | 7207c22 | 2015-07-06 08:40:35 -0500 | [diff] [blame] | 58 | LINK_AGAINST_THRIFT_LIBRARY(TestServer thrift) | 
 | 59 | LINK_AGAINST_THRIFT_LIBRARY(TestServer thriftnb) | 
| Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 60 | LINK_AGAINST_THRIFT_LIBRARY(TestServer thriftz) | 
| Roger Meier | 2659381 | 2015-04-12 16:10:35 +0200 | [diff] [blame] | 61 |  | 
 | 62 | add_executable(TestClient src/TestClient.cpp) | 
| Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 63 | target_link_libraries(TestClient crosstestgencpp ${Boost_LIBRARIES} ${LIBEVENT_LIB}) | 
| Ben Craig | 7207c22 | 2015-07-06 08:40:35 -0500 | [diff] [blame] | 64 | LINK_AGAINST_THRIFT_LIBRARY(TestClient thrift) | 
 | 65 | LINK_AGAINST_THRIFT_LIBRARY(TestClient thriftnb) | 
| Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 66 | LINK_AGAINST_THRIFT_LIBRARY(TestClient thriftz) | 
| Roger Meier | 2659381 | 2015-04-12 16:10:35 +0200 | [diff] [blame] | 67 |  | 
 | 68 | add_executable(StressTest src/StressTest.cpp) | 
| Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 69 | target_link_libraries(StressTest crossstressgencpp ${Boost_LIBRARIES} ${LIBEVENT_LIB}) | 
| Ben Craig | 7207c22 | 2015-07-06 08:40:35 -0500 | [diff] [blame] | 70 | LINK_AGAINST_THRIFT_LIBRARY(StressTest thrift) | 
 | 71 | LINK_AGAINST_THRIFT_LIBRARY(StressTest thriftnb) | 
| Roger Meier | 2659381 | 2015-04-12 16:10:35 +0200 | [diff] [blame] | 72 | add_test(NAME StressTest COMMAND StressTest) | 
 | 73 |  | 
 | 74 | add_executable(StressTestNonBlocking src/StressTestNonBlocking.cpp) | 
| Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 75 | target_link_libraries(StressTestNonBlocking crossstressgencpp ${Boost_LIBRARIES} ${LIBEVENT_LIB}) | 
| Ben Craig | 7207c22 | 2015-07-06 08:40:35 -0500 | [diff] [blame] | 76 | LINK_AGAINST_THRIFT_LIBRARY(StressTestNonBlocking thrift) | 
 | 77 | LINK_AGAINST_THRIFT_LIBRARY(StressTestNonBlocking thriftnb) | 
 | 78 | LINK_AGAINST_THRIFT_LIBRARY(StressTestNonBlocking thriftz) | 
| Roger Meier | 2659381 | 2015-04-12 16:10:35 +0200 | [diff] [blame] | 79 | add_test(NAME StressTestNonBlocking COMMAND StressTestNonBlocking) | 
 | 80 |  | 
 | 81 | # | 
 | 82 | # Common thrift code generation rules | 
 | 83 | # | 
 | 84 |  | 
 | 85 | add_custom_command(OUTPUT gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_constants.cpp | 
| Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 86 |     COMMAND ${THRIFT_COMPILER} --gen cpp:templates,cob_style -r ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift | 
| Roger Meier | 2659381 | 2015-04-12 16:10:35 +0200 | [diff] [blame] | 87 | ) | 
 | 88 |  | 
 | 89 | add_custom_command(OUTPUT gen-cpp/StressTest_types.cpp gen-cpp/StressTest_constants.cpp gen-cpp/Service.cpp | 
| Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 90 |     COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/StressTest.thrift | 
| Roger Meier | 2659381 | 2015-04-12 16:10:35 +0200 | [diff] [blame] | 91 | ) |