zephyr/samples/modules/thrift/hello/server/CMakeLists.txt
Chris Friedt 3ea28b2fa5 samples: modules: thrift: add samples for thrift module
Here we add a client and server samples for the basic
"hello" service.

These samples are designed to be run by either Zephyr or
the host machine, interchangeably.

Additionally, there is a python version of the client
to demonstrate Thrift's cross-language capabilities.

This code was merged from the following repository
at the commit specified below, with minor formatting
and coding-style modifications.

https://github.com/zephyrproject-rtos/gsoc-2022-thrift
e12e014d295918cc5ba0b4c507d1bf595a2f539a

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-02-09 20:30:21 +09:00

62 lines
1.5 KiB
CMake

# Copyright 2022 Meta
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(thrift_hello_server)
FILE(GLOB app_sources
src/*.cpp
)
include(${ZEPHYR_BASE}/modules/thrift/cmake/thrift.cmake)
set(generated_sources "")
set(gen_dir ${ZEPHYR_BINARY_DIR}/misc/generated/thrift_hello)
list(APPEND generated_sources ${gen_dir}/gen-cpp/hello_types.h)
list(APPEND generated_sources ${gen_dir}/gen-cpp/Hello.cpp)
list(APPEND generated_sources ${gen_dir}/gen-cpp/Hello.h)
list(APPEND app_sources ${generated_sources})
thrift(
app
cpp
:no_skeleton
${gen_dir}
${ZEPHYR_BASE}/samples/modules/thrift/hello/hello.thrift
""
${generated_sources}
)
target_sources(app PRIVATE ${app_sources})
# needed because std::iterator was deprecated with -std=c++17
target_compile_options(app PRIVATE -Wno-deprecated-declarations)
# convert .pem files to array data at build time
zephyr_include_directories(${gen_dir})
generate_inc_file_for_target(
app
${ZEPHYR_BASE}/samples/modules/thrift/hello/qemu-cert.pem
${gen_dir}/qemu_cert.pem.inc
)
generate_inc_file_for_target(
app
${ZEPHYR_BASE}/samples/modules/thrift/hello/qemu-key.pem
${gen_dir}/qemu_key.pem.inc
)
generate_inc_file_for_target(
app
${ZEPHYR_BASE}/samples/modules/thrift/hello/native-cert.pem
${gen_dir}/native_cert.pem.inc
)
generate_inc_file_for_target(
app
${ZEPHYR_BASE}/samples/modules/thrift/hello/native-key.pem
${gen_dir}/native_key.pem.inc
)