-
-
Notifications
You must be signed in to change notification settings - Fork 625
Adds a new os.targetarch()
function.
#2263
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
Conversation
60a92dd
to
ce5ff07
Compare
So, I can understand how this would work for a workspace that doesn't specify any
How do you expect this to work with the workspaces that specify their |
In this case I think it should work like it currently does with
I would expect those cases to keep working as they have. From what I understand,
The only "edge case" I am thinking about is if you have say Lets say you set an explicit architecture with Tests can be added for those edge cases, but generally, I think behavior should just continue to work if my assumptions are correct. |
To note, |
Ok, so did a bit more experimentation on this and just a few thoughts. Defaulting to the architecture of the running system leads to some important changes of behavior. Currently, if you don't set an explicit architecture, then Premake will default to not using any target architecture flags in the toolsets. So for example, you will not get any of either And to note, if you were to set an explicit of architecture of lets say I'm not really if I find this difference of behaviour depending if you set an explicit architecture or not to be the most robust by Premake, seems like being as most explicit about it would be best, but since it's a pre-existing behaviour, I think it's reasonable to keep it as-is. As such, I have updated the PR to default Any thoughts on this @samsinsane / anyone else? |
This sounds good, but doesn't quite answer my question because I don't know if
I agree with being explicit, but there is also a requirement for files generated by Premake to be shared by default. The only limit on this currently is the target OS, you can't go from Windows to Linux unless you specify I think your approach to maintaining the existing behaviour is a good call for now. |
If there is a platform, then it has priority, otherwise function os.target()
return _OPTIONS.os or _TARGET_OS
end local system = os.target()
local architecture = os.targetarch()
local toolset = p.action.current().toolset
if platform then
system = p.api.checkValue(p.fields.system, platform) or system
architecture = p.api.checkValue(p.fields.architecture, platform) or architecture
toolset = p.api.checkValue(p.fields.toolset, platform) or toolset
end So behaviour is exactly the same as how |
Added some tests and improved the docs, should be ready for review now. |
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.
Please hold on merging until the questions are addressed
Updated the PR with a fix for the issue brought up by @samsinsane, otherwise I think all questions should be addressed. |
What does this PR do?
This PR introduces the concept of a target architecture
_TARGET_ARCH
, analogous to the existing_TARGET_OS
.So in all my previous Premake projects over the years, I have ended up hacking something comparable to this concept of a target architecture, but it really should be a core Premake concept IMHO.
How does this PR change Premake's behavior?
There is another change that I think should also be done, to default to the target architecture by default. At the moment Premake will default to 32-bits architecture, at least on Windows for example. This behaviour should be updated to target the architecture of the running system by default.
I left that line commented in the PR (in
oven.lua
), would like to understand what's the community's opinion on that before making further changes as I'll need to update some tests.Anything else we should know?
I'll also add some new tests specifically for the new APIs if people are ok with this change.