Skip to content

Plumb native-clang-tools-path to build support. #81587

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
Jun 30, 2025
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
10 changes: 6 additions & 4 deletions utils/swift_build_support/swift_build_support/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,15 @@ def common_options(self, product=None):
define("CMAKE_CXX_COMPILER_LAUNCHER:PATH", args.cmake_cxx_launcher)

if self.prefer_native_toolchain and product:
clang_tools_path = product.native_clang_tools_path(args.host_target)
define("CMAKE_C_COMPILER:PATH", os.path.join(clang_tools_path,
'bin', 'clang'))
define("CMAKE_CXX_COMPILER:PATH", os.path.join(clang_tools_path,
'bin', 'clang++'))

toolchain_path = product.native_toolchain_path(args.host_target)
cmake_swiftc_path = os.getenv('CMAKE_Swift_COMPILER',
os.path.join(toolchain_path, 'bin', 'swiftc'))
define("CMAKE_C_COMPILER:PATH", os.path.join(toolchain_path,
'bin', 'clang'))
define("CMAKE_CXX_COMPILER:PATH", os.path.join(toolchain_path,
'bin', 'clang++'))
define("CMAKE_Swift_COMPILER:PATH", cmake_swiftc_path)
else:
cmake_swiftc_path = os.getenv('CMAKE_Swift_COMPILER', toolchain.swiftc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ def install_toolchain_path(self, host_target):
return targets.toolchain_path(install_destdir,
self.args.install_prefix)

def native_clang_tools_path(self, host_target):
if self.args.native_clang_tools_path is not None:
return os.path.split(self.args.native_clang_tools_path)[0]
else:
return self.install_toolchain_path(host_target)

def native_toolchain_path(self, host_target):
if self.args.native_swift_tools_path is not None:
return os.path.split(self.args.native_swift_tools_path)[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ def run_bootstrap_script(
self.source_dir, 'Utilities', 'bootstrap')

toolchain_path = self.native_toolchain_path(host_target)
clang_tools_path = self.native_clang_tools_path(host_target)
swiftc = os.path.join(toolchain_path, "bin", "swiftc")
clang = os.path.join(toolchain_path, "bin", "clang")
clang = os.path.join(clang_tools_path, "bin", "clang")

# FIXME: We require llbuild build directory in order to build. Is
# there a better way to get this?
Expand Down