-
Notifications
You must be signed in to change notification settings - Fork 10.5k
swift_build_support: unify CMake toolchain code #61696
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
Conversation
@swift-ci please smoke test |
d541e8c
to
c2f7bac
Compare
@swift-ci please smoke test |
c2f7bac
to
e7536f5
Compare
@swift-ci please smoke test |
@@ -366,6 +380,31 @@ def generate_linux_toolchain_file(self, platform, arch): | |||
|
|||
return toolchain_file | |||
|
|||
def generate_toolchain_file(self, host_target): |
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.
Given the usage in the cmark product, could it make sense to explicitly state that the function targets darwin and linux only? e.g.
def generate_toolchain_file(self, host_target): | |
def generate_toolchain_file_for_darwin_and_linux(self, host_target): |
self.cmake_options.define('CMAKE_CXX_FLAGS', common_c_flags) | ||
|
||
toolchain_file = None | ||
if self.is_darwin_host(host_target): |
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.
I like this refactoring, nice catch!
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.
Looks good to me. Nice refactor.
e7536f5
to
99dedee
Compare
@swift-ci please smoke test |
@swift-ci please test Windows |
1 similar comment
@swift-ci please test Windows |
Verified that this builds successfully in different configurations. |
Currently, a lot of products defined in
utils/swift_build_support
contain duplicated code that checks for Darwin/Linux triples and generates an appropriate CMake toolchain file. Since all of these products inherit from theProduct
class, it makes sense to reduce this code duplication by refactoring it into a single function.