This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 7673cfcefbfcacaa03a93254ed03ed32d12c602e Author: zhangyuan29 <[email protected]> AuthorDate: Sat Oct 11 15:24:55 2025 +0800 cmake: add tasking libm when config CONFIG_LIBM_TOOLCHAIN Define nuttx_find_toolchain_lib to locate a library under the TASKING installation (derived from the compiler path) and hook it into platform.cmake: with CONFIG_LIBM_TOOLCHAIN the toolchain libm.a is added as an extra library instead of the nuttx build. Signed-off-by: zhangyuan29 <[email protected]> --- arch/tricore/src/cmake/platform.cmake | 3 +++ arch/tricore/src/cmake/tasking.cmake | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/arch/tricore/src/cmake/platform.cmake b/arch/tricore/src/cmake/platform.cmake index e2029f07748..4502bb34b3f 100644 --- a/arch/tricore/src/cmake/platform.cmake +++ b/arch/tricore/src/cmake/platform.cmake @@ -70,4 +70,7 @@ if(CONFIG_TRICORE_TOOLCHAIN_TASKING) set(PREPROCESS ${TASKING_COMPILER_PATH} ${CMAKE_C_FLAG_ARGS} -E -I${TOOLCHAIN_PREFIX}/../include.lsl -I${C_COMPILER_DIR}/../include.lsl) + if(CONFIG_LIBM_TOOLCHAIN) + nuttx_find_toolchain_lib(libm.a) + endif() endif() diff --git a/arch/tricore/src/cmake/tasking.cmake b/arch/tricore/src/cmake/tasking.cmake index daf69a2295a..ebd63f2358e 100644 --- a/arch/tricore/src/cmake/tasking.cmake +++ b/arch/tricore/src/cmake/tasking.cmake @@ -157,3 +157,14 @@ set(TASKING_WARNINGS 500,507,508,525,526,527,529,544,549,553,560,562,557,558,587,588,589) add_compile_options(--pass-c=--no-warnings=${TASKING_WARNINGS}) + +set(NUTTX_FIND_TOOLCHAIN_LIB_DEFINED true) +function(nuttx_find_toolchain_lib) + get_filename_component(TASKING_ROOT_PATH "${CMAKE_C_COMPILER}" DIRECTORY) + string(REGEX REPLACE "^/([a-zA-Z])/(.*)$" "\\1:/\\2" TASKING_ROOT_TEMP_PATH + "${TASKING_ROOT_PATH}") + string(STRIP "${TASKING_ROOT_TEMP_PATH}" TASKING_ROOT_PATH) + if(ARGN) + nuttx_add_extra_library(${TASKING_ROOT_PATH}/../lib/tc18/${ARGN}) + endif() +endfunction()
