You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2025/11/30 12:44:05 UTC
(nuttx) 01/02: libm/newlib: Add duplicate filename filtering for source lists
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit d956699f75dc6d3c68158c6fefd268c09b027d14
Author: fangxinyong <fa...@xiaomi.com>
AuthorDate: Sun Oct 26 17:30:12 2025 +0800
libm/newlib: Add duplicate filename filtering for source lists
Implement filename-based filtering to exclude duplicate files
from source lists, ensuring ARCH-specific files (ARCH_CSRCS)
take precedence over files in common or other dirs
Signed-off-by: fangxinyong <fa...@xiaomi.com>
---
libs/libm/newlib/CMakeLists.txt | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/libs/libm/newlib/CMakeLists.txt b/libs/libm/newlib/CMakeLists.txt
index 42dc472ba25..c05c578c6fa 100644
--- a/libs/libm/newlib/CMakeLists.txt
+++ b/libs/libm/newlib/CMakeLists.txt
@@ -97,7 +97,7 @@ if(CONFIG_LIBM_NEWLIB)
file(GLOB_RECURSE ARCH_CSRCS ${NEWLIB_DIR}/newlib/libm/fenv/*.c)
endif()
- set(CSRCS ${COMMON_CSRCS} ${COMPLEX_CSRCS} ${ARCH_CSRCS})
+ set(CSRCS ${COMMON_CSRCS} ${COMPLEX_CSRCS})
# aggressive optimisation can replace occurrences of sinl() and cosl() with
# sincosl(), but sincosl() is missing in newlib which causes error. So let's
@@ -123,6 +123,23 @@ if(CONFIG_LIBM_NEWLIB)
list(APPEND CSRCS ${MATH_CSRCS})
endif()
+ set(ARCH_FILENAMES "")
+ foreach(arch_file ${ARCH_CSRCS})
+ get_filename_component(arch_filename ${arch_file} NAME)
+ list(APPEND ARCH_FILENAMES ${arch_filename})
+ endforeach()
+
+ set(FILTERED_CSRCS "")
+ foreach(file ${CSRCS})
+ get_filename_component(filename ${file} NAME)
+ list(FIND ARCH_FILENAMES ${filename} index)
+ if(index EQUAL -1)
+ list(APPEND FILTERED_CSRCS ${file})
+ endif()
+ endforeach()
+
+ set(CSRCS ${FILTERED_CSRCS} ${ARCH_CSRCS})
+
# ############################################################################
# Include Directory
# ############################################################################