Skip to content

Commit

Permalink
Reorganize CMakeLists
Browse files Browse the repository at this point in the history
  • Loading branch information
sashacmc committed Dec 2, 2024
1 parent 1fc24ea commit a928f30
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
13 changes: 8 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ if(CMAKE_BUILD_TYPE MATCHES "RELEASE" OR "Release")
add_compile_options(-pipe -O3)
endif()
else()
if(UNIX)
add_compile_options(-c -Wall -Wextra -Werror -Wshadow -Wunused -Wstrict-prototypes -pipe -g -O0)
if(CMAKE_SYSTEM_NAME MATCHES "PICO")
add_compile_options(-c -Wall -Wextra -Wno-unused -Wno-strict-prototypes -pipe -g -O0)
elseif(UNIX)
add_compile_options(-c -Wall -Wextra -Werror -Wshadow -Wunused -Wstrict-prototypes -pipe -g -O0)
# C99 pedantic doesn't like struct anonymous in unix header
if (NOT CMAKE_C_STANDARD STREQUAL "99")
add_compile_options(-Wpedantic)
Expand Down Expand Up @@ -159,7 +161,7 @@ if (NOT CMAKE_BUILD_TYPE MATCHES "RELEASE" OR "Release")
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
endif()

#set(CHECK_THREADS "ON")
set(CHECK_THREADS "ON")

# System definition
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
Expand All @@ -182,9 +184,10 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Generic")
pico_add_compile_definition(ZENOH_ZEPHYR)
elseif(WITH_FREERTOS_PLUS_TCP)
pico_add_compile_definition(ZENOH_FREERTOS_PLUS_TCP)
elseif(WITH_RPI_PICO_W)
pico_add_compile_definition(ZENOH_RPI_PICO_W)
endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "PICO") # Raspberry Pico
pico_add_compile_definition(ZENOH_RPI_PICO_W)
set(CHECK_THREADS "OFF")
else()
message(FATAL_ERROR "zenoh-pico is not yet available on ${CMAKE_SYSTEM_NAME} platform")
return()
Expand Down
24 changes: 17 additions & 7 deletions examples/rpi_pico_w/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
cmake_minimum_required(VERSION 3.13)

set(CMAKE_C_STANDARD 11)

# Include Raspberry Pico SDK
set(PICO_BOARD "pico_w")
if(NOT DEFINED ENV{PICO_SDK_PATH})
message(FATAL_ERROR "PICO_SDK_PATH environment variable is not set. Please set it to the location of the Pico SDK.")
endif()
include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)

# Include FreeRTOS SDK
include(FreeRTOS_Kernel_import.cmake)

include(../../cmake/helpers.cmake)
set_default_build_type(Release)
# Ignore warnings from FreeRTOS code
set_source_files_properties(
${FREERTOS_KERNEL_PATH}/portable/ThirdParty/GCC/RP2040/include/portmacro.h
PROPERTIES
COMPILE_OPTIONS "-Wno-strict-prototypes"
)

# Configure project
project(zenohpico_rpi_pico_w_examples C CXX ASM)

set(CMAKE_SYSTEM_NAME "Generic")
set(CMAKE_C_STANDARD 11)

add_compile_definitions(LWIP_TIMEVAL_PRIVATE=0)
pico_sdk_init()

Expand All @@ -25,11 +31,13 @@ add_executable(zenohpico_rpi_pico_w_examples main.c app_main.c)
pico_enable_stdio_usb(zenohpico_rpi_pico_w_examples 1)
pico_enable_stdio_uart(zenohpico_rpi_pico_w_examples 1)

# Include Zenoh Pico library
include(../../cmake/helpers.cmake)
set_default_build_type(Release)

set(BUILD_SHARED_LIBS OFF)
set(WITH_RPI_PICO_W ON)
set(ZENOH_DEBUG 5)
#add_compile_options(-Wno-strict-prototypes)
#add_compile_options(-Wno-pragmas)
configure_include_project(ZENOHPICO zenohpico zenohpico::lib "../.." zenohpico "https://github.com/eclipse-zenoh/zenoh-pico" "")

target_link_libraries(zenohpico_static
Expand All @@ -38,6 +46,7 @@ target_link_libraries(zenohpico_static
FreeRTOS-Kernel-Heap4
)

# Configure build
target_include_directories(zenohpico_static PRIVATE
${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_LIST_DIR}/..
Expand All @@ -60,3 +69,4 @@ target_link_libraries(zenohpico_rpi_pico_w_examples
)

pico_add_extra_outputs(zenohpico_rpi_pico_w_examples)

1 change: 1 addition & 0 deletions src/system/rpi_pico_w/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ z_result_t _z_listen_udp_unicast(_z_sys_net_socket_t *sock, const _z_sys_net_end
(void)sock;
(void)lep;
(void)tout;
z_result_t ret = _Z_RES_OK;

// @TODO: To be implemented
ret = _Z_ERR_GENERIC;
Expand Down

0 comments on commit a928f30

Please sign in to comment.