cyy | a6a3a78 | 2019-02-07 22:27:33 +0800 | [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 | |
Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 20 | # Contains the thrift specific target_link_libraries |
cyy | a6a3a78 | 2019-02-07 22:27:33 +0800 | [diff] [blame] | 21 | include(ThriftMacros) |
| 22 | |
| 23 | find_package(GLIB REQUIRED COMPONENTS gobject) |
| 24 | include_directories(SYSTEM "${GLIB_INCLUDE_DIR}") |
| 25 | include_directories(SYSTEM "${GLIBCONFIG_INCLUDE_DIR}") |
| 26 | |
| 27 | #Make sure gen-c_glib files can be included |
| 28 | include_directories("${CMAKE_CURRENT_BINARY_DIR}") |
| 29 | include_directories("${CMAKE_CURRENT_BINARY_DIR}/gen-c_glib") |
| 30 | include_directories("${PROJECT_SOURCE_DIR}/lib/c_glib/src") |
Kevin Wojniak | dbb95e4 | 2020-01-25 12:37:23 -0800 | [diff] [blame] | 31 | include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}") |
cyy | a6a3a78 | 2019-02-07 22:27:33 +0800 | [diff] [blame] | 32 | |
| 33 | set(crosstestgencglib_SOURCES |
| 34 | gen-c_glib/t_test_second_service.c |
| 35 | gen-c_glib/t_test_second_service.h |
| 36 | gen-c_glib/t_test_thrift_test.c |
| 37 | gen-c_glib/t_test_thrift_test.h |
| 38 | gen-c_glib/t_test_thrift_test_types.c |
| 39 | gen-c_glib/t_test_thrift_test_types.h |
| 40 | ) |
| 41 | add_library(crosstestgencglib STATIC ${crosstestgencglib_SOURCES}) |
Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 42 | target_link_libraries(crosstestgencglib thrift_c_glib) |
cyy | a6a3a78 | 2019-02-07 22:27:33 +0800 | [diff] [blame] | 43 | |
zeshuai007 | 037753e | 2020-11-30 11:16:10 +0800 | [diff] [blame] | 44 | if (WITH_ZLIB) |
Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 45 | target_link_libraries(crosstestgencglib thrift_c_glib_zlib) |
zeshuai007 | 037753e | 2020-11-30 11:16:10 +0800 | [diff] [blame] | 46 | endif () |
| 47 | |
cyy | a6a3a78 | 2019-02-07 22:27:33 +0800 | [diff] [blame] | 48 | add_executable(test_server src/test_server.c src/thrift_test_handler.c src/thrift_second_service_handler.c) |
zeshuai007 | 037753e | 2020-11-30 11:16:10 +0800 | [diff] [blame] | 49 | target_link_libraries(test_server crosstestgencglib ${ZLIB_LIBRARIES}) |
cyy | a6a3a78 | 2019-02-07 22:27:33 +0800 | [diff] [blame] | 50 | |
| 51 | add_executable(test_client src/test_client.c) |
Kevin Wojniak | dbb95e4 | 2020-01-25 12:37:23 -0800 | [diff] [blame] | 52 | target_link_libraries(test_client crosstestgencglib "${OPENSSL_LIBRARIES}") |
cyy | a6a3a78 | 2019-02-07 22:27:33 +0800 | [diff] [blame] | 53 | |
| 54 | # |
| 55 | # Common thrift code generation rules |
| 56 | # |
| 57 | |
| 58 | add_custom_command(OUTPUT gen-c_glib/t_test_second_service.c gen-c_glib/t_test_second_service.h gen-c_glib/t_test_thrift_test.c gen-c_glib/t_test_thrift_test.h gen-c_glib/t_test_thrift_test_types.c gen-c_glib/t_test_thrift_test_types.h |
| 59 | COMMAND ${THRIFT_COMPILER} --gen c_glib -r ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift |
| 60 | ) |