forked from spiriou/microADB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
99 lines (76 loc) · 3.4 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
cmake_minimum_required(VERSION 3.2)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/cmake/")
add_compile_options(-Wall -Wextra -Werror -Wno-format)
project (adbd)
find_package(uv REQUIRED)
option(ADBD_AUTHENTICATION "adb authentication" OFF)
option(ADBD_AUTH_PUBKEY "adb auth public key" OFF)
option(ADBD_FILE_SERVICE "adb file sync service" ON)
option(ADBD_SOCKET_SERVICE "adb socket service" ON)
option(ADBD_SHELL_SERVICE "adb shell service" ON)
set(ADBD_SHELL_SERVICE_PATH "/bin/bash" CACHE STRING "")
set(ADBD_SHELL_SERVICE_CMD "sh" CACHE STRING "")
set(ADBD_CNXN_PAYLOAD_SIZE "1024" CACHE STRING "")
set(ADBD_PAYLOAD_SIZE "1024" CACHE STRING "")
set(ADBD_FRAME_MAX "4" CACHE STRING "")
set(ADBD_TOKEN_SIZE "20" CACHE STRING "")
set(ADBD_DEVICE_ID "\"abcd\"" CACHE STRING "")
set(ADBD_PRODUCT_NAME "\"adb_dev\"" CACHE STRING "")
set(ADBD_PRODUCT_MODEL "\"adb_board\"" CACHE STRING "")
set(ADBD_PRODUCT_DEVICE "\"NuttX_device\"" CACHE STRING "")
set(ADBD_FEATURES "\"cmd\"" CACHE STRING "")
set(ADBD_TCP_SERVER_PORT "5555" CACHE STRING "")
set (ADB_SRCS
adb_main.c
adb_banner.c
adb_client.c
adb_frame.c
hal/hal_uv.c
hal/hal_uv_packet.c
hal/hal_uv_client_tcp.c)
if(ADBD_AUTHENTICATION)
set(ADB_SRCS ${ADB_SRCS} adb_auth_key.c)
# Add RSA library here
endif()
if(ADBD_FILE_SERVICE)
set(ADB_SRCS ${ADB_SRCS} file_sync_service.c)
endif()
if(ADBD_SOCKET_SERVICE)
set(ADB_SRCS ${ADB_SRCS} tcp_service.c hal/hal_uv_socket.c)
endif()
if(ADBD_SHELL_SERVICE)
set(ADB_SRCS ${ADB_SRCS} hal/shell_service_uv.c)
endif()
add_executable(adbd ${ADB_SRCS})
target_compile_definitions(adbd PUBLIC -DCONFIG_ADBD_CNXN_PAYLOAD_SIZE=${ADBD_CNXN_PAYLOAD_SIZE})
target_compile_definitions(adbd PUBLIC -DCONFIG_ADBD_PAYLOAD_SIZE=${ADBD_PAYLOAD_SIZE})
target_compile_definitions(adbd PUBLIC -DCONFIG_ADBD_FRAME_MAX=${ADBD_FRAME_MAX})
target_compile_definitions(adbd PUBLIC -DCONFIG_ADBD_DEVICE_ID=${ADBD_DEVICE_ID})
target_compile_definitions(adbd PUBLIC -DCONFIG_ADBD_PRODUCT_NAME=${ADBD_PRODUCT_NAME})
target_compile_definitions(adbd PUBLIC -DCONFIG_ADBD_PRODUCT_MODEL=${ADBD_PRODUCT_MODEL})
target_compile_definitions(adbd PUBLIC -DCONFIG_ADBD_PRODUCT_DEVICE=${ADBD_PRODUCT_DEVICE})
target_compile_definitions(adbd PUBLIC -DCONFIG_ADBD_FEATURES=${ADBD_FEATURES})
target_compile_definitions(adbd PUBLIC -DCONFIG_ADBD_TCP_SERVER="y")
target_compile_definitions(adbd PUBLIC -DCONFIG_ADBD_TCP_SERVER_PORT=${ADBD_TCP_SERVER_PORT})
if(ADBD_AUTHENTICATION)
target_compile_definitions(adbd PUBLIC -DCONFIG_ADBD_AUTHENTICATION=1)
target_compile_definitions(adbd PUBLIC -DCONFIG_ADBD_TOKEN_SIZE=${ADBD_TOKEN_SIZE})
if (ADBD_AUTH_PUBKEY)
target_compile_definitions(adbd PUBLIC -DCONFIG_ADBD_AUTH_PUBKEY=1)
endif()
endif()
if(ADBD_FILE_SERVICE)
target_compile_definitions(adbd PUBLIC -DCONFIG_ADBD_FILE_SERVICE=1)
endif()
if(ADBD_SOCKET_SERVICE)
target_compile_definitions(adbd PUBLIC -DCONFIG_ADBD_SOCKET_SERVICE=1)
endif()
if(ADBD_SHELL_SERVICE)
target_compile_definitions(adbd PUBLIC -DCONFIG_ADBD_SHELL_SERVICE=1)
target_compile_definitions(adbd PUBLIC
-DCONFIG_ADBD_SHELL_SERVICE_PATH="${ADBD_SHELL_SERVICE_PATH}")
target_compile_definitions(adbd PUBLIC
-DCONFIG_ADBD_SHELL_SERVICE_CMD="${ADBD_SHELL_SERVICE_CMD}")
endif()
target_include_directories(adbd PRIVATE "${CMAKE_SOURCE_DIR}")
target_link_libraries(adbd uv)