generated from amazon-archives/__template_MIT-0
-
Notifications
You must be signed in to change notification settings - Fork 207
CMake changes from main branch [PR: #557, PR: #742] #803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tony-josi-aws
merged 28 commits into
FreeRTOS:dev/IPv6_integration
from
tony-josi-aws:cpick_main_cmake_changes_v3
Mar 27, 2023
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
990c0f8
556 Initial Cmake Module definition. #557
phelter 5bf02aa
renaming variables that have conflicting names with MSC and *nix headers
tony-josi-aws 6ae9519
fix build issue for posix port
tony-josi-aws 21018cc
Fix warning: -Waddress-of-packed-member when calculating checksum dir…
tony-josi-aws 28b91b7
fix warnings with prvInitialiseTCPFields declaration
tony-josi-aws c9305da
removing macros that hides the structure fields
tony-josi-aws 6020036
Updating build check enable all config to enable all config macros
tony-josi-aws 12256f0
CMake: Fix GIT_REPOSITORY and GIT_TAG (#742)
amazonKamath 26cc247
moving ipTRUE_BOOL and ipFALSE_BOOL out of #ifndef pdTRUE_SIGNED chec…
tony-josi-aws 4f2344d
minor fix to the cmake files and main file
tony-josi-aws 702d44a
Uncrustify: triggered by comment.
actions-user 58c18fa
adding doxygen comments to new functions
tony-josi-aws edec1c9
Uncrustify: triggered by comment
actions-user a98682b
Add more warnings check and fix warnings
tony-josi-aws 65d7121
Uncrustify: triggered by comment
actions-user 9fa03fd
fix review feedback and more debug printf warnings fix
tony-josi-aws de51dc4
more warnings fix
tony-josi-aws 958e3d4
fix misra issues
tony-josi-aws e0b9162
Uncrustify: triggered by comment
actions-user d44c846
replace sin_addr with sin_address.ulIP_IPv4 in +TCP demos
tony-josi-aws 0180c4b
replace sin_addr6 with sin_address.xIP_IPv6 in +TCP demos
tony-josi-aws fb91aa5
replace freertos_sockaddr6 with freertos_sockaddr in +TCP demos
tony-josi-aws 68b1dc2
review feedback changes
tony-josi-aws f34c139
removing duplicate def for prvStreamBufferAdd from winpcap
tony-josi-aws 38ad56c
fix more warnings from MSVC
tony-josi-aws c5dc60d
Uncrustify: triggered by comment
actions-user ce53662
review feedback changes
tony-josi-aws 6e056ee
Uncrustify: triggered by comment
actions-user File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,237 @@ | ||
|
|
||
| cmake_minimum_required(VERSION 3.15) | ||
| cmake_policy(SET CMP0048 NEW) # project version | ||
| cmake_policy(SET CMP0076 NEW) # full paths | ||
|
|
||
| list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_modules") | ||
|
|
||
| ######################################################################## | ||
| # Project Details | ||
| project(FreeRTOS-Plus-TCP | ||
| VERSION 3.1.0 | ||
| DESCRIPTION "FreeRTOS TCP/UDP Network Layer" | ||
| HOMEPAGE_URL https://freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/index.html | ||
| LANGUAGES C) | ||
|
|
||
| # Do not allow in-source build. | ||
| if( ${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR} ) | ||
| message( FATAL_ERROR "In-source build is not allowed. Please build in a separate directory, such as ${PROJECT_SOURCE_DIR}/build." ) | ||
| endif() | ||
|
|
||
| # Options | ||
| option(FREERTOS_PLUS_TCP_BUILD_TEST "Build the test for FreeRTOS Plus TCP" OFF) | ||
|
|
||
| # Configuration | ||
| # Override these at project level with: | ||
| # Optional: set(FREERTOS_PLUS_TCP_BUFFER_ALLOCATION "1" CACHE STRING "" FORCE) | ||
| # Optional: set(FREERTOS_PLUS_TCP_COMPILER "" CACHE STRING "" FORCE) | ||
| # Required: set(FREERTOS_PLUS_TCP_NETWORK_IF "POSIX" CACHE STRING "" FORCE) | ||
|
|
||
| # Select the appropriate buffer allocaiton method. | ||
| # See: https://freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/Embedded_Ethernet_Buffer_Management.html | ||
| if (NOT FREERTOS_PLUS_TCP_BUFFER_ALLOCATION) | ||
| message(STATUS "Using default FREERTOS_PLUS_TCP_BUFFER_ALLOCATION = 2") | ||
| set(FREERTOS_PLUS_TCP_BUFFER_ALLOCATION "2" CACHE STRING "FreeRTOS buffer allocation model number. 1 .. 2.") | ||
| endif() | ||
|
|
||
| # Select the Compiler - if left blank will detect using CMake | ||
| # Note relies on CMake to detect over any setting here. | ||
| # Valid options are: | ||
| # FREERTOS_PLUS_TCP_COMPILER | Detected | CMake | ||
| # ------------------------------------------------- | ||
| # CCS | No | ?TBD? | ||
| # GCC | Yes | GNU | ||
| # IAR | Yes | IAR | ||
| # Keil | Yes | ARMCC | ||
| # MSVC | Yes | MSVC # Note only for MinGW | ||
| # Renesas | No | ?TBD? | ||
| # Will always a attempt to detect and if detectable double checks that the compiler is set correctly. | ||
| set(FREERTOS_PLUS_TCP_COMPILER "" CACHE STRING "FreeRTOS Plus TCP Compiler Selection") | ||
|
|
||
|
|
||
| # Select the appropriate network interface | ||
| # This will fail the CMake preparation step if not set to one of those values. | ||
| set(FREERTOS_PLUS_TCP_NETWORK_IF "" CACHE STRING "FreeRTOS Plus TCP Network Interface selection") | ||
| set(FREERTOS_PLUS_TCP_NETWORK_IF_LIST | ||
| A_CUSTOM_NETWORK_IF | ||
| ATSAM43 ATSAME5x # AT | ||
| DRIVER_SAM | ||
| ESP32 | ||
| KSZ8851SNL | ||
| LPC17xx LPC18xx LPC54018 | ||
| M487 | ||
| MPS2_AN385 | ||
| MW300_RD | ||
| PIC32MZEF_ETH PIC32MZEF_WIFI | ||
| POSIX WIN_PCAP # Native Linux & Windows respectively | ||
| RX | ||
| SH2A | ||
| STM32FXX STM32HXX # ST Micro | ||
| MSP432 | ||
| TM4C | ||
| XILINX_ULTRASCALE ZYNQ # AMD/Xilinx | ||
| ) | ||
| if(NOT FREERTOS_PLUS_TCP_NETWORK_IF) | ||
| # Attempt to detect the system. | ||
| if(UNIX) | ||
| message(STATUS "Detected UNIX/Posix system setting FREERTOS_PLUS_TCP_NETWORK_IF = POSIX") | ||
| set(FREERTOS_PLUS_TCP_NETWORK_IF POSIX) | ||
| elseif(MINGW) | ||
| message(STATUS "Detected Windows MinGW system setting FREERTOS_PLUS_TCP_NETWORK_IF = WIN_PCAP") | ||
| set(FREERTOS_PLUS_TCP_NETWORK_IF WIN_PCAP) | ||
| endif() | ||
| endif() | ||
|
|
||
| if(NOT FREERTOS_PLUS_TCP_NETWORK_IF IN_LIST FREERTOS_PLUS_TCP_NETWORK_IF_LIST ) | ||
| message(FATAL_ERROR " FREERTOS_PLUS_TCP_NETWORK_IF is '${FREERTOS_PLUS_TCP_NETWORK_IF}'.\n" | ||
| " Please specify it from top-level CMake file (example):\n" | ||
| " set(FREERTOS_PLUS_TCP_NETWORK_IF POSIX CACHE STRING \"\")\n" | ||
| " or from CMake command line option:\n" | ||
| " -DFREERTOS_PLUS_TCP_NETWORK_IF=POSIX\n" | ||
| " \n" | ||
| " Available port options: (Tested means compiled with that variant)\n" | ||
| " A_CUSTOM_NETWORK_IF Target: User Defined\n" | ||
| " ATSAM4E Target: ATSAM4E Tested: TODO\n" | ||
| " ATSAME5x Target: ATSAME5x Tested: TODO\n" | ||
| " DRIVER_SAM Target: Driver SAM Tested: TODO\n" | ||
| " ESP32 Target: ESP-32 Tested: TODO\n" | ||
| " KSZ8851SNL Target: ksz8851snl Tested: TODO\n" | ||
| " POSIX Target: linux/Posix\n" | ||
| " LPC17xx Target: LPC17xx Tested: TODO\n" | ||
| " LPC18xx Target: LPC18xx Tested: TODO\n" | ||
| " LPC54018 Target: LPC54018 Tested: TODO\n" | ||
| " M487 Target: M487 Tested: TODO\n" | ||
| " MPS2_AN385 Target: MPS2_AN385 Tested: TODO\n" | ||
| " MW300_RD Target: mw300_rd Tested: TODO\n" | ||
| " PIC32MZEF_ETH Target: pic32mzef ethernet Tested: TODO\n" | ||
| " PIC32MZEF_WIFI Target: pic32mzef Wifi Tested: TODO\n" | ||
| " RX Target: RX Tested: TODO\n" | ||
| " SH2A Target: SH2A Tested: TODO\n" | ||
| " STM32FXX Target: STM32Fxx Tested: TODO\n" | ||
| " STM32HXX Target: STM32Hxx Tested: TODO\n" | ||
| " MSP432 Target: MSP432 Tested: TODO\n" | ||
| " TM4C Target: TM4C Tested: TODO\n" | ||
| " WIN_PCAP Target: Windows Tested: TODO\n" | ||
| " XILINX_ULTRASCALE Target: Xilinx Ultrascale Tested: TODO\n" | ||
| " ZYNQ Target: Xilinx Zynq") | ||
| elseif((FREERTOS_PORT STREQUAL "A_CUSTOM_PORT") AND (NOT TARGET freertos_kernel_port) ) | ||
| message(FATAL_ERROR " FREERTOS_PLUS_TCP_NETWORK_IF is set to A_CUSTOM_NETWORK_IF.\n" | ||
| " Please specify the custom network interface target with all necessary files.\n" | ||
| " For example, assuming a directory of:\n" | ||
| " FreeRTOSCustomNetworkInterface/\n" | ||
| " CMakeLists.txt\n" | ||
| " NetworkInterface.c\n\n" | ||
| " Where FreeRTOSCustomNetworkInterface/CMakeLists.txt is a modified version of:\n" | ||
| " add_library(freertos_plus_tcp_network_if STATIC)\n\n" | ||
| " target_sources(freertos_plus_tcp_network_if\n" | ||
| " PRIVATE\n" | ||
| " NetworkInterface.c)\n\n" | ||
| " target_include_directories(freertos_plus_tcp_network_if\n" | ||
| " PUBLIC\n" | ||
| " .)\n\n" | ||
| " taget_link_libraries(freertos_plus_tcp_network_if\n" | ||
| " PUBLIC\n" | ||
| " freertos_plus_tcp_port\n" | ||
| " freertos_plus_tcp_network_if_common\n" | ||
| " PRIVATE\n" | ||
| " freertos_kernel)") | ||
| 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 | ||
| DISABLE_ALL # Disable all configuration settings | ||
| 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() | ||
|
|
||
| ######################################################################## | ||
| # Requirements | ||
| set(CMAKE_C_STANDARD 90) # Note FreeRTOS-Kernel uses C99 constructs. | ||
| set(CMAKE_C_STANDARD_REQUIRED ON) | ||
|
|
||
| ######################################################################## | ||
| # Overall Compile Options | ||
| # Note the compile option strategy is to error on everything and then | ||
| # Per library opt-out of things that are warnings/errors. | ||
| # This ensures that no matter what strategy for compilation you take, the | ||
| # builds will still occur. | ||
| # | ||
| # Only tested with GNU and Clang. | ||
| # Other options are https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html#variable:CMAKE_%3CLANG%3E_COMPILER_ID | ||
| # Naming of compilers translation map: | ||
| # For the ?TBD? - Suggest trying GNU-based and adding the appropriate toolchain file. | ||
| # For Toolchain examples see _deps/cmake-src/toolchain/arm-none-eabil-gcc.toolchain.cmake | ||
| # | ||
| # FreeRTOS | CMake | ||
| # ------------------- | ||
| # CCS | ?TBD? | ||
| # GCC | GNU, Clang, *Clang Others? | ||
| # IAR | IAR | ||
| # Keil | ARMCC | ||
| # MSVC | MSVC # Note only for MinGW? | ||
| # Renesas | ?TBD? | ||
|
|
||
| add_compile_options( | ||
| ### Gnu/Clang C Options | ||
| $<$<COMPILE_LANG_AND_ID:C,GNU>:-fdiagnostics-color=always> | ||
| $<$<COMPILE_LANG_AND_ID:C,Clang>:-fcolor-diagnostics> | ||
|
|
||
| $<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wall> | ||
| $<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wextra> | ||
| $<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wpedantic> | ||
| $<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Werror> | ||
| $<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wunused-variable> | ||
| $<$<COMPILE_LANG_AND_ID:C,Clang>:-Weverything> | ||
|
|
||
| # TODO: Add in other Compilers here. | ||
| ) | ||
|
|
||
| ######################################################################## | ||
| # External Dependencies | ||
| # Note: For backwards compatibility - still have .gitmodules defining submodules | ||
| # To support fetching content in a higher level project see | ||
| # README.md `Consume with CMake` | ||
| # This will allow you to upgrade submodules and have one common submodule for | ||
| # all your builds despite multiple submodules having different versions. | ||
| include(FetchContent) | ||
|
|
||
| FetchContent_Declare( freertos_kernel | ||
| GIT_REPOSITORY https://github.com/FreeRTOS/FreeRTOS-Kernel.git | ||
| GIT_TAG main | ||
| ) | ||
|
|
||
| FetchContent_Declare( cmock | ||
| GIT_REPOSITORY https://github.com/ThrowTheSwitch/CMock | ||
| GIT_TAG v2.5.3 | ||
| ) | ||
|
|
||
| add_subdirectory(source) | ||
| add_subdirectory(tools) | ||
| add_subdirectory(test) | ||
|
|
||
| FetchContent_MakeAvailable(freertos_kernel cmock) | ||
|
|
||
| # Note following are can be removed once FreeRTOS-Kernel v10.5.0 + fixes their issues. | ||
| # To ignore header specific issues - change all of the headers to SYSTEM | ||
| set(_freertos_kernel_targets freertos_kernel freertos_kernel_port) | ||
| # foreach (_target ${_freertos_kernel_targets} ) | ||
| # get_target_property( interface_directories ${_target} INTERFACE_INCLUDE_DIRECTORIES ) | ||
| # set_target_properties(${_target} PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${interface_directories}" ) | ||
| # endforeach() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| # - Try to find libpcap include dirs and libraries | ||
| # | ||
| # Usage of this module as follows: | ||
| # | ||
| # find_package(PCAP) | ||
| # | ||
| # Variables used by this module, they can change the default behaviour and need | ||
| # to be set before calling find_package: | ||
| # | ||
| # PCAP_ROOT_DIR Set this variable to the root installation of | ||
| # libpcap if the module has problems finding the | ||
| # proper installation path. | ||
| # | ||
| # Variables defined by this module: | ||
| # | ||
| # PCAP_FOUND System has libpcap, include and library dirs found | ||
| # PCAP_INCLUDE_DIR The libpcap include directories. | ||
| # PCAP_LIBRARY The libpcap library (possibly includes a thread | ||
| # library e.g. required by pf_ring's libpcap) | ||
| # HAVE_PF_RING If a found version of libpcap supports PF_RING | ||
|
|
||
| find_path(PCAP_ROOT_DIR | ||
| NAMES include/pcap.h | ||
| ) | ||
|
|
||
| find_path(PCAP_INCLUDE_DIR | ||
| NAMES pcap.h | ||
| HINTS ${PCAP_ROOT_DIR}/include | ||
| ) | ||
|
|
||
| find_library(PCAP_LIBRARY | ||
| NAMES pcap | ||
| HINTS ${PCAP_ROOT_DIR}/lib | ||
| ) | ||
|
|
||
| include(FindPackageHandleStandardArgs) | ||
| find_package_handle_standard_args(PCAP DEFAULT_MSG | ||
| PCAP_LIBRARY | ||
| PCAP_INCLUDE_DIR | ||
| ) | ||
|
|
||
| include(CheckCSourceCompiles) | ||
| set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARY}) | ||
| check_c_source_compiles("int main() { return 0; }" PCAP_LINKS_SOLO) | ||
| set(CMAKE_REQUIRED_LIBRARIES) | ||
|
|
||
| # check if linking against libpcap also needs to link against a thread library | ||
| if (NOT PCAP_LINKS_SOLO) | ||
| find_package(Threads) | ||
| if (THREADS_FOUND) | ||
| set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) | ||
| check_c_source_compiles("int main() { return 0; }" PCAP_NEEDS_THREADS) | ||
| set(CMAKE_REQUIRED_LIBRARIES) | ||
| endif () | ||
| if (THREADS_FOUND AND PCAP_NEEDS_THREADS) | ||
| set(_tmp ${PCAP_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) | ||
| list(REMOVE_DUPLICATES _tmp) | ||
| set(PCAP_LIBRARY ${_tmp} | ||
| CACHE STRING "Libraries needed to link against libpcap" FORCE) | ||
| else () | ||
| message(FATAL_ERROR "Couldn't determine how to link against libpcap") | ||
| endif () | ||
| endif () | ||
|
|
||
| include(CheckFunctionExists) | ||
| set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARY}) | ||
| check_function_exists(pcap_get_pfring_id HAVE_PF_RING) | ||
| check_function_exists(pcap_dump_open_append HAVE_PCAP_DUMP_OPEN_APPEND) | ||
| set(CMAKE_REQUIRED_LIBRARIES) | ||
|
|
||
| mark_as_advanced( | ||
| PCAP_ROOT_DIR | ||
| PCAP_INCLUDE_DIR | ||
| PCAP_LIBRARY | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.