feat(examples): Add cmake compiler script for examples

This commit is contained in:
dongheng
2019-05-07 14:46:24 +08:00
parent cca13e0f99
commit 268e9d5846
72 changed files with 315 additions and 7 deletions

View File

@ -0,0 +1,6 @@
# The following four lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(project_template)

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCDIRS "folder1" "folder2")
register_component()

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCS "user_main.c")
register_component()

View File

@ -0,0 +1,6 @@
# The following four lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(adc)

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCS "adc_example_main.c")
register_component()

View File

@ -0,0 +1,6 @@
# The following four lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(gpio)

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCS "user_main.c")
register_component()

View File

@ -0,0 +1,6 @@
# The following four lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(hw_timer)

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCS "hw_timer_example_main.c")
register_component()

View File

@ -0,0 +1,6 @@
# The following four lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(i2c)

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCS "user_main.c")
register_component()

View File

@ -0,0 +1,6 @@
# The following four lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(i2s)

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCS "i2s_example_main.c")
register_component()

View File

@ -0,0 +1,6 @@
# The following four lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(pwm)

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCS "pwm_example_main.c")
register_component()

View File

@ -0,0 +1,6 @@
# The following four lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(spi_master)

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCS "spi_master_example_main.c")
register_component()

View File

@ -0,0 +1,6 @@
# The following four lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(spi_oled)

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCS "spi_oled_example_main.c")
register_component()

View File

@ -0,0 +1,6 @@
# The following four lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(spi_slave)

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCS "spi_slave_example_main.c")
register_component()

View File

@ -0,0 +1,6 @@
# The following four lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(uart_echo)

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCS "uart_echo_example_main.c")
register_component()

View File

@ -0,0 +1,6 @@
# The following four lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(uart_event)

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCS "uart_events_example_main.c")
register_component()

View File

@ -0,0 +1,6 @@
# The following four lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(subscribe_publish)

View File

@ -0,0 +1,11 @@
set(COMPONENT_SRCS "subscribe_publish_sample.c")
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()
if(CONFIG_EXAMPLE_EMBEDDED_CERTS)
target_add_binary_data(${COMPONENT_NAME} "certs/aws-root-ca.pem" TEXT)
target_add_binary_data(${COMPONENT_NAME} "certs/certificate.pem.crt" TEXT)
target_add_binary_data(${COMPONENT_NAME} "certs/private.pem.key" TEXT)
endif()

View File

@ -0,0 +1,6 @@
# The following four lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(thing_shadow)

View File

@ -0,0 +1,11 @@
set(COMPONENT_SRCS "thing_shadow_sample.c")
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()
if(CONFIG_EXAMPLE_EMBEDDED_CERTS)
target_add_binary_data(${COMPONENT_NAME} "certs/aws-root-ca.pem" TEXT)
target_add_binary_data(${COMPONENT_NAME} "certs/certificate.pem.crt" TEXT)
target_add_binary_data(${COMPONENT_NAME} "certs/private.pem.key" TEXT)
endif()

View File

@ -2,7 +2,5 @@
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
set(MAIN_SRCS main/coap_client_example_main.c)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(coap_client)

View File

@ -0,0 +1,4 @@
set(COMPONENT_SRCS "coap_client_example_main.c")
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()

View File

@ -2,7 +2,5 @@
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
set(MAIN_SRCS main/coap_server_example_main.c)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(coap_server)

View File

@ -0,0 +1,4 @@
set(COMPONENT_SRCS "coap_server_example_main.c")
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()

View File

@ -1,2 +1,3 @@
CONFIG_BROKER_URI="mqtts://${EXAMPLE_MQTT_BROKER_SSL}"
CONFIG_BROKER_CERTIFICATE_OVERRIDE="${EXAMPLE_MQTT_BROKER_CERTIFICATE}"
CONFIG_MQTT_USING_ESP=y

View File

@ -0,0 +1 @@
CONFIG_MQTT_USING_ESP=y

View File

@ -0,0 +1 @@
CONFIG_MQTT_USING_ESP=y

View File

@ -1,2 +1,3 @@
CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y
CONFIG_BROKER_URL="FROM_STDIN"
CONFIG_MQTT_USING_ESP=y

View File

@ -0,0 +1 @@
CONFIG_MQTT_USING_ESP=y

View File

