From b17444a109987e566ec61b08fb834c3be55aba15 Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Wed, 25 Sep 2024 17:10:37 +0200 Subject: [PATCH] change(examples): switch examples to use a minimal build Currently, several example dependencies rely on the fact that all registered components are added to the build, along with components specified in common requirements. This results in longer build times because even unused components must be built. Switch all examples to use idf_minimal_build to compile only the components actually required by the example. Signed-off-by: Frantisek Hrbata --- examples/protocols/mqtt/custom_outbox/CMakeLists.txt | 2 ++ examples/protocols/mqtt/ssl/CMakeLists.txt | 2 ++ examples/protocols/mqtt/ssl_ds/CMakeLists.txt | 2 ++ examples/protocols/mqtt/ssl_mutual_auth/CMakeLists.txt | 2 ++ examples/protocols/mqtt/ssl_psk/CMakeLists.txt | 2 ++ examples/protocols/mqtt/tcp/CMakeLists.txt | 2 ++ examples/protocols/mqtt/ws/CMakeLists.txt | 2 ++ examples/protocols/mqtt/wss/CMakeLists.txt | 2 ++ examples/protocols/mqtt5/CMakeLists.txt | 2 ++ 9 files changed, 18 insertions(+) diff --git a/examples/protocols/mqtt/custom_outbox/CMakeLists.txt b/examples/protocols/mqtt/custom_outbox/CMakeLists.txt index 4823b13..746ab1c 100644 --- a/examples/protocols/mqtt/custom_outbox/CMakeLists.txt +++ b/examples/protocols/mqtt/custom_outbox/CMakeLists.txt @@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.16) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +# "Trim" the build. Include the minimal set of components, main, and anything it depends on. +idf_build_set_property(MINIMAL_BUILD ON) project(mqtt_tcp_custom_outbox) # Add custom outbox implementation to mqtt component diff --git a/examples/protocols/mqtt/ssl/CMakeLists.txt b/examples/protocols/mqtt/ssl/CMakeLists.txt index 994f2f2..699c86d 100644 --- a/examples/protocols/mqtt/ssl/CMakeLists.txt +++ b/examples/protocols/mqtt/ssl/CMakeLists.txt @@ -4,6 +4,8 @@ cmake_minimum_required(VERSION 3.16) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +# "Trim" the build. Include the minimal set of components, main, and anything it depends on. +idf_build_set_property(MINIMAL_BUILD ON) project(mqtt_ssl) target_add_binary_data(mqtt_ssl.elf "main/mqtt_eclipseprojects_io.pem" TEXT) diff --git a/examples/protocols/mqtt/ssl_ds/CMakeLists.txt b/examples/protocols/mqtt/ssl_ds/CMakeLists.txt index ce04bb0..acf7743 100644 --- a/examples/protocols/mqtt/ssl_ds/CMakeLists.txt +++ b/examples/protocols/mqtt/ssl_ds/CMakeLists.txt @@ -4,6 +4,8 @@ cmake_minimum_required(VERSION 3.16) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +# "Trim" the build. Include the minimal set of components, main, and anything it depends on. +idf_build_set_property(MINIMAL_BUILD ON) project(mqtt_ssl_ds) # Flash the custom partition named `esp_secure_cert`. diff --git a/examples/protocols/mqtt/ssl_mutual_auth/CMakeLists.txt b/examples/protocols/mqtt/ssl_mutual_auth/CMakeLists.txt index fc3d759..67ec43b 100644 --- a/examples/protocols/mqtt/ssl_mutual_auth/CMakeLists.txt +++ b/examples/protocols/mqtt/ssl_mutual_auth/CMakeLists.txt @@ -4,6 +4,8 @@ cmake_minimum_required(VERSION 3.16) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +# "Trim" the build. Include the minimal set of components, main, and anything it depends on. +idf_build_set_property(MINIMAL_BUILD ON) project(mqtt_ssl_mutual_auth) target_add_binary_data(${CMAKE_PROJECT_NAME}.elf "main/client.crt" TEXT) diff --git a/examples/protocols/mqtt/ssl_psk/CMakeLists.txt b/examples/protocols/mqtt/ssl_psk/CMakeLists.txt index d9c1a5f..d30f796 100644 --- a/examples/protocols/mqtt/ssl_psk/CMakeLists.txt +++ b/examples/protocols/mqtt/ssl_psk/CMakeLists.txt @@ -4,4 +4,6 @@ cmake_minimum_required(VERSION 3.16) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +# "Trim" the build. Include the minimal set of components, main, and anything it depends on. +idf_build_set_property(MINIMAL_BUILD ON) project(mqtt_ssl_psk) diff --git a/examples/protocols/mqtt/tcp/CMakeLists.txt b/examples/protocols/mqtt/tcp/CMakeLists.txt index d6d9432..d6f01d8 100644 --- a/examples/protocols/mqtt/tcp/CMakeLists.txt +++ b/examples/protocols/mqtt/tcp/CMakeLists.txt @@ -4,4 +4,6 @@ cmake_minimum_required(VERSION 3.16) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +# "Trim" the build. Include the minimal set of components, main, and anything it depends on. +idf_build_set_property(MINIMAL_BUILD ON) project(mqtt_tcp) diff --git a/examples/protocols/mqtt/ws/CMakeLists.txt b/examples/protocols/mqtt/ws/CMakeLists.txt index 475dd9e..bc5e2f1 100644 --- a/examples/protocols/mqtt/ws/CMakeLists.txt +++ b/examples/protocols/mqtt/ws/CMakeLists.txt @@ -4,4 +4,6 @@ cmake_minimum_required(VERSION 3.16) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +# "Trim" the build. Include the minimal set of components, main, and anything it depends on. +idf_build_set_property(MINIMAL_BUILD ON) project(mqtt_websocket) diff --git a/examples/protocols/mqtt/wss/CMakeLists.txt b/examples/protocols/mqtt/wss/CMakeLists.txt index 20c1fde..158bc62 100644 --- a/examples/protocols/mqtt/wss/CMakeLists.txt +++ b/examples/protocols/mqtt/wss/CMakeLists.txt @@ -4,6 +4,8 @@ cmake_minimum_required(VERSION 3.16) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +# "Trim" the build. Include the minimal set of components, main, and anything it depends on. +idf_build_set_property(MINIMAL_BUILD ON) project(mqtt_websocket_secure) target_add_binary_data(mqtt_websocket_secure.elf "main/mqtt_eclipseprojects_io.pem" TEXT) diff --git a/examples/protocols/mqtt5/CMakeLists.txt b/examples/protocols/mqtt5/CMakeLists.txt index 19304b4..fe8bdc9 100644 --- a/examples/protocols/mqtt5/CMakeLists.txt +++ b/examples/protocols/mqtt5/CMakeLists.txt @@ -4,4 +4,6 @@ cmake_minimum_required(VERSION 3.16) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +# "Trim" the build. Include the minimal set of components, main, and anything it depends on. +idf_build_set_property(MINIMAL_BUILD ON) project(mqtt5)