Reputation: 77
I am new to Premake. I am using Premake 4.4 beta 5 because Premake 5 has a few issues where it does not generate proper VS2010 solutions (generates VS2012 solutions with 2010 compiler), and it setting libdirs and links for all projects when written under one project.
Anyways, the issue I am having is that I wrote a Premake script. It all works fine, but there is an annoyance where it includes multiple parent folders in common between all the files included in the project. So you have to open multiple folders containing nothing but a single folder, before you get to the meat. Here's is an image so that you understand: premake_common_parent_folders
My folder structure on disc looks something like this:
Here is my Premake:
_targetdir = '../bin/' .. _ACTION
local function ProjectCommon()
targetdir( _targetdir .. '/' .. project().name )
files {
'../src/' .. project().name .. '/**.*',
}
includedirs {
'../src/' .. project().name .. '/include',
}
end
solution( 'Example' )
location( _ACTION )
configurations { "Release", "Debug" }
project( 'Test' )
ProjectCommon()
language( 'C++' )
kind( 'ConsoleApp' )
includedirs {
'../src/StaticLib/include',
}
libdirs {
_targetdir .. '/StaticLib',
}
links {
solution().name,
}
project( 'StaticLib' )
ProjectCommon()
targetname( solution().name )
language( 'C++' )
kind( 'StaticLib' )
I want to know if there is a way to have the implementation files directly under the project with the single include folder. Hiding the parent folders common between all project files (src and [Project Name]).
The hope is to have it look something like this: premake_no_common_parent_folders
Upvotes: 0
Views: 498
Reputation: 4276
In theory (untested, I haven't used Premake 4 in a long time) you can use virtual paths to rewrite the structure.
vpaths {
["*"] = "../src/"
}
Premake 5, on the other hand, automatically trims otherwise empty groups from the top of the path, so this isn't necessary if you upgrade.
Speaking of Premake 5, I'm not familiar with either of the bugs you mention; you should open an issue if you haven't already. I'd be willing to bet "setting libdirs and links for all projects when written under one project" is an issue with your project script rather than Premake itself, as that would be a pretty fundamental flaw.
Upvotes: 1