NuttX cmake improvements

- fix temporary Make.defs copy
 - implement custom macros for COMPILE, COMPILEXX, ASSEMBLE, ARCHIVE to enable ccache properly (if available and enabled)
 - fix NuttX mkdeps
 - fix libapps race condition with context
This commit is contained in:
Daniel Agar
2019-11-16 10:08:04 -05:00
parent b5e7e4bc17
commit df73a6667d
11 changed files with 78 additions and 65 deletions

View File

@@ -13,19 +13,21 @@ set(CMAKE_C_COMPILER_TARGET ${triple})
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
set(CMAKE_CXX_COMPILER_TARGET ${triple})
set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
set(CMAKE_ASM_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
# needed for test compilation
set(CMAKE_EXE_LINKER_FLAGS_INIT "--specs=nosys.specs")
# compiler tools
foreach(tool nm ld objcopy ranlib strip)
string(TOUPPER ${tool} TOOL)
find_program(CMAKE_${TOOL} ${TOOLCHAIN_PREFIX}-${tool})
if(CMAKE-${TOOL} MATCHES "NOTFOUND")
message(FATAL_ERROR "could not find ${TOOLCHAIN_PREFIX}-${tool}")
endif()
endforeach()
find_program(CMAKE_AR ${TOOLCHAIN_PREFIX}-gcc-ar)
find_program(CMAKE_GDB ${TOOLCHAIN_PREFIX}-gdb)
find_program(CMAKE_LD ${TOOLCHAIN_PREFIX}-ld)
find_program(CMAKE_LINKER ${TOOLCHAIN_PREFIX}-ld)
find_program(CMAKE_NM ${TOOLCHAIN_PREFIX}-gcc-nm)
find_program(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}-objcopy)
find_program(CMAKE_OBJDUMP ${TOOLCHAIN_PREFIX}-objdump)
find_program(CMAKE_RANLIB ${TOOLCHAIN_PREFIX}-gcc-ranlib)
find_program(CMAKE_STRIP ${TOOLCHAIN_PREFIX}-strip)
set(CMAKE_FIND_ROOT_PATH get_file_component(${CMAKE_C_COMPILER} PATH))
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
@@ -40,9 +42,3 @@ foreach(tool grep make)
message(FATAL_ERROR "could not find ${tool}")
endif()
endforeach()
# optional compiler tools
foreach(tool gdb gdbtui)
string(TOUPPER ${tool} TOOL)
find_program(${TOOL} arm-none-eabi-${tool})
endforeach()