Merge branch 'fix/add_libbsd_string_h' into 'master'

refactor(linux): Unified libbsd handling

See merge request espressif/esp-idf!29457
This commit is contained in:
Jakob Hasse
2024-03-21 10:11:25 +08:00
20 changed files with 61 additions and 83 deletions

View File

@@ -35,13 +35,3 @@ idf_component_register(SRCS ${srcs}
PRIV_REQUIRES esp_driver_uart
esp_driver_usb_serial_jtag
)
if(${target} STREQUAL "linux")
# link bsd library for strlcpy
find_library(LIB_BSD bsd)
if(LIB_BSD)
target_link_libraries(${COMPONENT_LIB} PRIVATE ${LIB_BSD})
elseif(NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
message(WARNING "Missing LIBBSD library. Install libbsd-dev package and/or check linker directories.")
endif()
endif()

View File

@@ -6,10 +6,6 @@
#include <stdio.h>
#include <string.h>
#if __has_include(<bsd/string.h>)
// for strlcpy
#include <bsd/string.h>
#endif
#include <stdlib.h>
#include <sys/param.h>
#include "esp_heap_caps.h"

View File

@@ -1,17 +1,15 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "sdkconfig.h"
#include <sys/cdefs.h> // __containerof
#include "esp_console.h"
#include "console_private.h"
#include "esp_log.h"
#include "linenoise/linenoise.h"
#if CONFIG_IDF_TARGET_LINUX
#include "esp_linux_helper.h" // __containerof
#endif
static const char *TAG = "console.common";

View File

@@ -12,10 +12,10 @@
#include <termios.h>
#include <string.h>
#include <assert.h>
#include <sys/cdefs.h>
#include "sdkconfig.h"
#include "esp_log.h"
#include "esp_linux_helper.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"