Skip to content
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

Check path existence #246

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions cmake/FindBSP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,21 @@ foreach(COMP ${BSP_FIND_COMPONENTS})
endif()

if(NOT STM32_CUBE_${FAMILY}_PATH)
set(STM32_CUBE_${FAMILY}_PATH /opt/STM32Cube${FAMILY} CACHE PATH "Path to STM32Cube${FAMILY}")
message(STATUS "No STM32_CUBE_${FAMILY}_PATH specified using default: ${STM32_CUBE_${FAMILY}_PATH}")
set(DEFAULT_STM32_CUBE_${FAMILY}_PATH "/opt/STM32Cube${FAMILY}")
if(EXISTS ${DEFAULT_STM32_CUBE_${FAMILY}_PATH})
set(STM32_CUBE_${FAMILY}_PATH ${DEFAULT_STM32_CUBE_${FAMILY}_PATH} CACHE PATH "Path to STM32Cube${FAMILY}")
message(STATUS "No STM32_CUBE_${FAMILY}_PATH specified. "
"Using default STM32_CUBE_${FAMILY}_PATH: ${STM32_CUBE_${FAMILY}_PATH}")
else()
message(STATUS "No STM32_CUBE_${FAMILY}_PATH specified. "
"default STM32_CUBE_${FAMILY}_PATH: ${DEFAULT_STM32_CUBE_${FAMILY}_PATH} does not exist. Leaving empty.")
endif()
endif()


if((BSP_FIND_REQUIRED_${COMP}) AND (NOT EXISTS ${STM32_CUBE_${FAMILY}_PATH}))
message(WARNING "For REQUIRED COMPONENT: ${COMP}, STM32_CUBE_${FAMILY}_PATH: '${STM32_CUBE_${FAMILY}_PATH}' Does not Exist")
endif()

find_path(BSP_${FAMILY}_PATH
NAMES Components/Common/io.h
PATHS "${STM32_CUBE_${FAMILY}_PATH}/Drivers/BSP"
Expand Down
17 changes: 14 additions & 3 deletions cmake/FindCMSIS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,21 @@ foreach(COMP ${CMSIS_FIND_COMPONENTS})
endif()

if((NOT STM32_CMSIS_${FAMILY}_PATH) AND (NOT STM32_CUBE_${FAMILY}_PATH))
set(STM32_CUBE_${FAMILY}_PATH /opt/STM32Cube${FAMILY} CACHE PATH "Path to STM32Cube${FAMILY}")
message(STATUS "Neither STM32_CUBE_${FAMILY}_PATH nor STM32_CMSIS_${FAMILY}_PATH specified using default STM32_CUBE_${FAMILY}_PATH: ${STM32_CUBE_${FAMILY}_PATH}")
set(DEFAULT_STM32_CUBE_${FAMILY}_PATH "/opt/STM32Cube${FAMILY}")
if(EXISTS ${DEFAULT_STM32_CUBE_${FAMILY}_PATH})
set(STM32_CUBE_${FAMILY}_PATH ${DEFAULT_STM32_CUBE_${FAMILY}_PATH} CACHE PATH "Path to STM32Cube${FAMILY}")
message(STATUS "Neither STM32_CUBE_${FAMILY}_PATH nor STM32_CMSIS_${FAMILY}_PATH specified."
"Using default STM32_CUBE_${FAMILY}_PATH: ${STM32_CUBE_${FAMILY}_PATH}")
else()
message(STATUS "Neither STM32_CUBE_${FAMILY}_PATH nor STM32_CMSIS_${FAMILY}_PATH specified. "
"default STM32_CUBE_${FAMILY}_PATH: ${DEFAULT_STM32_CUBE_${FAMILY}_PATH} does not exist. Leaving empty.")
endif()
endif()


if ((CMSIS_FIND_REQUIRED_${COMP}) AND (NOT EXISTS ${STM32_CMSIS_${FAMILY}_PATH}) AND (NOT EXISTS ${STM32_CUBE_${FAMILY}_PATH}}))
message(WARNING "For REQUIRED COMPONENT: ${COMP}, Neither STM32_CUBE_${FAMILY}_PATH: '${STM32_CUBE_${FAMILY}_PATH}' nor STM32_CMSIS_${FAMILY}_PATH: '${STM32_CMSIS_${FAMILY}_PATH}' Exists")
atsju marked this conversation as resolved.
Show resolved Hide resolved
endif()

