Skip to content

Combine CMake Build System#237

Merged
szczys merged 9 commits into
mainfrom
szczys/standard-cmake
Jun 26, 2026
Merged

Combine CMake Build System#237
szczys merged 9 commits into
mainfrom
szczys/standard-cmake

Conversation

@szczys

@szczys szczys commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Centralize the build for both ESP-IDF and Zephyr to begin at the root CMakeLists.txt file. Include port-specific CMakeLists.txt files for port layer and transports. All common code is included in the using standard cmake (target_sources, etc) with add_subdirectory and Kconfig guards.

Add the idf_component.yml necessary to use this as a (publishable) ESP-IDF component.

Because the gateway code is not yet cross-platform, those cmake files were left untouched.

Manual testing

  • esp_idf/ble_gatt
  • esp_idf/http_client
  • zephyr/ble_gatt
  • zephyr/coap_client
  • zephyr/http_client
  • zephyr/gateway

resolves: https://github.com/golioth/firmware-issue-tracker/issues/992
resolves: https://github.com/golioth/firmware-issue-tracker/issues/973

@szczys szczys force-pushed the szczys/standard-cmake branch 6 times, most recently from 3020b79 to a98119c Compare June 12, 2026 22:37
@szczys szczys changed the title Szczys/standard cmake Combine CMake Build System Jun 13, 2026
@szczys szczys marked this pull request as ready for review June 13, 2026 00:30
@szczys szczys force-pushed the szczys/golioth_sdk_modularize branch from d713f91 to c4b31f8 Compare June 15, 2026 15:40
@szczys szczys force-pushed the szczys/standard-cmake branch from a98119c to 05b543a Compare June 15, 2026 16:08
@szczys szczys force-pushed the szczys/standard-cmake branch from 05b543a to ca20b9d Compare June 17, 2026 14:13
@szczys szczys changed the base branch from szczys/golioth_sdk_modularize to main June 17, 2026 14:48
szczys added 9 commits June 17, 2026 13:35
Add a check and error message in the esp-idf zcbor library wrapper that
makes it more obvious when a build failed due to a missing submodule.

Signed-off-by: Mike Szczys <michael.szczys@canonical.com>
Clean up unknown config warning. This symbol is used in Zephyr but on
ESP-IDF.

Signed-off-by: Mike Szczys <michael.szczys@canonical.com>
The example build command for using WiFi with the frdm_rw612 was missing
the sysbuild flag.

Signed-off-by: Mike Szczys <michael.szczys@canonical.com>
CONFIG_NET_CONNECTION_MANAGER_CONNECTIVITY_WIFI_MGMT is unused in the coap
and http samples. Remove from the extra wifi config to resolve warning.

Signed-off-by: Mike Szczys <michael.szczys@canonical.com>
Prepare for build system reorganization by making the Segmentation and
Reassembly (SAR) system configurable via POUCH_TRANSPORT_SAR so that it may
be built separately from gatt-related endpoint code. This is specifically
needed for tests/pouch/transport, but SAR should also be available for
future transport implementations besides gatt.

Signed-off-by: Mike Szczys <michael.szczys@canonical.com>
client.h was including pouch/pouch.h which in tern includes PSA crypto
headers. These headers are not needed in the port transport files and were
causing linking errors with ESP-IDF.

Signed-off-by: Mike Szczys <michael.szczys@canonical.com>
Consolidate the build system used by ESP-IDF and Zephyr, with an emphasis
of using shared standard cmake as much as possible. The approach taken
starts the build for both platforms in the root CMakeLists.txt, includes
port-specific cmake files, then finishes the build using chains of
add_subdirectory() calls. Code inclusion is guarded based on Kconfig
symbols.

Note that the gateway code is not yet cross-platform and has not been
included in this work, but the existing build system for the gateway code
remains stable.

Signed-off-by: Mike Szczys <michael.szczys@canonical.com>
This doesn't change behavior, but resolves build warnings like:

Source file '/__w/pouch/pouch/tests/esp_idf/port/tests/test_msgq.c' belongs
to component pouch but is being built by component main.

Signed-off-by: Mike Szczys <michael.szczys@canonical.com>
Remove POUCH_SERVER_CERT_MAX_LEN, POUCH_VALIDATE_SERVER_CERT,
POUCH_SERVER_CERT_CN, and POUCH_CA_CERT_FILENAME definitions from
port/zephyr/Kconfig. They are also defined in src/saead/Kconfig which is
included via rsource in the same file.

Signed-off-by: Mike Szczys <michael.szczys@canonical.com>
@szczys szczys force-pushed the szczys/standard-cmake branch from ca20b9d to 326c779 Compare June 17, 2026 18:35
Comment thread cmake/pouch_target.cmake
if(NOT _pouch_encryption_saead)
return()
endif()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Zephyr we could probably do:

if (NOT CONFIG_POUCH_ENCRYPTION_SAEAD)
    return()
endif()

Isn't that the case for ESP-IDF? I just wonder what value does pouch_config_enabled() bring.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem I found is that ESP-IDF sets unselected symbols to "" (empty string):

build/config/sdkconfig.cmake
1486:set(CONFIG_POUCH_DELAYABLE_WORK "")

But in Zephyr the symbol is just not present. I added a helper function that differentiates and sets the true/false to deal with the issue.

@trond-snekvik trond-snekvik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very clean!

Sorry for the delay on this.

@szczys szczys merged commit 0d5e2e0 into main Jun 26, 2026
24 checks passed
@szczys szczys deleted the szczys/standard-cmake branch June 26, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants