mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 06:18:40 +08:00
cmake:refactor cmake binary include_arch dir into include
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
This commit is contained in:
parent
6013591cb1
commit
9cbdf69fb0
3 changed files with 22 additions and 27 deletions
|
@ -37,9 +37,8 @@ function(nuttx_add_library_internal target)
|
||||||
|
|
||||||
# add main include directories
|
# add main include directories
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
${target} SYSTEM
|
${target} SYSTEM PRIVATE ${CMAKE_SOURCE_DIR}/include
|
||||||
PRIVATE ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include
|
${CMAKE_BINARY_DIR}/include)
|
||||||
${CMAKE_BINARY_DIR}/include_arch)
|
|
||||||
|
|
||||||
# Set global compile options & definitions We use the "nuttx" target to hold
|
# Set global compile options & definitions We use the "nuttx" target to hold
|
||||||
# these properties so that libraries added after this property is set can read
|
# these properties so that libraries added after this property is set can read
|
||||||
|
|
|
@ -54,8 +54,7 @@ macro(define_allsyms_link_target inter_target dep_target allsyms_file)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
target_sources(nuttx PRIVATE ${ALLSYMS_SOURCE})
|
target_sources(nuttx PRIVATE ${ALLSYMS_SOURCE})
|
||||||
set(ALLSYMS_INCDIR ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include
|
set(ALLSYMS_INCDIR ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include)
|
||||||
${CMAKE_BINARY_DIR}/include_arch)
|
|
||||||
set_source_files_properties(
|
set_source_files_properties(
|
||||||
${ALLSYMS_SOURCE} PROPERTIES INCLUDE_DIRECTORIES "${ALLSYMS_INCDIR}")
|
${ALLSYMS_SOURCE} PROPERTIES INCLUDE_DIRECTORIES "${ALLSYMS_INCDIR}")
|
||||||
else()
|
else()
|
||||||
|
@ -76,9 +75,8 @@ macro(define_allsyms_link_target inter_target dep_target allsyms_file)
|
||||||
|
|
||||||
# relink target and nuttx have exactly the same configuration
|
# relink target and nuttx have exactly the same configuration
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
${inter_target} SYSTEM
|
${inter_target} SYSTEM PUBLIC ${CMAKE_SOURCE_DIR}/include
|
||||||
PUBLIC ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include
|
${CMAKE_BINARY_DIR}/include)
|
||||||
${CMAKE_BINARY_DIR}/include_arch)
|
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
${inter_target} PRIVATE $<TARGET_PROPERTY:nuttx,NUTTX_KERNEL_DEFINITIONS>)
|
${inter_target} PRIVATE $<TARGET_PROPERTY:nuttx,NUTTX_KERNEL_DEFINITIONS>)
|
||||||
target_compile_options(
|
target_compile_options(
|
||||||
|
|
|
@ -35,42 +35,40 @@ include(nuttx_mkversion)
|
||||||
|
|
||||||
# Setup symbolic link generation
|
# Setup symbolic link generation
|
||||||
|
|
||||||
if(NOT EXISTS ${CMAKE_BINARY_DIR}/include_arch/arch)
|
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
|
|
||||||
${CMAKE_BINARY_DIR}/include_arch/arch)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT EXISTS ${CMAKE_BINARY_DIR}/include_apps)
|
if(NOT EXISTS ${CMAKE_BINARY_DIR}/include_apps)
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
|
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
|
||||||
${CMAKE_BINARY_DIR}/include_apps)
|
${CMAKE_BINARY_DIR}/include_apps)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT EXISTS ${CMAKE_BINARY_DIR}/include/arch)
|
if(NOT EXISTS ${CMAKE_BINARY_DIR}/include/arch)
|
||||||
nuttx_create_symlink(${NUTTX_DIR}/arch/${CONFIG_ARCH}/include
|
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
|
||||||
${CMAKE_BINARY_DIR}/include/arch)
|
${CMAKE_BINARY_DIR}/include/arch)
|
||||||
|
file(GLOB CONTENTS ${NUTTX_DIR}/arch/${CONFIG_ARCH}/include/*)
|
||||||
|
foreach(ARCH_INCDIR ${CONTENTS})
|
||||||
|
get_filename_component(SUB_ELEMENT ${ARCH_INCDIR} NAME)
|
||||||
|
nuttx_create_symlink(${NUTTX_DIR}/arch/${CONFIG_ARCH}/include/${SUB_ELEMENT}
|
||||||
|
${CMAKE_BINARY_DIR}/include/arch/${SUB_ELEMENT})
|
||||||
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT EXISTS ${CMAKE_BINARY_DIR}/include_arch/arch/board)
|
if(NOT EXISTS ${CMAKE_BINARY_DIR}/include/arch/board)
|
||||||
if(EXISTS ${NUTTX_BOARD_DIR}/include)
|
if(EXISTS ${NUTTX_BOARD_DIR}/include)
|
||||||
nuttx_create_symlink(${NUTTX_BOARD_DIR}/include
|
nuttx_create_symlink(${NUTTX_BOARD_DIR}/include
|
||||||
${CMAKE_BINARY_DIR}/include_arch/arch/board)
|
${CMAKE_BINARY_DIR}/include/arch/board)
|
||||||
elseif(EXISTS ${NUTTX_BOARD_DIR}/../common/include)
|
elseif(EXISTS ${NUTTX_BOARD_DIR}/../common/include)
|
||||||
nuttx_create_symlink(${NUTTX_BOARD_DIR}/../common/include
|
nuttx_create_symlink(${NUTTX_BOARD_DIR}/../common/include
|
||||||
${CMAKE_BINARY_DIR}/include_arch/arch/board)
|
${CMAKE_BINARY_DIR}/include/arch/board)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT EXISTS ${CMAKE_BINARY_DIR}/include_arch/arch/chip)
|
if(NOT EXISTS ${CMAKE_BINARY_DIR}/include/arch/chip)
|
||||||
if(CONFIG_ARCH_CHIP_CUSTOM)
|
if(CONFIG_ARCH_CHIP_CUSTOM)
|
||||||
execute_process(
|
nuttx_create_symlink(${NUTTX_CHIP_ABS_DIR}/include
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${NUTTX_CHIP_ABS_DIR}/include
|
${CMAKE_BINARY_DIR}/include/arch/chip)
|
||||||
${CMAKE_BINARY_DIR}/include_arch/arch/chip)
|
|
||||||
else()
|
else()
|
||||||
execute_process(
|
nuttx_create_symlink(
|
||||||
COMMAND
|
${NUTTX_DIR}/arch/${CONFIG_ARCH}/include/${CONFIG_ARCH_CHIP}
|
||||||
${CMAKE_COMMAND} -E copy_directory
|
${CMAKE_BINARY_DIR}/include/arch/chip)
|
||||||
${NUTTX_DIR}/arch/${CONFIG_ARCH}/include/${CONFIG_ARCH_CHIP}
|
|
||||||
${CMAKE_BINARY_DIR}/include_arch/arch/chip)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue