-
-
Notifications
You must be signed in to change notification settings - Fork 23.9k
Fix scons compability on enabling C++ 20 module
#107200
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
base: master
Are you sure you want to change the base?
Fix scons compability on enabling C++ 20 module
#107200
Conversation
bruvzg
left a comment
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 overcomplicated for no reason, it won't be usable for iOS/visionOS and for macOS we can simply do:
diff --git a/drivers/metal/SCsub b/drivers/metal/SCsub
index a4c1c65b82..68e281b9bb 100644
--- a/drivers/metal/SCsub
+++ b/drivers/metal/SCsub
@@ -1,5 +1,6 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
+from methods import is_apple_clang
Import("env")
@@ -40,7 +41,8 @@ if "-std=gnu++17" in env_metal["CXXFLAGS"]:
env_metal.Append(CXXFLAGS=["-std=c++20"])
# Enable module support
-env_metal.Append(CCFLAGS=["-fmodules", "-fcxx-modules"])
+if env["platform"] != "macos" or is_apple_clang(env):
+ env_metal.Append(CCFLAGS=["-fmodules", "-fcxx-modules"])
# Driver source files|
I do not know if there are need to test other compilers such as |
|
I have also just created build containers that work fine with these flags on Linux per this PR, so I am not sure why these need to be changed. I don't believe the root cause is these flags. |
I also agree. However since I am still new to these, I am quite not sure if this just Homebrew's clang causing the problem or not. Edit: I would rather call this PR a fix for compability, but not fixing the root cause 🧐. |
|
What's the point of using upstream clang instead of Apple-clang in a first place? Installing and using Homebrew require installing Xcode command line tools, so you already have Apple-clang installed anyway. |
(Some copied from #107199 (comment)) Since it is off-topic, so I would say for personal use. |
Related to #107199.
Solves the compilation failure problem by adding version-detect logic to check if current compiler can enable
-fmoduleflag.This PR is not considered fixing the root cause of the #107199 currently.
Edit:
Currently, only
clangandmsvcis contained in the detecting logic, so more discussion and feedback from #107199 are needed.