arch/sim/cmake: remove the host specific -U when HOSTSRCS

fix macos compile hostfs.c compile issue.
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/usr/include/_string.h:131:62: error: expected function body after function declarator
  131 | char    *stpncpy(char *__dst, const char *__src, size_t __n) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
      |                                                              ^

Signed-off-by: buxiasen <buxiasen@gmail.com>
This commit is contained in:
buxiasen 2024-10-22 02:09:29 +08:00 committed by Xiang Xiao
parent f07aba5c1e
commit 105d47b9a6
2 changed files with 20 additions and 10 deletions

View file

@ -38,16 +38,19 @@ endif()
# macOS is built with __APPLE__. We #undef predefined macros for those possible
# host OSes here because the OS APIs this library should use are of NuttX, not
# the host OS.
add_compile_options(
-U_AIX
-U_WIN32
-U__APPLE__
-U__FreeBSD__
-U__NetBSD__
-U__linux__
-U__sun__
-U__unix__
-U__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
set(SIM_NO_HOST_OPTIONS
-U_AIX
-U_WIN32
-U__APPLE__
-U__FreeBSD__
-U__NetBSD__
-U__linux__
-U__sun__
-U__unix__
-U__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
add_compile_options(${SIM_NO_HOST_OPTIONS})
set(NO_LTO "-fno-lto")

View file

@ -288,4 +288,11 @@ endforeach()
set(HOSTSRCS ${WINHOSTSRCS})
target_sources(nuttx PRIVATE ${HOSTSRCS})
get_target_property(HOST_COMPILE_OPTIONS nuttx COMPILE_OPTIONS)
foreach(remove_item IN LISTS SIM_NO_HOST_OPTIONS)
list(REMOVE_ITEM HOST_COMPILE_OPTIONS ${remove_item})
endforeach()
set_target_properties(nuttx PROPERTIES COMPILE_OPTIONS
"${HOST_COMPILE_OPTIONS}")
target_compile_definitions(nuttx PRIVATE ${HOST_DEFINITIONS})