1# Copyright 2022 Meta 2# SPDX-License-Identifier: Apache-2.0 3 4cmake_minimum_required(VERSION 3.20.0) 5find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) 6project(thrift_hello_server) 7 8FILE(GLOB app_sources 9 src/*.cpp 10) 11 12include(${ZEPHYR_BASE}/modules/thrift/cmake/thrift.cmake) 13 14set(generated_sources "") 15set(gen_dir ${ZEPHYR_BINARY_DIR}/misc/generated/thrift_hello) 16list(APPEND generated_sources ${gen_dir}/gen-cpp/hello_types.h) 17list(APPEND generated_sources ${gen_dir}/gen-cpp/Hello.cpp) 18list(APPEND generated_sources ${gen_dir}/gen-cpp/Hello.h) 19list(APPEND app_sources ${generated_sources}) 20 21thrift( 22 app 23 cpp 24 :no_skeleton 25 ${gen_dir} 26 ${ZEPHYR_BASE}/samples/modules/thrift/hello/hello.thrift 27 "" 28 ${generated_sources} 29) 30 31target_sources(app PRIVATE ${app_sources}) 32 33# needed because std::iterator was deprecated with -std=c++17 34target_compile_options(app PRIVATE -Wno-deprecated-declarations) 35 36# convert .pem files to array data at build time 37zephyr_include_directories(${gen_dir}) 38 39generate_inc_file_for_target( 40 app 41 ${ZEPHYR_BASE}/samples/modules/thrift/hello/qemu-cert.pem 42 ${gen_dir}/qemu_cert.pem.inc 43 ) 44 45generate_inc_file_for_target( 46 app 47 ${ZEPHYR_BASE}/samples/modules/thrift/hello/qemu-key.pem 48 ${gen_dir}/qemu_key.pem.inc 49 ) 50 51generate_inc_file_for_target( 52 app 53 ${ZEPHYR_BASE}/samples/modules/thrift/hello/native-cert.pem 54 ${gen_dir}/native_cert.pem.inc 55 ) 56 57generate_inc_file_for_target( 58 app 59 ${ZEPHYR_BASE}/samples/modules/thrift/hello/native-key.pem 60 ${gen_dir}/native_key.pem.inc 61 ) 62