Skip to content

[CMake] Update host platform check for macro support #68224

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 1 commit into from
Aug 31, 2023
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 CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ if(SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR)
set(SWIFT_SWIFT_PARSER TRUE)
include(${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_TARGETS})

if(SWIFT_HOST_VARIANT_SDK STREQUAL "LINUX" AND NOT BOOTSTRAPPING_MODE STREQUAL "HOSTTOOLS")
if(SWIFT_HOST_VARIANT_SDK MATCHES "LINUX|ANDROID|OPENBSD|FREEBSD" AND NOT BOOTSTRAPPING_MODE STREQUAL "HOSTTOOLS")
# Only "HOSTTOOLS" is supported in Linux when Swift parser integration is enabled.
message(WARNING "Force setting BOOTSTRAPPING=HOSTTOOLS because Swift parser integration is enabled")
set(BOOTSTRAPPING_MODE "HOSTTOOLS")
Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/AddPureSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function(_add_host_swift_compile_options name)
endfunction()

function(_set_pure_swift_link_flags name relpath_to_lib_dir)
if(SWIFT_HOST_VARIANT_SDK STREQUAL "LINUX")
if(SWIFT_HOST_VARIANT_SDK MATCHES "LINUX|ANDROID|OPENBSD|FREEBSD")
# Don't add builder's stdlib RPATH automatically.
target_compile_options(${name} PRIVATE
$<$<COMPILE_LANGUAGE:Swift>:-no-toolchain-stdlib-rpath>
Expand Down Expand Up @@ -291,7 +291,7 @@ function(add_pure_swift_host_tool name)
set_property(TARGET ${name}
APPEND PROPERTY INSTALL_RPATH
"@executable_path/../lib/swift/host")
else()
elseif(SWIFT_HOST_VARIANT_SDK MATCHES "LINUX|ANDROID|OPENBSD|FREEBSD")
set_property(TARGET ${name}
APPEND PROPERTY INSTALL_RPATH
"$ORIGIN/../lib/swift/host")
Expand Down
2 changes: 1 addition & 1 deletion lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ if (SWIFT_SWIFT_PARSER)
# be found via RPATH.
foreach (sharedlib ${SWIFT_SYNTAX_SHARED_LIBRARIES})
set(add_origin_rpath)
if(SWIFT_HOST_VARIANT_SDK STREQUAL "LINUX")
if(SWIFT_HOST_VARIANT_SDK MATCHES "LINUX|ANDROID|OPENBSD|FREEBSD")
# At runtime, use swiftCore in the current toolchain.
swift_get_set_rpath_script_file(setrpath_command)
set(add_origin_rpath COMMAND ${CMAKE_COMMAND}
Expand Down
2 changes: 1 addition & 1 deletion lib/Macros/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function(add_swift_macro_library name)
_set_pure_swift_link_flags(${name} "${relpath_to_lib}")

# Add rpath to 'lib/host'
if(SWIFT_HOST_VARIANT_SDK STREQUAL "LINUX")
if(SWIFT_HOST_VARIANT_SDK MATCHES "LINUX|ANDROID|OPENBSD|FREEBSD")
set_property(TARGET ${name}
APPEND PROPERTY INSTALL_RPATH "$ORIGIN/..")
endif()
Expand Down