-
-
Notifications
You must be signed in to change notification settings - Fork 621
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
Support LLVM platform toolset for MSC; Clang in Visual Studio. #169
Conversation
@@ -1501,7 +1503,9 @@ | |||
function m.platformToolset(cfg) | |||
local tool, version = p.config.toolset(cfg) | |||
if version then | |||
version = "v" .. version | |||
if tonumber(version) ~= nil then | |||
version = "v" .. version |
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.
@starkos Are you particularly attached to the functionality of canonical() where it returns 120
instead of v120
?
Why not just make that function return v120
, rather than stripping the 'v', and then adding it back on here?
@@ -1501,7 +1503,9 @@ | |||
function m.platformToolset(cfg) | |||
local tool, version = p.config.toolset(cfg) | |||
if version then | |||
version = "v" .. version | |||
if tonumber(version:sub(1,3)) ~= nil then | |||
version = "v" .. version |
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.
@starkos Are you particularly attached to the functionality of canonical() where it returns 120
instead of v120
?
Why not just make that function return v120
, rather than stripping the 'v', and then adding it back on here?
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.
No, I'm not. Just ended up that way because of the order in which the feature got implemented.
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.
So, I notice you didn't merge this, would you like me to change that?
Sorry, I ran out of time this weekend. I'd like to give this a test run against some of my client code to make sure there are no side effects before I merge it, as we use this feature a lot. What about just |
Like I said in the opener, I think Alternatively, I have a vs-tool extension, which is a popular plugin (Mozilla and Google endorse it). It supports Clang and GCC in VS properly; it replaces the C++ and Linker settings in the project files with different Clang/GCC settings, and populates the project options with all the true options relating to those compilers. When you build you're actually invoking GCC/Clang directly, and that's the context I think best suits For my money, vs-tool gives a much better result, but it's a more comprehensive addon. I don't feel too concerned about adding support for this platform toolset version in core, since it's just a couple of lines. You were in favour of integration the vs-tool stuff at one point a while back. Would you still consider that? |
Okay, I get it. What would make the most sense to me would be to require the leading toolset "msc-LLVM-vs2010"
toolset "msc-LLVM-vs2014_xp" Then modify toolset "msc-110"
toolset "msc-120" |
Why require the leading |
Actually the "v" form is the weird one. I know it isn't implemented yet, but for other compilers it would be I added the "v" option because I know that a few large Premake installs had already adopted that convention and I wanted them to be able to use the public version without modification. Perhaps I should de-emphasize that in the documentation? |
Okay, I see. |
If you're okay with it, I say go the |
Ping? |
Hey, yeah, sorry for my radio silence lately! I've started a new and super aggressive project at work with tonnes of overtime. Coupled with endless social commitments, I've barely touched a computer in my spare time! >_< The reason I haven't fixed this up, is that my plan was to add an optional parameter to explode which will limit explosion to a maximum number of tokens.
Something like that maybe? I wasn't sure if the order of the last 2 parameters would be better swapped around. I've wanted this function in a couple of places, it seemed like a nice tweak. |
Sounds good to me, and I think that is the correct order for the arguments. |
dd66655
to
931ff46
Compare
931ff46
to
28ebe8f
Compare
Finally got to it! |
Fixes #238 |
Looks good (I like the additional touch of auto-removal of cl.exe options not supported by clang) although from discussion I can't tell if "LLVM-vs2014_xp" will be supported or not. It would be weird and I'm sure a constant generator of confusion for people if "LLVM-vs2014_xp" wasn't recognized since this is the toolset name that shows up in Visual Studio UI drop-down. It's fine if there's "msc-*" alias but the name that shows up in VS UI should also be valid. |
It's supported. |
Sorry, misread; @starkos wanted to move away from toolset specifications on their own, ie, without |
BTW, when I tried to compile SumatraPDF with clang's 3.7 cl.exe, those were the options that clang.exe didn't recognize:
They came from: https://github.com/sumatrapdfreader/sumatrapdf/blob/master/premake5.lua (and I manually edited .csproj files to replace toolset). From reading the code it looks like "/GS" will be auto-removed but not the other 3. Not a big deal, since I can work-around this in premake file. |
@kjk : Take a look at my explanation for the |
@starkos It might be a perfectly logical scheme. I just believe people will be confused if they see "LLVM-vs2014" toolset available in Visual Studio UI but the same value in "toolset" command will cause an error. You might be assuming that they will either read (and memorize) all premake docs before writing premake files or in case of error will go to (yet to be written) explanation of why "toolset" doesn't accept what they expect to be valid but what is also likely to happen is that they open a bug here or ask a question on stackoverflow. For example, when I encountered this, I assumed it's a bug in premake and opened a bug. It didn't even occur to me that this could be supported but under a different name so I didn't bother (re)reading docs on "toolset". Even if "msc-*" was available, I would probably end up opening a bug. |
@kjk Okay, I didn't have them appear in my projects. Can I get to them in a separate PR? I'd like to see this merged before messing with stuff like that. |
Thanks for this! |
Support LLVM platform toolset for MSC; Clang in Visual Studio.
bindirs are added to make files for gmake2
bindirs are added to make files for gmake2
bindirs are added to make files for gmake2
Installing the LLVM bundle these days integrates Clang with VS.
The method is different than the popular vs-tool plugin which populates the project with Clang compiler settings, instead LLVM installs a shim for MSC.
I feel the best way to express this in premake is to retain
toolset='msc'
, and support it like the other VS platform toolset options.I have added support the same way we can use
toolset="v100"
; usetoolset="LLVM_vs2010"
instead.toolset="msc-LLVM-vs2010"
is also supported. I'm not sure this is the best expression, but I can't think of a more appropriate one.