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
|
@ -37,9 +37,8 @@ function(nuttx_add_library_internal target)
|
|||
|
||||
# add main include directories
|
||||
target_include_directories(
|
||||
${target} SYSTEM
|
||||
PRIVATE ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include
|
||||
${CMAKE_BINARY_DIR}/include_arch)
|
||||
${target} SYSTEM PRIVATE ${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_BINARY_DIR}/include)
|
||||
|
||||
# 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
|
||||
|
|
|
@ -54,8 +54,7 @@ macro(define_allsyms_link_target inter_target dep_target allsyms_file)
|
|||
)
|
||||
endif()
|
||||
target_sources(nuttx PRIVATE ${ALLSYMS_SOURCE})
|
||||
set(ALLSYMS_INCDIR ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include
|
||||
${CMAKE_BINARY_DIR}/include_arch)
|
||||
set(ALLSYMS_INCDIR ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include)
|
||||
set_source_files_properties(
|
||||
${ALLSYMS_SOURCE} PROPERTIES INCLUDE_DIRECTORIES "${ALLSYMS_INCDIR}")
|
||||
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
|
||||
target_include_directories(
|
||||
${inter_target} SYSTEM
|
||||
PUBLIC ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include
|
||||
${CMAKE_BINARY_DIR}/include_arch)
|
||||
${inter_target} SYSTEM PUBLIC ${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_BINARY_DIR}/include)
|
||||
target_compile_definitions(
|
||||
${inter_target} PRIVATE $<TARGET_PROPERTY:nuttx,NUTTX_KERNEL_DEFINITIONS>)
|
||||
target_compile_options(
|
||||
|
|
|
@ -35,42 +35,40 @@ include(nuttx_mkversion)
|
|||
|
||||
# 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)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
|
||||
${CMAKE_BINARY_DIR}/include_apps)
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS ${CMAKE_BINARY_DIR}/include/arch)
|
||||
nuttx_create_symlink(${NUTTX_DIR}/arch/${CONFIG_ARCH}/include
|
||||
${CMAKE_BINARY_DIR}/include/arch)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
|
||||
${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()
|
||||
|
||||
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)
|
||||
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)
|
||||
nuttx_create_symlink(${NUTTX_BOARD_DIR}/../common/include
|
||||
${CMAKE_BINARY_DIR}/include_arch/arch/board)
|
||||
${CMAKE_BINARY_DIR}/include/arch/board)
|
||||
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)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${NUTTX_CHIP_ABS_DIR}/include
|
||||
${CMAKE_BINARY_DIR}/include_arch/arch/chip)
|
||||
nuttx_create_symlink(${NUTTX_CHIP_ABS_DIR}/include
|
||||
${CMAKE_BINARY_DIR}/include/arch/chip)
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E copy_directory
|
||||
${NUTTX_DIR}/arch/${CONFIG_ARCH}/include/${CONFIG_ARCH_CHIP}
|
||||
${CMAKE_BINARY_DIR}/include_arch/arch/chip)
|
||||
nuttx_create_symlink(
|
||||
${NUTTX_DIR}/arch/${CONFIG_ARCH}/include/${CONFIG_ARCH_CHIP}
|
||||
${CMAKE_BINARY_DIR}/include/arch/chip)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
Loading…
Reference in New Issue