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 | |
| 20 | set(Boost_USE_STATIC_LIBS ON) |
| 21 | find_package(Boost 1.53.0 REQUIRED COMPONENTS program_options system filesystem) |
| 22 | include_directories(SYSTEM "${Boost_INCLUDE_DIRS}") |
| 23 | |
| 24 | #Make sure gen-cpp files can be included |
| 25 | include_directories("${CMAKE_CURRENT_BINARY_DIR}") |
| 26 | include_directories("${CMAKE_CURRENT_BINARY_DIR}/gen-cpp") |
| 27 | include_directories("${PROJECT_SOURCE_DIR}/lib/cpp/src") |
| 28 | |
| 29 | |
| 30 | set(crosstestgencpp_SOURCES |
| 31 | gen-cpp/ThriftTest.cpp |
| 32 | gen-cpp/ThriftTest_types.cpp |
| 33 | gen-cpp/ThriftTest_constants.cpp |
Marco Molteni | 8349425 | 2015-04-16 13:50:20 +0200 | [diff] [blame^] | 34 | src/ThriftTest_extras.cpp |
Roger Meier | 2659381 | 2015-04-12 16:10:35 +0200 | [diff] [blame] | 35 | ) |
| 36 | add_library(crosstestgencpp STATIC ${crosstestgencpp_SOURCES}) |
| 37 | target_link_libraries(crosstestgencpp thrift) |
| 38 | |
| 39 | set(crossstressgencpp_SOURCES |
| 40 | gen-cpp/Service.cpp |
| 41 | gen-cpp/StressTest_types.cpp |
| 42 | gen-cpp/StressTest_constants.cpp |
| 43 | ) |
| 44 | add_library(crossstressgencpp STATIC ${crossstressgencpp_SOURCES}) |
| 45 | target_link_libraries(crossstressgencpp thrift) |
| 46 | |
| 47 | add_executable(TestServer src/TestServer.cpp) |
| 48 | target_link_libraries(TestServer thrift thriftnb crosstestgencpp ${Boost_LIBRARIES} ${LIBEVENT_LIB}) |
| 49 | |
| 50 | add_executable(TestClient src/TestClient.cpp) |
| 51 | target_link_libraries(TestClient thrift thriftnb crosstestgencpp ${Boost_LIBRARIES} ${LIBEVENT_LIB}) |
| 52 | |
| 53 | add_executable(StressTest src/StressTest.cpp) |
| 54 | target_link_libraries(StressTest thrift thriftnb crossstressgencpp ${Boost_LIBRARIES} ${LIBEVENT_LIB}) |
| 55 | add_test(NAME StressTest COMMAND StressTest) |
| 56 | |
| 57 | add_executable(StressTestNonBlocking src/StressTestNonBlocking.cpp) |
| 58 | target_link_libraries(StressTestNonBlocking thrift thriftz thriftnb crossstressgencpp ${Boost_LIBRARIES} ${LIBEVENT_LIB}) |
| 59 | add_test(NAME StressTestNonBlocking COMMAND StressTestNonBlocking) |
| 60 | |
| 61 | # |
| 62 | # Common thrift code generation rules |
| 63 | # |
| 64 | |
| 65 | add_custom_command(OUTPUT gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_constants.cpp |
| 66 | COMMAND thrift-compiler --gen cpp:templates,cob_style -r ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift |
| 67 | ) |
| 68 | |
| 69 | add_custom_command(OUTPUT gen-cpp/StressTest_types.cpp gen-cpp/StressTest_constants.cpp gen-cpp/Service.cpp |
| 70 | COMMAND thrift-compiler --gen cpp ${PROJECT_SOURCE_DIR}/test/StressTest.thrift |
| 71 | ) |