find_path(CMSIS_${FAMILY}${CORE_U}_CORE_PATH
NAMES Include/cmsis_gcc.h
PATHS "${STM32_CMSIS_PATH}" "${STM32_CUBE_${FAMILY}_PATH}/Drivers/CMSIS"
Expand Down
14 changes: 12 additions & 2 deletions cmake/FindFreeRTOS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,18 @@ if(NOT FREERTOS_PATH)
endif()

if(NOT FREERTOS_PATH)
set(FREERTOS_PATH /opt/FreeRTOS CACHE PATH "Path to FreeRTOS")
message(STATUS "No FREERTOS_PATH specified using default: ${FREERTOS_PATH}")
set(DEFAULT_FREERTOS_PATH "/opt/FreeRTOS")
if (EXISTS ${DEFAULT_FREERTOS_PATH})
set(FREERTOS_PATH ${DEFAULT_FREERTOS_PATH} CACHE PATH "Path to FreeRTOS")
message(STATUS "No FREERTOS_PATH specified using default: ${FREERTOS_PATH}")
else()
message(STATUS "No FREERTOS_PATH specified."
"default FREERTOS_PATH: ${DEFAULT_FREERTOS_PATH} does not exist. Leaving Empty.")
endif()
endif()

if ((FREERTOS_FIND_REQUIRED) AND (NOT EXISTS ${FREERTOS_PATH}))
message(WARNING "FREERTOS_PATH: '${FREERTOS_PATH}' Does not Exist")
endif()

find_path(FreeRTOS_COMMON_INCLUDE
Expand Down
15 changes: 13 additions & 2 deletions cmake/FindHAL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,19 @@ foreach(COMP ${HAL_FIND_COMPONENTS_FAMILIES})
endif()

if((NOT STM32_HAL_${FAMILY}_PATH) AND (NOT STM32_CUBE_${FAMILY}_PATH))
set(STM32_CUBE_${FAMILY}_PATH /opt/STM32Cube${FAMILY} CACHE PATH "Path to STM32Cube${FAMILY}")
message(STATUS "Neither STM32_CUBE_${FAMILY}_PATH nor STM32_HAL_${FAMILY}_PATH specified using default STM32_CUBE_${FAMILY}_PATH: ${STM32_CUBE_${FAMILY}_PATH}")
set(DEFAULT_STM32_CUBE_${FAMILY}_PATH "/opt/STM32Cube${FAMILY}")
if(EXISTS ${DEFAULT_STM32_CUBE_${FAMILY}_PATH})
set(STM32_CUBE_${FAMILY}_PATH ${DEFAULT_STM32_CUBE_${FAMILY}_PATH} CACHE PATH "Path to STM32Cube${FAMILY}")
message(STATUS "Neither STM32_CUBE_${FAMILY}_PATH nor STM32_HAL_${FAMILY}_PATH specified."
"Using default STM32_CUBE_${FAMILY}_PATH: ${STM32_CUBE_${FAMILY}_PATH}")
elseif()
message(STATUS "Neither STM32_CUBE_${FAMILY}_PATH nor STM32_HAL_${FAMILY}_PATH specified. "
"default STM32_CUBE_${FAMILY}_PATH: ${DEFAULT_STM32_CUBE_${FAMILY}_PATH} does not exist. Leaving empty.")
endif()
endif()

if((HAL_FIND_REQUIRED_${COMP}) AND (NOT EXISTS ${STM32_HAL_${FAMILY}_PATH}) AND (NOT EXISTS ${STM32_CUBE_${FAMILY}_PATH}))
message(WARNING "For REQUIRED COMPONENT: ${COMP}, Neither STM32_CUBE_${FAMILY}_PATH: '${STM32_CUBE_${FAMILY}_PATH}' nor STM32_HAL_${FAMILY}_PATH: '${STM32_HAL_${FAMILY}_PATH}' Exists.")
endif()

#Checking HAL patch or release version
Expand Down
10 changes: 7 additions & 3 deletions tests/bsp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake
if(NOT TEST_FAMILIES)
# Can't test H7 because it needs some non-free components
set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 L0 L1 L4)
message(STATUS "No Test Families, running with TEST_FAMILIES=[${TEST_FAMILIES}]")
endif()

# Nucleo boards can have different devices on it
Expand Down Expand Up @@ -41,9 +42,12 @@ if(FETCH_ST_SOURCES)
stm32_fetch_cube(${TEST_FAMILIES})
endif()

find_package(CMSIS REQUIRED)
find_package(HAL REQUIRED)
find_package(BSP REQUIRED)
set(COMP_LIST ${TEST_FAMILIES})
list(TRANSFORM COMP_LIST PREPEND STM32)

find_package(CMSIS COMPONENTS ${COMP_LIST} REQUIRED)
find_package(HAL COMPONENTS ${COMP_LIST} REQUIRED)
find_package(BSP COMPONENTS ${COMP_LIST} REQUIRED)

set(SOURCES main.c)

Expand Down
6 changes: 5 additions & 1 deletion tests/cmsis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake

if(NOT TEST_FAMILIES)
set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5)
message(STATUS "No Test Families, running with TEST_FAMILIES=[${TEST_FAMILIES}]")
endif()

