-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[build] Make it possible to actually build the stdlib with a prebuilt clang #34628
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
Changes from all commits
bd81fb8
c74884c
934823a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -481,10 +481,12 @@ if(SWIFT_PATH_TO_CMARK_BUILD) | |
| endif() | ||
| message(STATUS "") | ||
|
|
||
| if("${SWIFT_NATIVE_LLVM_TOOLS_PATH}" STREQUAL "") | ||
| set(SWIFT_CROSS_COMPILING FALSE) | ||
| # Check if a prebuilt clang path was passed in, as this variable will be | ||
| # assigned if not, in SwiftSharedCMakeConfig. | ||
| if("${SWIFT_NATIVE_CLANG_TOOLS_PATH}" STREQUAL "") | ||
| set(SWIFT_PREBUILT_CLANG FALSE) | ||
| else() | ||
| set(SWIFT_CROSS_COMPILING TRUE) | ||
| set(SWIFT_PREBUILT_CLANG TRUE) | ||
| endif() | ||
|
||
|
|
||
| include(SwiftSharedCMakeConfig) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1669,7 +1669,8 @@ function(add_swift_target_library name) | |
| list(APPEND SWIFTLIB_SWIFT_COMPILE_FLAGS "-warn-implicit-overrides") | ||
| endif() | ||
|
|
||
| if(NOT SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER AND NOT BUILD_STANDALONE) | ||
| if(NOT SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER AND NOT BUILD_STANDALONE AND | ||
| NOT SWIFT_PREBUILT_CLANG) | ||
|
||
| list(APPEND SWIFTLIB_DEPENDS clang) | ||
| endif() | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,7 +111,8 @@ endif() | |
| # First extract the "version" used for Clang's resource directory. | ||
| string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION | ||
| "${LLVM_PACKAGE_VERSION}") | ||
| if(NOT SWIFT_INCLUDE_TOOLS AND SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER) | ||
| if(NOT SWIFT_INCLUDE_TOOLS AND | ||
| (SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER OR SWIFT_PREBUILT_CLANG)) | ||
|
||
| if(SWIFT_COMPILER_IS_MSVC_LIKE) | ||
| execute_process(COMMAND ${CMAKE_C_COMPILER} /clang:-print-resource-dir | ||
| OUTPUT_VARIABLE clang_headers_location | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -167,8 +167,11 @@ def install_toolchain_path(self, host_target): | |
| """toolchain_path() -> string | ||
|
|
||
| Returns the path to the toolchain that is being created as part of this | ||
| build. | ||
| build, or to a native prebuilt toolchain that was passed in. | ||
|
||
| """ | ||
| if self.args.native_swift_tools_path is not None: | ||
| return os.path.split(self.args.native_swift_tools_path)[0] | ||
|
|
||
| install_destdir = self.args.install_destdir | ||
| if self.args.cross_compile_hosts: | ||
| build_root = os.path.dirname(self.build_dir) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shahmishal, I believe the only reason this was set was because
SWIFT_NATIVE_LLVM_TOOLS_PATHwas used to find clang instdlib/CMakeLists.txtbelow. However, since that was a mistake that I tried to fix in #34437, I now use this clang path check andSWIFT_PREBUILT_CLANGhere and incmake/modules/SwiftSharedCMakeConfig.cmakeinstead. I believe thisSWIFT_PREBUILT_CLANGis a better variable name as the clang might not just be passed in for cross-compiling, but also for natively building the standalone stdlib, as this pull was originally meant for.