forked from micro-ROS/micro_ros_raspberrypi_pico_sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·84 lines (67 loc) · 2.46 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
cmake_minimum_required(VERSION 3.12)
# include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
set(PICO_W_CMAKE_FILE_PATH ${CMAKE_SOURCE_DIR}/pico_w-config.cmake)
if(EXISTS ${PICO_W_CMAKE_FILE_PATH})
message(STATUS "bootstrap local config via ${PICO_W_CMAKE_FILE_PATH}")
include(${PICO_W_CMAKE_FILE_PATH})
else()
message(FATAL_ERROR "Pico w project cmake file not found. Please create ${PICO_W_CMAKE_FILE_PATH}")
endif()
# Initialize the SDK
include(pico_sdk_import.cmake)
project(pico_micro_ros_example C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
pico_sdk_init()
link_directories(libmicroros)
add_executable(pico_micro_ros_example
pico_micro_ros_example.c
pico_uart_transport.c
)
target_link_libraries(pico_micro_ros_example
pico_stdlib
microros
)
target_include_directories(pico_micro_ros_example PUBLIC
libmicroros/include
)
add_executable(pico_micro_ros_udp_example
pico_micro_ros_udp_example.c
picow_udp_transports.c
)
target_link_libraries(pico_micro_ros_udp_example
pico_stdlib
hardware_adc
# pico_cyw43_arch_none
pico_cyw43_arch_lwip_poll
# pico_cyw43_arch_lwip_threadsafe_background
microros
)
target_include_directories(pico_micro_ros_udp_example PUBLIC
libmicroros/include
include
)
message("Microros config:")
message(STATUS "PICO_BOARD: ${PICO_BOARD}")
message(STATUS "WIFI_SSID: ${WIFI_SSID}")
message(STATUS "ROS_AGENT_IP_ADDR: ${ROS_AGENT_IP_ADDR}")
message(STATUS "ROS_AGENT_UDP_PORT: ${ROS_AGENT_UDP_PORT}")
message(STATUS "ROS_DOMAIN_ID: ${ROS_DOMAIN_ID}")
# add_definitions(-DWIFI_SSID="${WIFI_SSID}")
# add_definitions(-DWIFI_PASSWORD="${WIFI_PASSWORD}")
# add_definitions(-DROS_AGENT_IP_ADDR="${ROS_AGENT_IP_ADDR}")
# add_definitions(-DROS_AGENT_UDP_PORT=${ROS_AGENT_UDP_PORT})
# add_definitions(-DROS_DOMAIN_ID=${ROS_DOMAIN_ID})
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections")
# Configure Pico
pico_enable_stdio_usb(pico_micro_ros_example 1)
pico_enable_stdio_uart(pico_micro_ros_example 0)
pico_enable_stdio_usb(pico_micro_ros_udp_example 0)
pico_enable_stdio_uart(pico_micro_ros_udp_example 1)
add_compile_definitions(PICO_UART_ENABLE_CRLF_SUPPORT=0)
add_compile_definitions(PICO_STDIO_ENABLE_CRLF_SUPPORT=0)
add_compile_definitions(PICO_STDIO_DEFAULT_CRLF=0)
# Generate UF2
pico_add_extra_outputs(pico_micro_ros_example)
pico_add_extra_outputs(pico_micro_ros_udp_example)