FreeRTOS / FreeRTOS-Plus-TCP

FreeRTOS-Plus-TCP library repository. +TCP files only. Submoduled into https://github.com/FreeRTOS/FreeRTOS and various other repos.
MIT License
125 stars 149 forks source link

Avoid compilation issues in consumer projects #1139

Closed apcountryman closed 1 month ago

apcountryman commented 2 months ago

Description

As originally discussed in the FreeRTOS Forums, projects that consume FreeRTOS-Plus-TCP are forced to use the compilation options configured by test/build-combination/CMakeLists.txt when compiling freertos_plus_tcp which can cause compilation issues. This PR avoids compilation issues in consumer projects by making processing of test/build-combination/CMakeLists.txt optional:

  1. Added FREERTOS_PLUS_TCP_BUILD_BUILD_TEST option to control whether test/build-combination/CMakeLists.txt is processed. Updated .github/workflows/ci.yml build-checks job and test/build-combination/README.md to reflect the addition of this new option.
  2. Moved FREERTOS_PLUS_TCP_TEST_CONFIGURATION cache variable configuration/validation to test/build-combination/CMakeLists.txt since it is now only needed if FREERTOS_PLUS_TCP_BUILD_BUILD_TEST is ON. Updated comments to reflect changes.
  3. Moved configuration of the C standard used to compile freertos_plus_tcp to test/build-combination/CMakeLists.txt so that projects that consume FreeRTOS-Plus-TCP can control the C standard they use when compiling freertos_plus_tcp.

The following changes were considered but are not currently implemented in this PR:

  1. Rename the FREERTOS_PLUS_TCP_BUILD_TEST option to FREERTOS_PLUS_TCP_BUILD_UNIT_TEST to better indicate what it controls.
  2. Rename the test/build-combination/ directory to test/build-test/ to better reflect what its contents are for and mirror the test/unit-test/ directory's naming.
  3. Rename the FREERTOS_PLUS_TCP_TEST_CONFIGURATION cache variable to FREERTOS_PLUS_TCP_BUILD_TEST_CONFIGURATION to reflect its association with the new FREERTOS_PLUS_TCP_BUILD_BUILD_TEST option.

Test Steps

Compilation issues were encountered in a private project (see https://forums.freertos.org/t/freertos-plus-tcp-compilation-issues/19825/4) that is built using arm-none-eabi-gcc (9.2.1) for an Arm Cortex-M4F processor. The changes made in this PR have resolved the compilation issues that were encountered in that private project. These changes have also been tested using the instructions in https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/86b16eb1f514574df19a31c78c8937600ba5a81a/test/build-combination/README.md#unix-linux-and-mac and https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/86b16eb1f514574df19a31c78c8937600ba5a81a/test/unit-test/README.md#to-run-the-unit-tests.

Checklist:

Related Issue

None.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.