forked from espressif/esp-idf
fix esp_http_client_example to build for Linux target. Made protocol_examples_common
compatible for Linux target
This commit is contained in:
@@ -4,7 +4,7 @@ if(${target} STREQUAL "linux")
|
|||||||
# Header only library for linux
|
# Header only library for linux
|
||||||
|
|
||||||
idf_component_register(INCLUDE_DIRS include
|
idf_component_register(INCLUDE_DIRS include
|
||||||
PRIV_REQUIRES tapif_io)
|
SRCS protocol_examples_utils.c)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
*/
|
*/
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
*/
|
*/
|
||||||
|
@@ -11,15 +11,18 @@
|
|||||||
|
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
|
#if !CONFIG_IDF_TARGET_LINUX
|
||||||
#include "esp_netif.h"
|
#include "esp_netif.h"
|
||||||
#if CONFIG_EXAMPLE_CONNECT_ETHERNET
|
#if CONFIG_EXAMPLE_CONNECT_ETHERNET
|
||||||
#include "esp_eth.h"
|
#include "esp_eth.h"
|
||||||
#endif
|
#endif
|
||||||
|
#endif // !CONFIG_IDF_TARGET_LINUX
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !CONFIG_IDF_TARGET_LINUX
|
||||||
#if CONFIG_EXAMPLE_CONNECT_WIFI
|
#if CONFIG_EXAMPLE_CONNECT_WIFI
|
||||||
#define EXAMPLE_NETIF_DESC_STA "example_netif_sta"
|
#define EXAMPLE_NETIF_DESC_STA "example_netif_sta"
|
||||||
#endif
|
#endif
|
||||||
@@ -96,6 +99,10 @@ void example_register_wifi_connect_commands(void);
|
|||||||
esp_eth_handle_t get_example_eth_handle(void);
|
esp_eth_handle_t get_example_eth_handle(void);
|
||||||
#endif // CONFIG_EXAMPLE_CONNECT_ETHERNET
|
#endif // CONFIG_EXAMPLE_CONNECT_ETHERNET
|
||||||
|
|
||||||
|
#else
|
||||||
|
static inline esp_err_t example_connect(void) {return ESP_OK;}
|
||||||
|
#endif // !CONFIG_IDF_TARGET_LINUX
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -2,12 +2,12 @@
|
|||||||
# CMakeLists in this exact order for cmake to work correctly
|
# CMakeLists in this exact order for cmake to work correctly
|
||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
|
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
|
||||||
|
|
||||||
if(${IDF_TARGET} STREQUAL "linux")
|
if(${IDF_TARGET} STREQUAL "linux")
|
||||||
set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/"
|
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/"
|
||||||
"$ENV{IDF_PATH}/examples/protocols/linux_stubs/esp_stubs")
|
"$ENV{IDF_PATH}/examples/protocols/linux_stubs/esp_stubs")
|
||||||
set(COMPONENTS main)
|
set(COMPONENTS main)
|
||||||
else()
|
|
||||||
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.)
|
# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.)
|
||||||
set(requires "")
|
set(requires "")
|
||||||
if(${IDF_TARGET} STREQUAL "linux")
|
if(${IDF_TARGET} STREQUAL "linux")
|
||||||
list(APPEND requires esp_stubs esp-tls esp_http_client)
|
list(APPEND requires esp_stubs esp-tls esp_http_client protocol_examples_common)
|
||||||
endif()
|
endif()
|
||||||
idf_component_register(SRCS "esp_http_client_example.c"
|
idf_component_register(SRCS "esp_http_client_example.c"
|
||||||
INCLUDE_DIRS "."
|
INCLUDE_DIRS "."
|
||||||
|
@@ -19,11 +19,6 @@ esp_err_t esp_netif_init(void)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t example_connect(void)
|
|
||||||
{
|
|
||||||
return ESP_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
esp_err_t nvs_flash_init(void)
|
esp_err_t nvs_flash_init(void)
|
||||||
{
|
{
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
@@ -1,8 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
|
||||||
*/
|
|
||||||
#include "esp_err.h"
|
|
||||||
|
|
||||||
esp_err_t example_connect(void);
|
|
Reference in New Issue
Block a user