Skip to content

Commit

Permalink
Work CI-CD
Browse files Browse the repository at this point in the history
- Replace deprecated CMake API with FetchContent_MakeAvailable
  + Wherever possible. Some targets (like IDF) have bad CMake that prevent this.
- Switch order on Mbed TLS to fix include errors.
- Fix lwIP name to match CMake project.

***NO_CI***
  • Loading branch information
josesimoes committed Jul 24, 2024
1 parent cf89369 commit cadbd8b
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 44 deletions.
6 changes: 3 additions & 3 deletions CMake/Modules/STM32_CubePackage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,13 @@ macro(ProcessSTM32CubePackage)
endif()

FetchContent_GetProperties(stm32${TARGET_SERIES_SHORT_LOWER}_hal_driver)
FetchContent_Populate(stm32${TARGET_SERIES_SHORT_LOWER}_hal_driver)
FetchContent_MakeAvailable(stm32${TARGET_SERIES_SHORT_LOWER}_hal_driver)

FetchContent_GetProperties(cmsis_device_${TARGET_SERIES_SHORT_LOWER})
FetchContent_Populate(cmsis_device_${TARGET_SERIES_SHORT_LOWER})
FetchContent_MakeAvailable(cmsis_device_${TARGET_SERIES_SHORT_LOWER})

FetchContent_GetProperties(cmsis_core)
FetchContent_Populate(cmsis_core)
FetchContent_MakeAvailable(cmsis_core)

endmacro()

Expand Down
33 changes: 19 additions & 14 deletions CMake/binutils.common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ function(nf_add_mbedtls_library)

if(NO_MBEDTLS_SOURCE)
# no Mbed TLS source specified, download it from it's repo
message(STATUS "MbedTLS ${MBEDTLS_GIT_TAG} from GitHub repo")
message(STATUS "Mbed TLS ${MBEDTLS_GIT_TAG} from GitHub repo")

