Skip to content

Commit c191e94

Browse files
compnerdshahmishal
authored andcommitted
build: allow falling back to just built compiler
When the native tools are sparse, and the toolchain is not being cross-compiled, it is possible to fallback to the just built compiler for running the tests. Adjust the build rules to permit this. (cherry picked from commit 86ddf43)
1 parent e44f3fc commit c191e94

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

stdlib/cmake/modules/SwiftSource.cmake

+5-1
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,11 @@ function(_compile_swift_files
580580
endif()
581581

582582
set(line_directive_tool "${SWIFT_SOURCE_DIR}/utils/line-directive")
583-
set(swift_compiler_tool "${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/swiftc")
583+
if(EXISTS "${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/swiftc")
584+
set(swift_compiler_tool "${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/swiftc")
585+
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL CMAKE_SYSTEM_NAME)
586+
set(swift_compiler_tool "${SWIFT_RUNTIME_OUTPUT_INTDIR}/swiftc")
587+
endif()
584588
set(swift_compiler_tool_dep)
585589
if(SWIFT_INCLUDE_TOOLS)
586590
# Depend on the binary itself, in addition to the symlink.

test/CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ function(get_test_dependencies SDK result_var_name)
107107
list(APPEND deps ${deps_binaries})
108108
else()
109109
foreach(binary ${deps_binaries})
110-
list(APPEND deps "${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/${binary}${CMAKE_EXECUTABLE_SUFFIX}")
110+
if(EXISTS "${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/${binary}${CMAKE_EXECUTABLE_SUFFIX}")
111+
list(APPEND deps "${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/${binary}${CMAKE_EXECUTABLE_SUFFIX}")
112+
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL CMAKE_SYSTEM_NAME)
113+
list(APPEND deps "${SWIFT_RUNTIME_OUTPUT_INTDIR}/${binary}${CMAKE_EXECUTABLE_SUFFIX}")
114+
endif()
111115
endforeach()
112116
endif()
113117

0 commit comments

Comments
 (0)