-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Buildsystem: Refactor compiler detection code #99217
Buildsystem: Refactor compiler detection code #99217
Conversation
SConstruct
Outdated
vanilla = True | ||
|
||
if env["platform"] == "macos" or env["platform"] == "ios": | ||
vanilla = methods.is_vanilla_clang(env) |
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 also though about turning it into one line of code vanilla = methods.is_vanilla_clang(env)
because I assume it will return False
if we are not at mac but I doubt...
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.
It will return False
if you are not building for macOS/iOS, the function is simply checking if clang version string have Apple
in it.
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 know but it feels somewhat strange and hacky. If method was called is_apple_clang
which is more good name it would contain semantic of if platform == "macos"
in the name. Now if you fold it to one line it looses its semantic... And I doubt that renaming it is allowed because someone who builds custom godot for macos with a big chance relies on it. If I am allowed to rename it I will gladly do it
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 think it's ok to rename it, compatibility is important for documented public API, but this is an internal build system method.
What is the benefit of deleting old gcc 8 versions? RHEL8, Alma Linux 8 and Rocky 8 still use gcc 8.
|
We already require minimum gcc 9: Lines 642 to 650 in 76fa7b2
So having a check if compiler is < 8 doesn't have any sense |
88982f6
to
a53adb1
Compare
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.
The only risk is if the is_apple_clang
method is not 100% reliable, it might then wrongly flag actual Apple clang builds as not Apple (other false negatives wouldn't be a problem). So this needs to be tested on macOS and with osxcross cross-compilation on Linux just to be sure.
This could also affect console platforms that use clang toolchains and could be misidentified. I would lean towards being a bit more paranoid about using both |
I think the risk is when using Xcode actually, because if anything goes wrong, If it returns So other platforms shouldn't be affected. BTW I just tested with osxcross, and it doesn't identify itself as "AppleClang", and its version string is the one of vanilla LLVM (despite me building the Apple fork of Clang), so it seems like this is really for Xcode's weird versioning that we need the
That being said, while probably unnecessary, I see no harm in adding a platform check in |
* Delete old check for gcc 8 as we support 9 or higher * Flatten branches for clang and apple clang * Renamed is_vanilla_clang to is_apple_clang to be more clear Signed-off-by: Yevhen Babiichuk (DustDFG) <[email protected]>
a53adb1
to
d55ed0c
Compare
I just curious about why |
It is, but since it was only used for macOS/iOS, and it's in support of a very niche use case (far most users building for macOS/iOS do it with Xcode on macOS which isn't vanilla LLVM/Clang), it wasn't as problematic if it's misidentified. When flipping the meaning to cover what is the expected toolchain for 99% of use cases, we need to make sure it's reliable. |
Thanks! |
Follow up to: godotengine#99217 and godotengine#98842 Signed-off-by: Yevhen Babiichuk (DustDFG) <[email protected]> Co-authored-by: Thaddeus Crews <[email protected]>
I don't have mac so couldn't normally check. I synthetically set relevant variables to all possible values to check if it works and it works but how it will behave it normal environment
¯\_(ツ)_/¯