FetchContent_Declare(
mbedtls
Expand All @@ -730,7 +730,7 @@ function(nf_add_mbedtls_library)
else()
# MbedTLS source was specified

message(STATUS "MbedTLS ${MBEDTLS_GIT_TAG} (source from: ${MBEDTLS_SOURCE})")
message(STATUS "Mbed TLS ${MBEDTLS_GIT_TAG} (source from: ${MBEDTLS_SOURCE})")

FetchContent_Declare(
mbedtls
Expand All @@ -739,19 +739,18 @@ function(nf_add_mbedtls_library)

endif()

# Check if population has already been performed
FetchContent_GetProperties(mbedtls)
if(NOT mbedtls_POPULATED)
# Fetch the content using previously declared details
FetchContent_Populate(mbedtls)
endif()

# don't include tests or programs, only build libraries
set(ENABLE_TESTING CACHE BOOL OFF)
set(ENABLE_PROGRAMS CACHE BOOL OFF)

cmake_policy(SET CMP0048 NEW)
add_subdirectory(${mbedtls_SOURCE_DIR} mbedtls_build)

# Check if population has already been performed
FetchContent_GetProperties(mbedtls)
if(NOT mbedtls_POPULATED)
# Fetch the content using previously declared details
FetchContent_MakeAvailable(mbedtls)
endif()

endfunction()

Expand Down Expand Up @@ -781,7 +780,7 @@ function(nf_add_lwip_library)
message(STATUS "LWIP ${LWIP_GIT_TAG} from Git repo")

FetchContent_Declare(
lwip
lwIP
GIT_REPOSITORY https://github.com/lwip-tcpip/lwip.git
GIT_TAG ${LWIP_GIT_TAG}
)
Expand All @@ -792,7 +791,7 @@ function(nf_add_lwip_library)
message(STATUS "LWIP ${LWIP_GIT_TAG} (source from: ${LWIP_SOURCE})")

FetchContent_Declare(
lwip
lwIP
SOURCE_DIR ${LWIP_SOURCE}
)

Expand All @@ -801,9 +800,15 @@ function(nf_add_lwip_library)
# Check if population has already been performed
FetchContent_GetProperties(lwip)

if(NOT lwip_POPULATED)
if(NOT lwIP_POPULATED)
# Fetch the content using previously declared details
FetchContent_Populate(lwip)
FetchContent_MakeAvailable(lwIP)
endif()

########################################################################
# add lwipdocs target, just to keep cmake happy
# after moving to a more recent lwIP versions this is not needed anymore
add_custom_target(lwipdocs)
########################################################################

endfunction()
8 changes: 4 additions & 4 deletions targets/AzureRTOS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ else()

endif()

FetchContent_Populate(azure_rtos)
FetchContent_MakeAvailable(azure_rtos)

###########################
# Azure RTOS USBX
Expand Down Expand Up @@ -168,7 +168,7 @@ if(AZURERTOS_USBX_REQUIRED)

endif()

FetchContent_Populate(azure_rtos_usbx)
FetchContent_MakeAvailable(azure_rtos_usbx)

endif()

Expand Down Expand Up @@ -229,7 +229,7 @@ if(AZURERTOS_FILEX_REQUIRED)

endif()

FetchContent_Populate(azure_rtos_filex)
FetchContent_MakeAvailable(azure_rtos_filex)

endif()

Expand Down Expand Up @@ -293,7 +293,7 @@ if(AZURERTOS_NETXDUO_REQUIRED)
# enable BSD layer in NetX Duo
set(NXD_ENABLE_BSD TRUE)

FetchContent_Populate(azure_rtos_netxduo)
FetchContent_MakeAvailable(azure_rtos_netxduo)

endif()

Expand Down
4 changes: 2 additions & 2 deletions targets/AzureRTOS/Maxim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ else()

endif()

FetchContent_Populate(maxim_micros_sdk)
FetchContent_MakeAvailable(maxim_micros_sdk)

# make vars global
set(NANOCLR_PROJECT_SOURCES ${NANOCLR_PROJECT_SOURCES} CACHE INTERNAL "make global")
Expand Down Expand Up @@ -125,7 +125,7 @@ else()
endif()

FetchContent_GetProperties(cmsis)
FetchContent_Populate(cmsis)
FetchContent_MakeAvailable(cmsis)

# add platform dirs
add_subdirectory(_include)
Expand Down
8 changes: 4 additions & 4 deletions targets/AzureRTOS/MicroBit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ else()

endif()

FetchContent_Populate(CODALMicroBitV2)
FetchContent_MakeAvailable(CODALMicroBitV2)

####################
# CODAL Core
Expand Down Expand Up @@ -116,7 +116,7 @@ else()

endif()

FetchContent_Populate(CodalCore)
FetchContent_MakeAvailable(CodalCore)

####################
# CODAL NRF52
Expand Down Expand Up @@ -172,7 +172,7 @@ else()

endif()

FetchContent_Populate(CodalNrf52)
FetchContent_MakeAvailable(CodalNrf52)

########################
# CODAL Micro Bit NRF52 SDK
Expand Down Expand Up @@ -228,7 +228,7 @@ else()

endif()

FetchContent_Populate(CodalMicrobitNrf5Sdk)
FetchContent_MakeAvailable(CodalMicrobitNrf5Sdk)

# make vars global
set(NANOCLR_PROJECT_SOURCES ${NANOCLR_PROJECT_SOURCES} CACHE INTERNAL "make global")
Expand Down
2 changes: 1 addition & 1 deletion targets/AzureRTOS/Nordic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ else()

endif()

FetchContent_Populate(nRFConnectSdk)
FetchContent_MakeAvailable(nRFConnectSdk)

# Point to NCS root directory
set(NRF_DIR ${nRFConnectSdk_SOURCE_DIR} CACHE PATH "NCS root directory")
Expand Down
2 changes: 1 addition & 1 deletion targets/AzureRTOS/RaspberryPi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ else()

endif()

FetchContent_Populate(pico_sdk)
FetchContent_MakeAvailable(pico_sdk)

# set these to help Pico SDK
set(PICO_TOOLCHAIN_PATH ${TOOLCHAIN_PREFIX})
Expand Down
2 changes: 1 addition & 1 deletion targets/AzureRTOS/ST/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ else()
endif()

FetchContent_GetProperties(chibios)
FetchContent_Populate(chibios)
FetchContent_MakeAvailable(chibios)

list(APPEND TARGET_AZURERTOS_COMMON_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/_include)

Expand Down
2 changes: 1 addition & 1 deletion targets/AzureRTOS/SiliconLabs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ else()
endif()

FetchContent_GetProperties(gecko_sdk)
FetchContent_Populate(gecko_sdk)
FetchContent_MakeAvailable(gecko_sdk)

# including here the CMake files for the source files specific to the target series
include(AzureRTOS_${TARGET_SERIES}_sources)
Expand Down
8 changes: 4 additions & 4 deletions targets/ChibiOS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ endif()
FetchContent_GetProperties(chibios)
if(NOT chibios_POPULATED)
# Fetch the content using previously declared details
FetchContent_Populate(chibios)
FetchContent_MakeAvailable(chibios)
endif()

if(CHIBIOS_CONTRIB_REQUIRED)
Expand Down Expand Up @@ -137,7 +137,7 @@ if(CHIBIOS_CONTRIB_REQUIRED)
FetchContent_GetProperties(chibios-contrib)
if(NOT chibios-contrib_POPULATED)
# Fetch the content using previously declared details
FetchContent_Populate(chibios-contrib)
FetchContent_MakeAvailable(chibios-contrib)
endif()

endif()
Expand Down Expand Up @@ -199,7 +199,7 @@ if(NF_FEATURE_HAS_SDCARD OR NF_FEATURE_HAS_USB_MSD)
FetchContent_GetProperties(fatfs)
if(NOT fatfs_POPULATED)
# Fetch the content using previously declared details
FetchContent_Populate(fatfs)
FetchContent_MakeAvailable(fatfs)
endif()

# have to delete the ffconf.h template from the repo
Expand Down Expand Up @@ -373,7 +373,7 @@ if(NF_FEATURE_USE_LITTLEFS_OPTION)
FetchContent_GetProperties(littlefs)
if(NOT littlefs_POPULATED)
# Fetch the content using previously declared details
FetchContent_Populate(littlefs)
FetchContent_MakeAvailable(littlefs)
endif()

endif()
Expand Down
6 changes: 3 additions & 3 deletions targets/FreeRTOS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ endif()
FetchContent_GetProperties(freertos)
if(NOT freertos_POPULATED)
# Fetch the content using previously declared details
FetchContent_Populate(freertos)
FetchContent_MakeAvailable(freertos)
endif()

# check if CMSIS_SOURCE was specified or if it's empty (default is empty)
Expand Down Expand Up @@ -129,10 +129,10 @@ else()
endif()

FetchContent_GetProperties(cmsis)
FetchContent_Populate(cmsis)
FetchContent_MakeAvailable(cmsis)
if(NOT cmsis_POPULATED)
# Fetch the content using previously declared details
FetchContent_Populate(cmsis)
FetchContent_MakeAvailable(cmsis)
endif()

# FreeRTOS common directories
Expand Down
2 changes: 1 addition & 1 deletion targets/FreeRTOS/NXP/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ endif()
FetchContent_GetProperties(fatfs)
if(NOT fatfs_POPULATED)
# Fetch the content using previously declared details
FetchContent_Populate(fatfs)
FetchContent_MakeAvailable(fatfs)
endif()

# have to delete the ffconf.h template from the repo
Expand Down
10 changes: 5 additions & 5 deletions targets/TI_SimpleLink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ if("${TARGET_SERIES}" STREQUAL "CC32xx")
FetchContent_GetProperties(simplelinkcc32xxsdk)
if(NOT simplelinkcc32xxsdk_POPULATED)
# Fetch the content using previously declared details
FetchContent_Populate(simplelinkcc32xxsdk)
FetchContent_MakeAvailable(simplelinkcc32xxsdk)
endif()

# check if TI_XDCTOOLS_SOURCE was specified or if it's empty (default is empty)
Expand Down Expand Up @@ -108,7 +108,7 @@ if("${TARGET_SERIES}" STREQUAL "CC32xx")
FetchContent_GetProperties(ti_xdctools)
if(NOT ti_xdctools_POPULATED)
# Fetch the content using previously declared details
FetchContent_Populate(ti_xdctools)
FetchContent_MakeAvailable(ti_xdctools)
endif()

set(TI_XDCTools_INCLUDE_DIR ${ti_xdctools_SOURCE_DIR}/packages/ PARENT_SCOPE)
Expand Down Expand Up @@ -159,7 +159,7 @@ elseif( "${TARGET_SERIES}" STREQUAL "CC13X2" )
FetchContent_GetProperties(simplelinkcc13xx_26xxsdk)
if(NOT simplelinkcc13xx_26xxsdk_POPULATED)
# Fetch the content using previously declared details
FetchContent_Populate(simplelinkcc13xx_26xxsdk)
FetchContent_MakeAvailable(simplelinkcc13xx_26xxsdk)
endif()

# check if TI_SYSCONFIG_SOURCE was specified or if it's empty (default is empty)
Expand Down Expand Up @@ -209,7 +209,7 @@ elseif( "${TARGET_SERIES}" STREQUAL "CC13X2" )
FetchContent_GetProperties(ti_sysconfig)
if(NOT ti_sysconfig_POPULATED)
# Fetch the content using previously declared details
FetchContent_Populate(ti_sysconfig)
FetchContent_MakeAvailable(ti_sysconfig)
endif()

# check if TI_XDCTOOLS_SOURCE was specified or if it's empty (default is empty)
Expand Down Expand Up @@ -259,7 +259,7 @@ elseif( "${TARGET_SERIES}" STREQUAL "CC13X2" )
FetchContent_GetProperties(ti_xdctools)
if(NOT ti_xdctools_POPULATED)
# Fetch the content using previously declared details
FetchContent_Populate(ti_xdctools)
FetchContent_MakeAvailable(ti_xdctools)
endif()

set(TI_XDCTools_INCLUDE_DIR ${ti_xdctools_SOURCE_DIR}/packages/ PARENT_SCOPE)
Expand Down

0 comments on commit cadbd8b

Please sign in to comment.