mirror of
https://github.com/apache/nuttx.git
synced 2025-12-07 18:12:33 +08:00
nuttx/cmake: Remove redundant logic in CMake scripts
Simplify the CMake scripts by removing redundant logic to
improve code readability and maintainability.
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
This commit is contained in:
@@ -270,24 +270,21 @@ if(CONFIG_ARCH_BOARD_CUSTOM)
|
|||||||
ABSOLUTE BASE_DIR ${NUTTX_DIR})
|
ABSOLUTE BASE_DIR ${NUTTX_DIR})
|
||||||
else()
|
else()
|
||||||
set(NUTTX_BOARD_ABS_DIR ${NUTTX_BOARD_DIR})
|
set(NUTTX_BOARD_ABS_DIR ${NUTTX_BOARD_DIR})
|
||||||
file(TOUCH ${CMAKE_BINARY_DIR}/boards/dummy/Kconfig)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# check if board custom dir points to NuttX upstream board. This is useful when
|
# check if board custom dir points to NuttX upstream board. This is useful when
|
||||||
# an out-of-tree configuration uses an upstream board directory
|
# an out-of-tree configuration uses an upstream board directory
|
||||||
string(FIND "${CONFIG_ARCH_BOARD_CUSTOM_DIR}" "boards/" IS_NUTTX_BOARD)
|
string(FIND "${CONFIG_ARCH_BOARD_CUSTOM_DIR}" "boards/" IS_NUTTX_BOARD)
|
||||||
|
|
||||||
if(NOT EXISTS ${CMAKE_BINARY_DIR}/boards/dummy/Kconfig)
|
# link dummy/Kconfig only if this is not upstream board otherwise the same
|
||||||
# link dummy/Kconfig only if this is not upstream board otherwise the same
|
# Kconfig file is included twice which cause CMake warnings
|
||||||
# Kconfig file is included twice which cause CMake warnings
|
if(CONFIG_ARCH_BOARD_CUSTOM
|
||||||
if(CONFIG_ARCH_BOARD_CUSTOM
|
AND EXISTS ${NUTTX_BOARD_ABS_DIR}/Kconfig
|
||||||
AND EXISTS ${NUTTX_BOARD_ABS_DIR}/Kconfig
|
AND NOT (IS_NUTTX_BOARD EQUAL 0))
|
||||||
AND NOT (IS_NUTTX_BOARD EQUAL 0))
|
nuttx_create_symlink(${NUTTX_BOARD_ABS_DIR}/Kconfig
|
||||||
nuttx_create_symlink(${NUTTX_BOARD_ABS_DIR}/Kconfig
|
${CMAKE_BINARY_DIR}/boards/dummy/Kconfig)
|
||||||
${CMAKE_BINARY_DIR}/boards/dummy/Kconfig)
|
else()
|
||||||
else()
|
file(TOUCH ${CMAKE_BINARY_DIR}/boards/dummy/Kconfig)
|
||||||
file(TOUCH ${CMAKE_BINARY_DIR}/boards/dummy/Kconfig)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# board platform driver
|
# board platform driver
|
||||||
@@ -318,13 +315,11 @@ if(NOT EXISTS ${CMAKE_BINARY_DIR}/arch/dummy)
|
|||||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/arch/dummy)
|
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/arch/dummy)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT EXISTS ${CMAKE_BINARY_DIR}/arch/dummy/Kconfig)
|
if(CONFIG_ARCH_CHIP_CUSTOM AND EXISTS ${NUTTX_CHIP_ABS_DIR}/Kconfig)
|
||||||
if(CONFIG_ARCH_CHIP_CUSTOM AND EXISTS ${NUTTX_CHIP_ABS_DIR}/Kconfig)
|
nuttx_create_symlink(${NUTTX_CHIP_ABS_DIR}/Kconfig
|
||||||
nuttx_create_symlink(${NUTTX_CHIP_ABS_DIR}/Kconfig
|
${CMAKE_BINARY_DIR}/arch/dummy/Kconfig)
|
||||||
${CMAKE_BINARY_DIR}/arch/dummy/Kconfig)
|
else()
|
||||||
else()
|
file(TOUCH ${CMAKE_BINARY_DIR}/arch/dummy/Kconfig)
|
||||||
file(TOUCH ${CMAKE_BINARY_DIR}/arch/dummy/Kconfig)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT EXISTS ${CMAKE_BINARY_DIR}/arch/${CONFIG_ARCH})
|
if(NOT EXISTS ${CMAKE_BINARY_DIR}/arch/${CONFIG_ARCH})
|
||||||
|
|||||||
Reference in New Issue
Block a user