project(cmsis-test C ASM)
Expand All @@ -11,7 +12,10 @@ if(FETCH_ST_SOURCES)
stm32_fetch_cmsis(${TEST_FAMILIES})
endif()

find_package(CMSIS REQUIRED)
set(COMP_LIST ${TEST_FAMILIES})
list(TRANSFORM COMP_LIST PREPEND STM32)

find_package(CMSIS COMPONENTS ${COMP_LIST} REQUIRED)

set(SOURCES main.c)

Expand Down
8 changes: 6 additions & 2 deletions tests/fetch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake

if(NOT TEST_FAMILIES)
set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5)
message(STATUS "No Test Families, running with TEST_FAMILIES=[${TEST_FAMILIES}]")
endif()

project(fetch-test C ASM)
Expand All @@ -11,8 +12,11 @@ set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
stm32_fetch_cmsis(${TEST_FAMILIES})
stm32_fetch_hal(${TEST_FAMILIES})

find_package(CMSIS REQUIRED)
find_package(HAL REQUIRED)
set(COMP_LIST ${TEST_FAMILIES})
list(TRANSFORM COMP_LIST PREPEND STM32)

find_package(CMSIS COMPONENTS ${COMP_LIST} REQUIRED)
find_package(HAL COMPONENTS ${COMP_LIST} REQUIRED)

set(SOURCES main.c)

Expand Down
8 changes: 6 additions & 2 deletions tests/hal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake

if(NOT TEST_FAMILIES)
set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5)
message(STATUS "No Test Families, running with TEST_FAMILIES=[${TEST_FAMILIES}]")
endif()

project(hal-test C ASM)
Expand All @@ -13,8 +14,11 @@ if(FETCH_ST_SOURCES)
stm32_fetch_hal(${TEST_FAMILIES})
endif()

find_package(CMSIS REQUIRED)
find_package(HAL REQUIRED)
set(COMP_LIST ${TEST_FAMILIES})
list(TRANSFORM COMP_LIST PREPEND STM32)

find_package(CMSIS COMPONENTS ${COMP_LIST} REQUIRED)
find_package(HAL COMPONENTS ${COMP_LIST} REQUIRED)

set(SOURCES main.c)

Expand Down