-
Notifications
You must be signed in to change notification settings - Fork 383
Fix #4395: Support for configurable C++ standard (e.g. C++17) when compiling C++ sources #4418
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: main
Are you sure you want to change the base?
Conversation
/** The compiler C version -std=XXX */ | ||
def compileStdC: Option[String] | ||
|
||
/** The compiler C++ version -std=XXX */ | ||
def compileStdCpp: Option[String] | ||
|
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'm wondering if maybe we should just follow the the Bazel convention here.
They're having 3 attributes (settings):
conlyopts
- Add these options to the C compilation command.
copts
- Add these options to the C/C++ compilation command.
cxxopts
- Add these options to the C++ compilation command.
So copts
is already covered by compileOptions
, we could just add 2 new settings for the other two.
Searching for custom -std=X
setting in LLVM is easy is relatively cheap, we can insert the defaults if there is no custom settings.
However, it would still not fix a big bigger issue - if parts of the (Scala Native C/C++) stdlib require some version od -std, let's say -std=c++14
, but users code or it's dependency require newer standard it would still fail.
So maybe we can third alternative - let's define -std
setting in the project descriptor so that we can always control our own sources - but allow users to use custom values for everything else. We can play with order or filtering of options coming from project descriptor over these defined by user.
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 was thinking of allowing the the project descriptor so the internal libs or third party libs could select their minimum or required version.
I will have to look at the Bezel convention but Lee was making fun of cxx so maybe cpp :-) But why is copt
for both C/C++? Maybe I am missing a key point here. I wanted to make it very specific so we can add other things if needed. I can work on naming etc. once I get it going.
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 was looking and indeed C++ has other flags specific to C++ so I understand what you were saying about finding the std flag. I will work towards that.
d9859c6
to
e1adcc4
Compare
e1adcc4
to
d155931
Compare
The intent here is to allow a default, and project specific settings.
This means that if someones project needs C++17 and there compiler is not new enough, things will fail. If it is the end users project wanting a newer version if should still work. We will test that out.