Skip to content

Commit

Permalink
Avoid compilation issues in consumer projects (#1139)
Browse files Browse the repository at this point in the history
* Avoid compilation issues in consumer projects

* Improve option name per review feedback

---------

Co-authored-by: Monika Singh <moninom@amazon.com>
Co-authored-by: Tony Josi <tonyjosi@amazon.com>
  • Loading branch information
3 people committed May 8, 2024
1 parent 0b9a497 commit a4295d3
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 44 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Expand Up @@ -170,7 +170,7 @@ jobs:
# ${{ env.stepName }}
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL
cmake -S . -B build -DFREERTOS_PLUS_TCP_ENABLE_BUILD_CHECKS=ON -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL
cmake --build build --target freertos_plus_tcp_build_test
echo "::endgroup::"
Expand All @@ -183,7 +183,7 @@ jobs:
# ${{ env.stepName }}
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL_IPV4
cmake -S . -B build -DFREERTOS_PLUS_TCP_ENABLE_BUILD_CHECKS=ON -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL_IPV4
cmake --build build --target clean
cmake --build build --target freertos_plus_tcp_build_test
Expand All @@ -197,7 +197,7 @@ jobs:
# ${{ env.stepName }}
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL_IPV6
cmake -S . -B build -DFREERTOS_PLUS_TCP_ENABLE_BUILD_CHECKS=ON -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL_IPV6
cmake --build build --target freertos_plus_tcp_build_test
echo "::endgroup::"
Expand All @@ -210,7 +210,7 @@ jobs:
# ${{ env.stepName }}
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL_IPV4_IPV6
cmake -S . -B build -DFREERTOS_PLUS_TCP_ENABLE_BUILD_CHECKS=ON -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL_IPV4_IPV6
cmake --build build --target clean
cmake --build build --target freertos_plus_tcp_build_test
Expand All @@ -224,7 +224,7 @@ jobs:
# ${{ env.stepName }}
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL_IPV4_TCP
cmake -S . -B build -DFREERTOS_PLUS_TCP_ENABLE_BUILD_CHECKS=ON -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL_IPV4_TCP
cmake --build build --target clean
cmake --build build --target freertos_plus_tcp_build_test
Expand All @@ -238,7 +238,7 @@ jobs:
# ${{ env.stepName }}
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL_IPV6_TCP
cmake -S . -B build -DFREERTOS_PLUS_TCP_ENABLE_BUILD_CHECKS=ON -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL_IPV6_TCP
cmake --build build --target freertos_plus_tcp_build_test
echo "::endgroup::"
Expand All @@ -251,7 +251,7 @@ jobs:
# ${{ env.stepName }}
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DISABLE_ALL
cmake -S . -B build -DFREERTOS_PLUS_TCP_ENABLE_BUILD_CHECKS=ON -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DISABLE_ALL
cmake --build build --target clean
cmake --build build --target freertos_plus_tcp_build_test
Expand All @@ -265,7 +265,7 @@ jobs:
# ${{ env.stepName }}
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DEFAULT_CONF
cmake -S . -B build -DFREERTOS_PLUS_TCP_ENABLE_BUILD_CHECKS=ON -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DEFAULT_CONF
cmake --build build --target clean
cmake --build build --target freertos_plus_tcp_build_test
Expand All @@ -276,7 +276,7 @@ jobs:
stepName: Build checks (Header Self Contain)
shell: bash
run: |
cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=HEADER_SELF_CONTAIN
cmake -S . -B build -DFREERTOS_PLUS_TCP_ENABLE_BUILD_CHECKS=ON -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=HEADER_SELF_CONTAIN
cmake --build build --target clean
cmake --build build --target freertos_plus_tcp_build_test_FreeRTOS_DHCP
cmake --build build --target freertos_plus_tcp_build_test_FreeRTOS_DNS
Expand Down
27 changes: 1 addition & 26 deletions CMakeLists.txt
Expand Up @@ -20,6 +20,7 @@ endif()

# Options
option(FREERTOS_PLUS_TCP_BUILD_TEST "Build the test for FreeRTOS Plus TCP" OFF)
option(FREERTOS_PLUS_TCP_ENABLE_BUILD_CHECKS "Enable the build checks for FreeRTOS-Plus-TCP" OFF)

# Configuration
# Override these at project level with:
Expand Down Expand Up @@ -149,32 +150,6 @@ endif()
# There is also the need to add a target - typically an interface library that describes the
# Configuration for FreeRTOS-Kernel and FreeRTOS-Plus-TCP.
# This is called freertos_config
# If not defined will be default compile with one of the test build combinations AllEnable.

# Select the appropriate Build Test configuration
# This is only used when freertos_config is not defined, otherwise the build test will be performed
# on the config defined in the freertos_config
set(FREERTOS_PLUS_TCP_TEST_CONFIGURATION "CUSTOM" CACHE STRING "FreeRTOS Plus TCP Build Test configuration")
set(FREERTOS_PLUS_TCP_TEST_CONFIGURATION_LIST
CUSTOM # Custom (external) configuration -eg from a top-level project
ENABLE_ALL # Enable all configuration settings
ENABLE_ALL_IPV4 # Enable all configuration settings IPv4 UDP
ENABLE_ALL_IPV6 # Enable all configuration settings IPv6 UDP
ENABLE_ALL_IPV4_TCP # Enable all configuration settings IPv4 TCP
ENABLE_ALL_IPV6_TCP # Enable all configuration settings IPv6 TCP
ENABLE_ALL_IPV4_IPV6 # Enable all configuration settings IPv4 IPv6 UDP
DISABLE_ALL # Disable all configuration settings
HEADER_SELF_CONTAIN # Enable header self contain test
DEFAULT_CONF # Default (typical) configuration
)
if(NOT FREERTOS_PLUS_TCP_TEST_CONFIGURATION IN_LIST FREERTOS_PLUS_TCP_TEST_CONFIGURATION_LIST)
message(FATAL_ERROR "Invalid FREERTOS_PLUS_TCP_TEST_CONFIGURATION value '${FREERTOS_PLUS_TCP_TEST_CONFIGURATION}' should be one of: ${FREERTOS_PLUS_TCP_TEST_CONFIGURATION_LIST}")
else()
message(STATUS "Using FreeRTOS-Plus-TCP Test Configuration : ${FREERTOS_PLUS_TCP_TEST_CONFIGURATION}")
if (NOT FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "CUSTOM")
message(WARNING "FreeRTOS-Kernel configuration settings are configured by FreeRTOS-Plus-TCP")
endif()
endif()

########################################################################
# External Dependencies
Expand Down
2 changes: 0 additions & 2 deletions source/CMakeLists.txt
@@ -1,7 +1,5 @@
add_library( freertos_plus_tcp STATIC )

set_property(TARGET freertos_plus_tcp PROPERTY C_STANDARD 90)

target_sources( freertos_plus_tcp
PRIVATE
include/FreeRTOS_ARP.h
Expand Down
4 changes: 3 additions & 1 deletion test/CMakeLists.txt
@@ -1,4 +1,6 @@
add_subdirectory(build-combination)
if(FREERTOS_PLUS_TCP_ENABLE_BUILD_CHECKS)
add_subdirectory(build-combination)
endif()

if(FREERTOS_PLUS_TCP_BUILD_TEST)
add_subdirectory(Coverity)
Expand Down
24 changes: 24 additions & 0 deletions test/build-combination/CMakeLists.txt
@@ -1,3 +1,26 @@
# Select the appropriate Build Test configuration
set(FREERTOS_PLUS_TCP_TEST_CONFIGURATION "CUSTOM" CACHE STRING "FreeRTOS Plus TCP Build Test configuration")
set(FREERTOS_PLUS_TCP_TEST_CONFIGURATION_LIST
CUSTOM # Custom (external) configuration -eg from a top-level project
ENABLE_ALL # Enable all configuration settings
ENABLE_ALL_IPV4 # Enable all configuration settings IPv4 UDP
ENABLE_ALL_IPV6 # Enable all configuration settings IPv6 UDP
ENABLE_ALL_IPV4_TCP # Enable all configuration settings IPv4 TCP
ENABLE_ALL_IPV6_TCP # Enable all configuration settings IPv6 TCP
ENABLE_ALL_IPV4_IPV6 # Enable all configuration settings IPv4 IPv6 UDP
DISABLE_ALL # Disable all configuration settings
HEADER_SELF_CONTAIN # Enable header self contain test
DEFAULT_CONF # Default (typical) configuration
)
if(NOT FREERTOS_PLUS_TCP_TEST_CONFIGURATION IN_LIST FREERTOS_PLUS_TCP_TEST_CONFIGURATION_LIST)
message(FATAL_ERROR "Invalid FREERTOS_PLUS_TCP_TEST_CONFIGURATION value '${FREERTOS_PLUS_TCP_TEST_CONFIGURATION}' should be one of: ${FREERTOS_PLUS_TCP_TEST_CONFIGURATION_LIST}")
else()
message(STATUS "Using FreeRTOS-Plus-TCP Test Configuration : ${FREERTOS_PLUS_TCP_TEST_CONFIGURATION}")
if (NOT FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "CUSTOM")
message(WARNING "FreeRTOS-Kernel configuration settings are configured by FreeRTOS-Plus-TCP")
endif()
endif()

add_library( freertos_plus_tcp_config_common INTERFACE )
target_include_directories(freertos_plus_tcp_config_common INTERFACE Common )

Expand Down Expand Up @@ -75,6 +98,7 @@ else()
endif()

# FreeRTOS-Plus-TCP compilation options configuration
set_property(TARGET freertos_plus_tcp PROPERTY C_STANDARD 90)
target_compile_options(freertos_plus_tcp
PRIVATE

Expand Down
12 changes: 6 additions & 6 deletions test/build-combination/README.md
Expand Up @@ -9,19 +9,19 @@ All the CMake commands are to be run from the root of the repository.

* Build checks (Enable all functionalities)
```
cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL
cmake -S . -B build -DFREERTOS_PLUS_TCP_ENABLE_BUILD_CHECKS=ON -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL
cmake --build build --target freertos_plus_tcp_build_test
```

* Build checks (Disable all functionalities)
```
cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DISABLE_ALL
cmake -S . -B build -DFREERTOS_PLUS_TCP_ENABLE_BUILD_CHECKS=ON -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DISABLE_ALL
cmake --build build --target freertos_plus_tcp_build_test
```

* Build checks (Default configuration)
```
cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DEFAULT_CONF
cmake -S . -B build -DFREERTOS_PLUS_TCP_ENABLE_BUILD_CHECKS=ON -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DEFAULT_CONF
cmake --build build --target freertos_plus_tcp_build_test
```

Expand All @@ -31,21 +31,21 @@ All the CMake commands are to be run from the root of the repository.

* Build checks (Enable all functionalities)
```
cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32
cmake -S . -B build -DFREERTOS_PLUS_TCP_ENABLE_BUILD_CHECKS=ON -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32
```
Open the generated Visual Studio Solution file `test\build-combination\build\FreeRTOS-Plus-TCP Build Combination.sln`
in Visual Studio and click `Build --> Build Solution`.

* Build checks (Disable all functionalities)
```
cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32
cmake -S . -B build -DFREERTOS_PLUS_TCP_ENABLE_BUILD_CHECKS=ON -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32
```
Open the generated Visual Studio Solution file `test\build-combination\build\FreeRTOS-Plus-TCP Build Combination.sln`
in Visual Studio and click `Build --> Build Solution`.

* Build checks (Default configuration)
```
cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32
cmake -S . -B build -DFREERTOS_PLUS_TCP_ENABLE_BUILD_CHECKS=ON -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32
```
Open the generated Visual Studio Solution file `test\build-combination\build\FreeRTOS-Plus-TCP Build Combination.sln`
in Visual Studio and click `Build --> Build Solution`.

0 comments on commit a4295d3

Please sign in to comment.