premake-core
premake-core copied to clipboard
_TARGET_OS does not point to macosx when specifying --os macosx
I have a premake file in which I want to output to different directory based on the tool and operating system that I'm generating for. In my premake file I have the following line:
location (_ACTION .. "-" .. _TARGET_OS)
When I do premake5 gmake it outputs to gmake-linux. However, if I do premake5 gmake --os macosx it still outputs to gmake-linux.
I also tried setting the location under different configurations, but couldn't get that to work either.
I am using premake5 alpha 12.
os.target() will get you what you're after. To my understanding, the os option isn't perfect, so please bug any issues you encounter when using it and os.target().
Will give this a go. Thanks!
Probably worth leaving this one open as a bug.
Probably worth leaving this one open as a bug.
Just so I'm on the same page, is the bug that --os doesn't set _TARGET_OS?
That's right.
This is probably why, it's the only reference in the code where the variable is checked
_TARGET_OS is only set in premake.c via PLATFORM_STRING, but not trough the commandline
And the tests didn't catch this because they override _TARGET_OS and _OPTIONS.os before running the tests, always resulting in correct behaviour during testing. (the gmake2 test actually still overrides _OS instead, something one might need to fix as well)
Whether this is actual intended behaviour is up to debate, but as _OS was correctly adjusted before and the deprecate message states _TARGET_OS, not os.target(), there's at least a need for clarification here...
I am running into this same issue with my project. The documentation seems to indicate that the intended behavior for the --os flag is to override _TARGET_OS so I am confident in saying that this is a bug.
Correct, we should either adjust the documentation or adjust the behavior of --os and _TARGET_OS. I would recommend using target.os() for now.
I tested os.target() and it seems to have the correct behavior which is funny because the global variable named after it does not :/
I'm using a temporary fix where I have a lua module who's sole purpose is to set _TARGET_OS to os.target() lol