-
Notifications
You must be signed in to change notification settings - Fork 0
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
[ESD-1931] Common compiler flags #74
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jbangelo
approved these changes
Feb 1, 2021
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. This will make things a lot more clean in our CMake files, and will help ensure we're more uniformly applying compiler options. Thanks for tackling this @woodfell !!
silverjam
approved these changes
Feb 3, 2021
This was referenced Dec 13, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A long standing desire has been to have a common set of compiler flags for use with all Swift code. This has been tried several times in the past but never been finished, most recently by Rodrigo on whose work this PR is distantly based.
Rodrigo's work set compiler flags in the
LanguageStandards
module so that it would be automatically applied to everything that uses it. This is probably the way that it should be eventually, but to ease the transition I've broken it out to a separate moduleCompileOptions
which can be applied to targets gradually until everything is up to date.The set of compiler flags is taken from high level projects like starling and swiftlets. This means that low level libraries are now compiled with many more flags than they used to be (a good thing).
The exported function
swift_set_compile_options
can be called for any target. There are several options available for tailoring the set of options actually passed to the compiler, they should be fairly self explanatory.All flags are verified against the compiler before actually being set. This is vital due to the massively diverse selection of compilers we have to cope with. Of particular note is a CI stage in (I think) libswiftnav which uses clang for C sources and gcc for c++.
So far I've tested and verified this module with every project up to and including starling and PFWP. As part of this work I've also been updating the
.clang-tidy
config for each project (many low level libraries didn't have one at all). This means that once this module is merged and all submodules updates Swift code will be in such a state that we no longer need to set internal projects as system includes. There aren't any compiler warnings or clang-tidy errors.This will remain open until everything else has been proven, which hopefully won't be too long.