@ -1 +1,2 @@
CONFIG_BROKER_URI="ws://${EXAMPLE_MQTT_BROKER_WS}/ws"
CONFIG_MQTT_USING_ESP=y

View File

@ -0,0 +1 @@
CONFIG_MQTT_USING_ESP=y

View File

@ -1,3 +1,3 @@
CONFIG_BROKER_URI="wss://${EXAMPLE_MQTT_BROKER_WSS}/ws"
CONFIG_BROKER_CERTIFICATE_OVERRIDE="${EXAMPLE_MQTT_BROKER_CERTIFICATE}"
CONFIG_MQTT_USING_ESP=y

View File

@ -0,0 +1 @@
CONFIG_MQTT_USING_ESP=y

View File

@ -0,0 +1,6 @@
# The following five lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(http_request)

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCS "http_request_example_main.c")
register_component()

View File

@ -22,7 +22,7 @@ struct async_resp_arg {
esp_err_t hello_get_handler(httpd_req_t *req)
{
#define STR "Hello World!"
ESP_LOGI(TAG, "Free Stack for server task: '%d'", uxTaskGetStackHighWaterMark(NULL));
ESP_LOGI(TAG, "Free Stack for server task: '%ld'", uxTaskGetStackHighWaterMark(NULL));
httpd_resp_send(req, STR, strlen(STR));
return ESP_OK;
#undef STR

View File

@ -0,0 +1,6 @@
# The following five lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(https_mbedtls)

View File

@ -0,0 +1,8 @@
set(COMPONENT_SRCS "https_mbedtls_example_main.c")
# Embed the server root certificate into the final binary
#
# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.)
set(COMPONENT_EMBED_TXTFILES server_root_cert.pem)
register_component()

View File

@ -0,0 +1,6 @@
# The following five lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(https_wolfssl)

View File

@ -0,0 +1,10 @@
set(COMPONENT_SRCS "https_wolfssl_example_main.c")
set(COMPONENT_ADD_INCLUDEDIRS ".")
# Embed the server root certificate into the final binary
#
# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.)
set(COMPONENT_EMBED_TXTFILES server_root_cert.pem)
register_component()

View File

@ -0,0 +1,6 @@
# The following four lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(ibm-mqtt)

View File

@ -0,0 +1,4 @@
set(COMPONENT_SRCS "MQTTEcho.c")
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()

View File

@ -0,0 +1,6 @@
# The following five lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(mdns)

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCS "mdns_example_main.c")
register_component()

View File

@ -0,0 +1,6 @@
# The following five lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(openssl_client)

View File

@ -0,0 +1,8 @@
set(COMPONENT_SRCS "openssl_client_example_main.c")
# Embed the server root certificate into the final binary
#
# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.)
set(COMPONENT_EMBED_TXTFILES "client.pem" "client.key" "ca.pem")
register_component()

View File

@ -3,7 +3,7 @@
# project subdirectory.
#
PROJECT_NAME := openssl
PROJECT_NAME := openssl_demo
include $(IDF_PATH)/make/project.mk

View File

@ -0,0 +1,6 @@
# The following five lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(openssl_server)

View File

@ -0,0 +1,8 @@
set(COMPONENT_SRCS "openssl_server_example_main.c")
# Embed the server root certificate into the final binary
#
# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.)
set(COMPONENT_EMBED_TXTFILES "server.pem" "server.key" "ca.pem")
register_component()

View File

@ -0,0 +1,6 @@
# The following five lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(sntp)

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCS "sntp_example_main.c")
register_component()

View File

@ -0,0 +1,6 @@
# The following lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(native_ota)

View File

@ -0,0 +1,4 @@
set(COMPONENT_SRCS "ota_example_main.c")
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()

View File

@ -0,0 +1,6 @@
# The following four lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(espnow)

View File

@ -0,0 +1,4 @@
set(COMPONENT_ADD_INCLUDEDIRS .)
set(COMPONENT_SRCS "espnow_example_main.c")
register_component()

View File

@ -0,0 +1,6 @@
# The following four lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(simple_wifi)

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCS "simple_wifi.c")
register_component()

View File

@ -0,0 +1,6 @@
# The following four lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(smart_config)

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCS "smartconfig_main.c")
register_component()

View File

@ -0,0 +1,6 @@
# The following four lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(sniffer)

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCS "sniffer_main.c")
register_component()

View File

@ -0,0 +1,6 @@
# The following four lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(wps)

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCS "wps.c")
register_component()