-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
65 lines (51 loc) · 1.95 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# © 2024 AO Kaspersky Lab
# Licensed under the 3-Clause BSD License
cmake_minimum_required(VERSION 3.25)
project(async_resolver_example)
# Initialize CMake library for the KasperskyOS SDK.
include(platform)
initialize_platform()
# Include the CMake library named nk
# for working with the NK compiler (nk-gen-c).
include(platform/nk)
# Find required protobuf package.
find_package(protobuf REQUIRED)
# Find protobuf compiler for .proto files.
# Due to cross-compilation we should use protoc build for host.
find_program(protoc NAMES protoc REQUIRED)
# Add a package for working with the virtual file system.
find_package(vfs REQUIRED)
include_directories(${vfs_INCLUDE})
# Add a package with the VFS program implementations.
find_package(precompiled_vfs REQUIRED)
include_directories(${precompiled_vfs_INCLUDE})
# Include the directory with the generated config header files.
include_directories(${CMAKE_CURRENT_BINARY_DIR})
# Include the directory with header files.
set(RESOURCES ${CMAKE_CURRENT_LIST_DIR}/resources)
include_directories(${RESOURCES}/include ${CMAKE_CURRENT_LIST_DIR})
# Include the directory with header files.
set(RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/resources)
# Add target to generate protobuf files.
set(PROTOBUF_GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}")
set(PROTOBUF_GENERATED_FILES
"${PROTOBUF_GENERATED_DIR}/addressbook.pb.cc"
"${PROTOBUF_GENERATED_DIR}/addressbook.pb.h"
)
set(PROTOBUF_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/..")
set(PROTOBUF_SOURCE_FILE "${PROTOBUF_SOURCE_DIR}/addressbook.proto")
add_custom_command(
OUTPUT ${PROTOBUF_GENERATED_FILES}
COMMAND ${protoc} -I${PROTOBUF_SOURCE_DIR}
--cpp_out=${PROTOBUF_GENERATED_DIR}
${PROTOBUF_SOURCE_FILE}
)
add_custom_target(PROTOBUF_GENERATE DEPENDS ${PROTOBUF_GENERATED_FILES})
add_nk_idl(CONSUMER_IDL
"${RESOURCES}/idl/IConsumer.idl"
NK_MODULE example
LANG "CXX"
)
add_subdirectory(consumer)
add_subdirectory(producer)
add_subdirectory(einit)