-
-
Notifications
You must be signed in to change notification settings - Fork 611
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
language 'C++' overrides language 'C++11' #770
Comments
I can appreciate the pain you're going through, I'll be going through this soon enough. I don't think ignoring I do think we need a better solution though, because the above is kind of horrifying. |
Just for what it is worth, premake sets the default language at startup to C++. |
I would like to find a solution to the problem that keeps something like the current syntax. I maintain several projects that support multiple C++ language revisions and this change simplifies usage a lot. Instead of this:
I can now do:
Also, if I have a mixed solution where some projects need different dialects, the script changes from:
to
So I think there needs to be some way to control the '-std=xxx' option with a single API call which this is handling great... the problem is just in the backwards compatibility. Ideally for me |
As I mentioned above, this would result in Premake only supporting language standards that it is aware of. We have a project (there might be more) that uses |
What if you remove the line that sets C++ to be the default at project creation, but then set to C++ if you find an uninitialized project during validation? Even if only as a temporary solution until a better fix is sorted? |
There would practically be no difference... since you can override it with a new string anyway. |
I'm not sure what wouldn't work here?
would work fine with the PR I submitted? if you specify a version, it overrides C++, if you don't specify a version, it leaves the version as it was... so in this example, project A will be compiled with C++0x, and project B would be C++11... interestingly in the old 'flags' situation, you actually had to do the following:
so in all honestly, I think with the merge of the language and flags for this particular API, as well as the PR that adds the override behavior to the language API, makes this a fairly clean and workable alternative... but I absolutely like to understand all use-cases before we proceed with merging anything. |
The problem is that C++0x is not a supported standard in Premake. Even if it was, my argument is that I should be able to tell Premake that this is just a C++ project, don't emit any standards, I need something that you don't know about (yet). Hacking or updating Premake are not always valid options when needing things like this. |
Which is currently not possible. If I specify "flags {"C++14"}, in the workspace, and you don't actively remove those flags from your project.. then you get C++14 as a standard, and that is exactly the behavior I'd like to maintain, but again I'm open to alternative suggestions. Basically the only way to guarantee that a project is C++ only, with no standards emitted would be to write:
|
Thinking about the
because that way I could write:
and get the behavior I expect with the workspace overloading the behavior of anything below.
|
Or |
I'll see if I can whip up a PR for that, to see how that would look... |
I'll try to give this proper think if/when I can, but wanted to mention that APIs like this are very restricting, and really require an entirely different system for working with them:
I've been trying to convert the few APIs that use that approach to "flat" calls like:
(I'm not suggesting that's a good API name). It would be a Really Great Thing if you didn't do that. (Addendum: the complication is really when trying to validate the value side of the key-value assignment. There can also be ordering issues, but that wouldn't be an problem for this specific use.) |
Yeah the "keyed" kind is certainly 'complicated'.
just ends up doing absolutely nothing..
to get any kind of meaningful effect. I really don't want to create
although at this point, that seems to be the only alternative that would actually work.
@starkos what in particular? |
I'm going to give up on the I added a bunch of tests to try and figure out a bunch use-cases, two fail.. |
best I can come up with, considering all the constraints: |
In lieu of -- in tools
local value = toolset.dialects[cfg.dialect[cfg.language]] -- or something
if value
-- emit option
end
-- in vs
if table.contains(p.languages.all, cfg.dialect)
-- emit option
end Maybe I've completely misunderstood the problem? |
Yeah, I just went with the cdialect & cppdialect option instead... the "keyed" kind is actually really difficult to use correctly, and to validate correctly... for one, all dialects have to be in the 'allowed' table, regardless of whether they are C or C++, so you can write all in all... too complicated, and just not very good.. |
I'll do some testing with the cdialect/cppdialect approach to see if that works. While the earlier language approach was a breaking change, it does match my needs really well. Some kind of solution is needed here - e.g. doing this just doesn't scale: project 'a' And the issue is just getting more complicated with Visual Studio jumping into the game too. |
Closing, since we have the cppdialect & cdialect options for now... |
previously I could do this:
and all my code would be compiled with C++11 standards enabled..
doesn't work that way... project Y now uses whatever is the default, which is OK, since that is what is specified... but for SC2/Heroes, I now have to basically fix up 98 project lua scripts. I know I did the work, and we had long discussions about this particular refactor, but it's a rather inconvenient API the way we made this work..
The text was updated successfully, but these errors were encountered: