-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add Toolchain
variable to makefile
#1275
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
This makes it much easier to switch to a Mingw compiler build. It also adds basic support for explicitly specifying GCC or Clang compiler toolchains. This can be built upon for other compiler specific settings, such as warning flags.
Use `PkgConfig` for all environments. This is needed for Mingw cross compiles. It can also be useful for Linux native compiles when using updated source built packages for SDL, rather than the system installed packages.
If the `PkgConfig` specified tool can not be found, then simply skip it. We don't want to see warnings in those cases. Assume the environment is setup specifically for the type of build being done, and has minimal tooling installed. In particular, assume the environment has a specific `Toolchain` installed, and no tooling to support alternative toolchains. This is the case for the CI builds, which are run from Docker images, with only the one toolchain installed.
This allows us to make better use of different warning flags supported by different compilers. We no longer need to stick to a base set of warnings supported by all supported compilers.
Add sets of disabled warning flags for allowed Clang warnings and known Clang warnings. These warnings may be of occasional interest, so we may want to enable to disable them separately from other flags. These flags are not part of a failure set for warnings, but may be of interest when scanning to show known warnings. Allowed warnings are distinct from warnings that will never be of any interest, such as warning about code being incompatible with obsolete C++ standards which we don't target. Known warnings are things we might like to fix, but haven't addressed yet.
This enables many more warnings for Clang when building explicitly with `Toolchain=clang`.
Of note, this change increases the warnings flags being used by the Clang build.
This makes it easier to compiler locally using the increased set of warning flags. It still needs an explicit `Toolchain` selection, though that's much easier to remember and type than the warning flags.
This was referenced Mar 9, 2025
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.
Add a
Toolchain
variable to themakefile
, which can be used to easily switch betweengcc
,clang
, andmingw
.This can auto set the compiler (
CXX
),pkg-config
tool, warnings appropriate for the compiler, and target OS.The main motivation for this change was to make it easier to run Mingw builds in a local Linux environment. It was found this support also makes it easy to switch warning flags too. In particular, a base set of warning flags were being used that was common to all supported compilers. Instead, now we can set warning flags that are specific to the compiler
Toolchain
that is selected, allowing for much more stringent checks, by default.Related:
makefile
experience for Mingw and MacOS #1241