Project groups - best practise

Consider large solution, including different "groups" of projects: libraries, plugins, command-line tools (e.g., Qt Creator IDE). Just like solution can define common settings for all projects, it's desirable to have a possibility to define common settings per such group.

Possible options:

  • "Setup" function. - Doesn't require anything from Premake, however there's no way to restrict what setup function can do
  • Put include under project. - The same consideration
  • uses keyword (declare set of properties as usage). - Current usage conception is tuned towards external libraries, not abstract sets of properties.
  • Some kind of "sub-solutions". - Will require substantial changes in Premake code.

Thoughts?

To my mind, simpler is better. I would suggest creating new project functions that call Premake's project() and apply the initial settings.

function pluginproject(name)
    project (name)
    kind "SharedLib"
    language "C++"
    -- ...and so on...
end

OK, probably it's the best and simplest option.

I just remember about KDE4 CMake project where most original functions are similarly wrapped, hiding original build system, I thought that was not a good practice.

It could certainly be taken too far. You could always keep the two actions separate too.

function pluginsettings()
    kind "SharedLib"
    language "C++"
    -- ...and so on...
end
 
project "MyPluginProject"
    pluginsettings()
    -- more stuff

Well, how I do it is by defining the common settings among projects in the main premake file, and then in each one I explicitly set those settings. Using a function like starkos seems cleaner though.