Skip to content

Add SWIFT_PLATFORMS_USING_ISYSROOT to list platforms that should be building with -isysroot #33469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function(_add_host_variant_c_compile_link_flags name)

set(_sysroot
"${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}")
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
if(SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_USE_ISYSROOT)
target_compile_options(${name} PRIVATE -isysroot;${_sysroot})
elseif(NOT SWIFT_COMPILER_IS_MSVC_LIKE AND NOT "${_sysroot}" STREQUAL "/")
target_compile_options(${name} PRIVATE --sysroot=${_sysroot})
Expand Down
5 changes: 5 additions & 0 deletions cmake/modules/SwiftConfigureSDK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ endfunction()
# SWIFT_SDK_${prefix}_LIB_SUBDIR Library subdir for this SDK
# SWIFT_SDK_${prefix}_VERSION_MIN_NAME Version min name for this SDK
# SWIFT_SDK_${prefix}_TRIPLE_NAME Triple name for this SDK
# SWIFT_SDK_${prefix}_OBJECT_FORMAT The object file format (e.g. MACHO)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah! I think you put this in the wrong commit 🤷‍♂️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this was an intentional drive-by addition :) It seemed to be missing...

# SWIFT_SDK_${prefix}_USE_ISYSROOT Whether to use -isysroot
# SWIFT_SDK_${prefix}_ARCHITECTURES Architectures (as a list)
# SWIFT_SDK_${prefix}_IS_SIMULATOR Whether this is a simulator target.
# SWIFT_SDK_${prefix}_ARCH_${ARCH}_TRIPLE Triple name
Expand Down Expand Up @@ -187,6 +189,7 @@ macro(configure_sdk_darwin
set(SWIFT_SDK_${prefix}_VERSION_MIN_NAME "${version_min_name}")
set(SWIFT_SDK_${prefix}_TRIPLE_NAME "${triple_name}")
set(SWIFT_SDK_${prefix}_OBJECT_FORMAT "MACHO")
set(SWIFT_SDK_${prefix}_USE_ISYSROOT TRUE)

set(SWIFT_SDK_${prefix}_ARCHITECTURES ${architectures})
if(SWIFT_DARWIN_SUPPORTED_ARCHS)
Expand Down Expand Up @@ -270,6 +273,7 @@ macro(configure_sdk_unix name architectures)
else()
set(SWIFT_SDK_${prefix}_OBJECT_FORMAT "ELF")
endif()
set(SWIFT_SDK_${prefix}_USE_ISYSROOT FALSE)

foreach(arch ${architectures})
if("${prefix}" STREQUAL "ANDROID")
Expand Down Expand Up @@ -432,6 +436,7 @@ macro(configure_sdk_windows name environment architectures)
set(SWIFT_SDK_${prefix}_LIB_SUBDIR "windows")
set(SWIFT_SDK_${prefix}_ARCHITECTURES "${architectures}")
set(SWIFT_SDK_${prefix}_OBJECT_FORMAT "COFF")
set(SWIFT_SDK_${prefix}_USE_ISYSROOT FALSE)

foreach(arch ${architectures})
if(arch STREQUAL armv7)
Expand Down
2 changes: 1 addition & 1 deletion stdlib/cmake/modules/AddSwiftStdlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function(_add_target_variant_c_compile_link_flags)
endif()

set(_sysroot "${SWIFT_SDK_${CFLAGS_SDK}_ARCH_${CFLAGS_ARCH}_PATH}")
if(IS_DARWIN)
if(SWIFT_SDK_${CFLAGS_SDK}_USE_ISYSROOT)
list(APPEND result "-isysroot" "${_sysroot}")
elseif(NOT SWIFT_COMPILER_IS_MSVC_LIKE AND NOT "${_sysroot}" STREQUAL "/")
list(APPEND result "--sysroot=${_sysroot}")
Expand Down