-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
134 lines (124 loc) · 3.96 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
add_library(usb_stack STATIC)
add_library(usb_stack::usb_stack ALIAS usb_stack)
if (MUDITA_USB_ID)
set (USB_DEVICE_VENDOR_ID 0x3310 CACHE INTERNAL "Sets USB_DEVICE_VENDOR_ID to Mudita Vendor ID")
if (${PRODUCT} STREQUAL "PurePhone")
if (ENABLE_USB_MTP)
set (USB_DEVICE_PRODUCT_ID 0x0100 CACHE INTERNAL "Sets USB_DEVICE_PRODUCT_ID to Mudita Pure Product ID")
else()
set (USB_DEVICE_PRODUCT_ID 0x0102 CACHE INTERNAL "Sets USB_DEVICE_PRODUCT_ID to Mudita Pure (non-MTP) Product ID")
endif()
elseif (${PRODUCT} STREQUAL "BellHybrid")
set (USB_DEVICE_PRODUCT_ID 0x0300 CACHE INTERNAL "Sets USB_DEVICE_PRODUCT_ID to Mudita Harmony Product ID")
else ()
message (FATAL_ERROR "Unknown product: ${PRODUCT}")
endif ()
else()
set (USB_DEVICE_VENDOR_ID 0x045E CACHE INTERNAL "Sets USB_DEVICE_VENDOR_ID to Microsoft Vendor ID")
set (USB_DEVICE_PRODUCT_ID 0x0622 CACHE INTERNAL "Sets USB_DEVICE_PRODUCT_ID to Windows MTP Simulator Product ID")
endif()
if (ENABLE_USB_TASK)
set (ENABLE_USB_DEVICE_TASK 1 CACHE INTERNAL "Turn device task in USB stack ON")
else()
set (ENABLE_USB_DEVICE_TASK 0 CACHE INTERNAL "Turn device task in USB stack OFF")
endif()
option(USB_ENABLE_LOGS "Enable logs" OFF)
target_compile_definitions(usb_stack
PRIVATE
USB_DEVICE_VENDOR_ID=${USB_DEVICE_VENDOR_ID}
USB_DEVICE_PRODUCT_ID=${USB_DEVICE_PRODUCT_ID}
USB_DEVICE_CONFIG_MTP=$<BOOL:${ENABLE_USB_MTP}>
USB_DEVICE_CONFIG_USE_TASK=$<BOOL:${ENABLE_USB_DEVICE_TASK}>
$<$<BOOL:${USB_ENABLE_LOGS}>:USB_ENABLE_LOGS>
)
target_sources(usb_stack
PRIVATE
cdc/usb_device_cdc_acm.c
cdc/virtual_com.c
component/lists/generic_list.c
component/osa/fsl_os_abstraction_free_rtos.c
composite.c
dcd/usb_phydcd.c
device/ehci/usb_device_ehci.c
device/usb_device_ch9.c
device/usb_device_class.c
device/usb_device_dci.c
device/usb_string_descriptor.c
phy/usb_phy.c
usb_device_descriptor.c
usb.cpp
PUBLIC
cdc/usb_device_cdc_acm.h
cdc/virtual_com.h
component/lists/generic_list.h
component/osa/fsl_os_abstraction_config.h
component/osa/fsl_os_abstraction_free_rtos.h
component/osa/fsl_os_abstraction.h
composite.h
dcd/usb_charger_detect.h
dcd/usb_phydcd_config.h
dcd/usb_phydcd.h
device/ehci/usb_device_ehci.h
device/usb_device_ch9.h
device/usb_device_class.h
device/usb_device_dci.h
device/usb_device.h
device/usb_misc.h
device/usb_spec.h
device/usb_string_descriptor.h
device/usb.h
phy/usb_phy.h
usb_device_config.h
usb_device_descriptor.h
pure/usb_strings.h
bell/usb_strings.h
)
if (ENABLE_USB_MTP)
target_sources(usb_stack
PRIVATE
mtp/libmtp/mtp_container.c
mtp/libmtp/mtp_dataset.c
mtp/libmtp/mtp_responder.c
mtp/libmtp/mtp_storage.c
mtp/libmtp/mtp_util.c
mtp/mtp_db.cpp
mtp/mtp_fs.cpp
mtp/mtp.c
mtp/usb_device_mtp.c
)
endif()
target_include_directories(usb_stack
PUBLIC
$<BUILD_INTERFACE:
.
cdc
component/lists
component/osa
dcd
device
device/ehci
phy
>
PRIVATE
$<BUILD_INTERFACE:
$<$<STREQUAL:${PRODUCT},PurePhone>:${CMAKE_CURRENT_SOURCE_DIR}/pure>
$<$<STREQUAL:${PRODUCT},BellHybrid>:${CMAKE_CURRENT_SOURCE_DIR}/bell>
>
)
if (ENABLE_USB_MTP)
target_include_directories(usb_stack
PUBLIC
$<BUILD_INTERFACE:
mtp
mtp/libmtp
>
)
endif()
target_link_libraries(usb_stack
PRIVATE
$<$<BOOL:${USB_ENABLE_LOGS}>:log-api>
module-vfs
PUBLIC
module-bsp
module-os
)