File tree Expand file tree Collapse file tree 6 files changed +39
-9
lines changed
swift_build_support/swift_build_support/products Expand file tree Collapse file tree 6 files changed +39
-9
lines changed Original file line number Diff line number Diff line change @@ -112,11 +112,11 @@ else()
112
112
# If we use Clang-cl or MSVC, CMake provides default compiler and linker flags that are incompatible
113
113
# with the frontend of Clang or Clang++.
114
114
if (SWIFT_COMPILER_IS_MSVC_LIKE )
115
- set (CMAKE_CXX_COMPILER "${SWIFT_NATIVE_LLVM_TOOLS_PATH } /clang-cl" )
116
- set (CMAKE_C_COMPILER "${SWIFT_NATIVE_LLVM_TOOLS_PATH } /clang-cl" )
115
+ set (CMAKE_CXX_COMPILER "${SWIFT_NATIVE_CLANG_TOOLS_PATH } /clang-cl" )
116
+ set (CMAKE_C_COMPILER "${SWIFT_NATIVE_CLANG_TOOLS_PATH } /clang-cl" )
117
117
else ()
118
- set (CMAKE_CXX_COMPILER "${SWIFT_NATIVE_LLVM_TOOLS_PATH } /clang++" )
119
- set (CMAKE_C_COMPILER "${SWIFT_NATIVE_LLVM_TOOLS_PATH } /clang" )
118
+ set (CMAKE_CXX_COMPILER "${SWIFT_NATIVE_CLANG_TOOLS_PATH } /clang++" )
119
+ set (CMAKE_C_COMPILER "${SWIFT_NATIVE_CLANG_TOOLS_PATH } /clang" )
120
120
endif ()
121
121
122
122
if (CMAKE_C_COMPILER_LAUNCHER MATCHES ".*distcc" )
Original file line number Diff line number Diff line change @@ -13,11 +13,11 @@ if(("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "${SWIFT_PRIMARY_VARIANT_SDK}") AND
13
13
# If we use Clang-cl or MSVC, CMake provides default compiler and linker flags that are incompatible
14
14
# with the frontend of Clang or Clang++.
15
15
if (SWIFT_COMPILER_IS_MSVC_LIKE )
16
- set (CMAKE_CXX_COMPILER "${SWIFT_NATIVE_LLVM_TOOLS_PATH } /clang-cl" )
17
- set (CMAKE_C_COMPILER "${SWIFT_NATIVE_LLVM_TOOLS_PATH } /clang-cl" )
16
+ set (CMAKE_CXX_COMPILER "${SWIFT_NATIVE_CLANG_TOOLS_PATH } /clang-cl" )
17
+ set (CMAKE_C_COMPILER "${SWIFT_NATIVE_CLANG_TOOLS_PATH } /clang-cl" )
18
18
else ()
19
- set (CMAKE_CXX_COMPILER "${SWIFT_NATIVE_LLVM_TOOLS_PATH } /clang++" )
20
- set (CMAKE_C_COMPILER "${SWIFT_NATIVE_LLVM_TOOLS_PATH } /clang" )
19
+ set (CMAKE_CXX_COMPILER "${SWIFT_NATIVE_CLANG_TOOLS_PATH } /clang++" )
20
+ set (CMAKE_C_COMPILER "${SWIFT_NATIVE_CLANG_TOOLS_PATH } /clang" )
21
21
endif ()
22
22
23
23
if (CMAKE_C_COMPILER_LAUNCHER MATCHES ".*distcc" )
Original file line number Diff line number Diff line change @@ -707,6 +707,18 @@ class BuildScriptInvocation(object):
707
707
impl_args += [
708
708
"--host-libtool" , toolchain .libtool ,
709
709
]
710
+ if args .native_clang_tools_path is not None :
711
+ impl_args += [
712
+ "--native-clang-tools-path=%s" % args .native_clang_tools_path
713
+ ]
714
+ if args .native_llvm_tools_path is not None :
715
+ impl_args += [
716
+ "--native-llvm-tools-path=%s" % args .native_llvm_tools_path
717
+ ]
718
+ if args .native_swift_tools_path is not None :
719
+ impl_args += [
720
+ "--native-swift-tools-path=%s" % args .native_swift_tools_path
721
+ ]
710
722
711
723
# If we have extra_swift_args, combine all of them together and then
712
724
# add them as one command.
Original file line number Diff line number Diff line change @@ -374,6 +374,15 @@ def create_argument_parser():
374
374
option ('--host-cxx' , store_path (executable = True ),
375
375
help = 'the absolute path to CXX, the "clang++" compiler for the '
376
376
'host platform. Default is auto detected.' )
377
+ option ('--native-swift-tools-path' , store_path ,
378
+ help = 'the path to a directory that contains prebuilt Swift tools '
379
+ 'that are executable on the host platform' )
380
+ option ('--native-clang-tools-path' , store_path ,
381
+ help = 'the path to a directory that contains prebuilt Clang tools '
382
+ 'that are executable on the host platform' )
383
+ option ('--native-llvm-tools-path' , store_path ,
384
+ help = 'the path to a directory that contains prebuilt LLVM tools '
385
+ 'that are executable on the host platform' )
377
386
option ('--cmake-c-launcher' , store_path (executable = True ),
378
387
default = os .environ .get ('C_COMPILER_LAUNCHER' , None ),
379
388
help = 'the absolute path to set CMAKE_C_COMPILER_LAUNCHER' )
Original file line number Diff line number Diff line change 189
189
'lto_type' : None ,
190
190
'maccatalyst' : False ,
191
191
'maccatalyst_ios_tests' : False ,
192
+ 'native_clang_tools_path' : None ,
193
+ 'native_llvm_tools_path' : None ,
194
+ 'native_swift_tools_path' : None ,
192
195
'dump_config' : False ,
193
196
'show_sdks' : False ,
194
197
'skip_build' : False ,
@@ -653,6 +656,9 @@ class BuildScriptImplOption(_BaseOption):
653
656
PathOption ('--install-symroot' ),
654
657
PathOption ('--install-destdir' ),
655
658
EnableOption ('--install-all' ),
659
+ PathOption ('--native-clang-tools-path' ),
660
+ PathOption ('--native-llvm-tools-path' ),
661
+ PathOption ('--native-swift-tools-path' ),
656
662
PathOption ('--symbols-package' ),
657
663
PathOption ('--cmake-c-launcher' ),
658
664
PathOption ('--cmake-cxx-launcher' ),
Original file line number Diff line number Diff line change @@ -167,8 +167,11 @@ def install_toolchain_path(self, host_target):
167
167
"""toolchain_path() -> string
168
168
169
169
Returns the path to the toolchain that is being created as part of this
170
- build.
170
+ build, or to a native prebuilt toolchain that was passed in .
171
171
"""
172
+ if self .args .native_swift_tools_path is not None :
173
+ return os .path .split (self .args .native_swift_tools_path )[0 ]
174
+
172
175
install_destdir = self .args .install_destdir
173
176
if self .args .cross_compile_hosts :
174
177
build_root = os .path .dirname (self .build_dir )
You can’t perform that action at this time.
0 commit comments