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_test) 7 8set(THRIFT_UPSTREAM ${ZEPHYR_THRIFT_MODULE_DIR}) 9 10include(${ZEPHYR_BASE}/modules/thrift/cmake/thrift.cmake) 11 12FILE(GLOB app_sources 13 src/*.cpp 14) 15 16set(generated_sources "") 17set(gen_dir ${ZEPHYR_BINARY_DIR}/misc/generated/thrift_ThriftTest) 18list(APPEND generated_sources ${gen_dir}/gen-cpp/SecondService.cpp) 19list(APPEND generated_sources ${gen_dir}/gen-cpp/SecondService.h) 20list(APPEND generated_sources ${gen_dir}/gen-cpp/ThriftTest_constants.cpp) 21list(APPEND generated_sources ${gen_dir}/gen-cpp/ThriftTest_constants.h) 22list(APPEND generated_sources ${gen_dir}/gen-cpp/ThriftTest.cpp) 23list(APPEND generated_sources ${gen_dir}/gen-cpp/ThriftTest.h) 24list(APPEND generated_sources ${gen_dir}/gen-cpp/ThriftTest_types.cpp) 25list(APPEND generated_sources ${gen_dir}/gen-cpp/ThriftTest_types.h) 26list(APPEND app_sources ${generated_sources}) 27 28thrift( 29 app 30 cpp 31 :no_skeleton 32 ${gen_dir} 33 # v0.16: ubuntu packaged thrift compiler does not support 'uuid' type 34 "${THRIFT_UPSTREAM}/test/v0.16/ThriftTest.thrift" 35 "" 36 ${generated_sources} 37) 38 39target_sources(app PRIVATE ${app_sources}) 40 41# needed because std::iterator was deprecated with -std=c++17 42target_compile_options(app PRIVATE -Wno-deprecated-declarations) 43 44# convert .pem files to array data at build time 45zephyr_include_directories(${gen_dir}) 46 47generate_inc_file_for_target( 48 app 49 ${ZEPHYR_BASE}/samples/modules/thrift/hello/qemu-cert.pem 50 ${gen_dir}/qemu_cert.pem.inc 51 ) 52 53generate_inc_file_for_target( 54 app 55 ${ZEPHYR_BASE}/samples/modules/thrift/hello/qemu-key.pem 56 ${gen_dir}/qemu_key.pem.inc 57 ) 58