Skip to content
This repository has been archived by the owner on Jun 2, 2019. It is now read-only.

Questions on Level of Functionality and Usage #1

Open
nichmj01 opened this issue Sep 13, 2016 · 7 comments
Open

Questions on Level of Functionality and Usage #1

nichmj01 opened this issue Sep 13, 2016 · 7 comments

Comments

@nichmj01
Copy link

Not sure if this is right way to send a message, but I couldn't find any other mechanism.

I'm really interested in this project as I use eclipse extensively and it would be great to be able to use premake to generate eclipse projects, especially when there are lots of dependencies, so that the CDT indexer works as expected. I'm wondering what level of functionality this module currently has and how it is used.

I can run "premake5 eclipse" which generates {project-name}.cproject and {project-name}.project files. As best as I can tell though, Eclipse wants the files to be just .cproject and .project. Is the intent that I would need to rename the generated files? In addition, the generated projects default to using the mingw toolchain but I would like to use the Visual C++ toolchain. Is there a currently a way to specify the toolchain to be used?

@TurkeyMan
Copy link
Contributor

Hey. This was a work-in-progress... it was quite advanced, but I wasn't finished, so I'm actually not quite sure what state it's in since I last touched it (I haven't been using Eclipse for quite some time).

You should be able to use the VC++ toolset with:

  toolset "msc"

In your premake script.

I recall the problem with the filenames, I intended to fix up the file naming logic in premake, but I didn't get around to it. While testing, I was just renaming the files like you say.
Premake is very easy to hack on if you want to make fixes yourself.

There's a high chance you'll need to make some tweaks to this code to get it working properly for you, but it should be quite close.

@nichmj01
Copy link
Author

Thanks for the info. I tried adding toolset "msc" to my premake5.lua file and I get this error:

Error: [string "src/base/premake.lua"]:122: bad argument #2 to 'format' (string expected, got nil)

I'm not yet sure what's causing it.

It seems like I'll have to spend some time learning how to extend premake to do what I need but this looks like a good starting point.

Thanks for the help.

@TurkeyMan
Copy link
Contributor

Yeah, it'd be nice if the error gave you a callstack rather than a single file:line: huh! ;)
Sorry, that's almost certainly a bug in my eclipse code.
You'll just need to drop some print statements throughout the eclipse generator and monitor it doing its thing.
eclipse_cproject.lua is where most of the action is, and the entry-point into that generator is the last function in the file (cproject.generate())

@TurkeyMan
Copy link
Contributor

Oh dear... I see the problem ;)

Check out the msc data block:
https://github.com/premake/premake-eclipse/blob/master/eclipse_cproject.lua#L672

Compare to the MinGW data block:
https://github.com/premake/premake-eclipse/blob/master/eclipse_cproject.lua#L95

I did start to collect all the information necessary to generate msc files, but apparently I didn't commit it to this code... the process involves creating a million project files, each with every possible combination of options for every option eclipse exposes to users.

Since eclipse projects are serialised java, the XML contains class identifiers and enum keys and all that good stuff. The MSC classes are completely different classes than the gcc classes, and as a result, the project file for MSC projects is structured quite differently than the mingw project.
Eclipse is a very hard (time consuming!) IDE to support ;)

@tvandijck
Copy link

tvandijck commented Sep 15, 2016

sorry for the somewhat off topic here.

Yeah, it'd be nice if the error gave you a callstack rather than a single file:line: huh! ;)

Oh boy... and that is not even enough.... since sometimes the context in which the error occured is way more important.. For example if you have a string with '%{callmethod()}' in it... which gets detokened at some point... callstack is absolutely total garbage.. I get many errors that because I set some property to some value, somewhere else sometimes seemingly unrelated, deep down in premake it blows up...

@nichmj01
Copy link
Author

nichmj01 commented Sep 15, 2016

I did start to collect all the information necessary to generate msc files, but apparently I didn't commit it to this code... the process involves creating a million project files, each with every possible combination of options for every option eclipse exposes to users.

Ah.. that's sucks :\

I wonder if I really need a full fledged msc project though. I'm mostly interested in getting the indexing to work, which I think means all I really care about is having the MSVS include folder under Paths & Symbols. I don't actually care about doing the compile in Eclipse right now. If the indexing works with a mingw project, maybe there's a way to hack it to just add in the MSVS include folder to the project.

When I have time I'll investigate.

Thanks again for help / insight!

@TurkeyMan
Copy link
Contributor

Well I'll say that if you're willing to hack a little bit, referring to the mingw data structure, and populating a similar structure with the proper MSC equivalents, it should be easy enough to get working.
Your friend will be lots of print() statements to follow it through. Fortunately lua makes that easy enough, no need to compile or build premake, just edit the eclipse script and rerun premake :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants