recursive dependency lookup

Hi,

I recently started using premake and was pleasantly surprised by its ease of use. However when it came to setting up a series of interconnected libraries i was a bit disappointed at the lack of recursive dependency lookup. As far as I can tell this feature is not supported, but it does and I just couldn't discover it then I will be happily mistaken.

Now when I say recursive dependency lookup I mean that when linking static libraries it is not necessary to link all of its dependencies explicitly in the premake file for the exe. A short example follows to illustrate my point.

Assume all dependencies are static libs.
Assume all dependencies are fully specified premake projects.
So say you have a project named Example that depends on a library called Library.

Example --> Library

Now Library also has a couple of dependencies

Library --> Recursive_Dependency_A
--> Recursive_Dependency_B

When linking Example it is necessary to link both Library and its dependencies. So in your Example premake script you would need to specify the include_dirs for the dependencies and also have entries for them in links. A recursive dependency discovery feature would negate the need for specific entries for the dependencies, instead simply linking to Library would automatically indicate that you need to link to its dependencies.

I am currently generating gnu makefiles.
I am using premake 4.2.1

So my questions are:
Does the feature exist already and I just can't find it?
Are there any suggested workarounds to ease having to manually specify all link targets and include folders?
Is there any plan for this feature to be implemented if it doesn't exist?
If this has been considered and not implemented what were the reasons?

In closing I would just like to say what a pleasure premake is to use when compared with something like cmake which has obtuse syntax and dense documentation. Thanks in advance for any responses.

There is a patch available that does just this. It will be a part of 4.2.2, I (or someone) just need to find the time to get it applied and write the docs.

Alright i've downloaded the patch and will set about applying and testing it in the next day or so.

I'll report back with whatever success I have. In principle I'm also happy to write the docs and add the code to the repository once its been tested. If you would like me to do so please let me know what the procedure is.

After a few issues I have got the patch integrated and working in the premake4 binary with one large caveat; I only got it working with the specific svn revision (759) that the patch was made against. Current head revision is around the 1100 mark so obviously there have been lots of changes since the patch was made and i found that I was getting errors in the scripts. Now I am anticipating that these errors should be reasonably easy to fix and will work on getting it working with the head revision in the near future.

In aid of me fixing the script errors I have a specific question regarding one of them that I think should be obvious to someone who is a bit more familiar with them than I am. The error occurs in this piece of script:

	-- Remove all usage projects.
	for _, sln in ipairs(_SOLUTIONS) do
		local removeList = {};
		for index, prj in ipairs(sln.projects) do
			if(prj.usage) then
				table.insert(removeList, 1, index); --Add in reverse order.
			end
		end

The error is regarding the first line and is something along the lines of 'ipairs expected a table but got a NIL value'.

Any help is much appreciated.

Wow, awesome. Yes sure I would be delighted to help you out.

Yes, I've been gradually refactoring the internal interfaces to make them more object oriented and testable. Iterating the list of solutions now looks like this:

for sln in premake.solution.each() do
  -- (code goes here)
end

For docs, there should be a how-to type page to put under Scripting with Premake, like the other pages in that section. There should also be an entry in the Scripting Reference. If you can put together some HTML text I'll get it loaded into the website (enabling other people to edit the pages is on my to-do list).

Also: while it shouldn't matter to the work you're doing right now, I recently moved development from Subversion to Mercurial; you can find the new repository on BitBucket. I am still working on updating the docs and website. I have only made a handful of bug fixes since the move so you can continue to work against Subversion trunk if you like, but BitBucket and Mercurial are a pretty sweet combination.

If you want, use the contact form to contact me directly with any other questions. I'll respond with my email address so you don't have to keep going through the website (unless you prefer it).

Still going to work on this. but will be a couple of days. Keep you posted.

No worries, let me know if you have any questions or need help, docs, whatever. I'm going to finish the transition to Hg (almost done) and fix bugs, get set up for 4.2.2.

I think that for internal projects of solution links should automatically bring in all dependencies when StaticLib is being linked.