-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgeno_workspace.lua
71 lines (61 loc) · 1.49 KB
/
geno_workspace.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
local p = premake
local m = { }
-- Properties
local props = function()
return {
m.name,
m.matrix,
m.projects,
}
end
-- Generate workspace
function p.extensions.geno.generateworkspace( wks )
p.indent( "\t" )
p.callArray( props, wks )
end
-- Name
function m.name( wks )
p.w( "Name:%s", wks.name )
end
-- Matrix
function m.matrix( wks )
p.push "Matrix:"
p.push "Platforms:"
for _, platform in ipairs( wks.platforms ) do
p.push( "%s:", platform )
-- TODO: Override this per-project based on 'toolset'
p.w( "Compiler:%s", iif( os.istarget( "windows" ), "MSVC", "GCC" ) )
p.pop()
end
p.pop()
p.push "Configurations:"
for _, configuration in ipairs( wks.configurations ) do
p.w( "%s", configuration )
end
p.pop()
p.pop()
end
-- Projects
function m.projects( wks )
if( #wks.projects > 0 ) then
p.push "Projects:"
-- Build the list in an order such that no project is built before its dependencies
local projects = { }
local addprojectrecursive
addprojectrecursive = function( subprojects )
for _, subproject in ipairs( subprojects ) do
addprojectrecursive( p.project.getdependencies( subproject ) )
table.insert( projects, subproject )
end
end
addprojectrecursive( wks.projects )
projects = table.unique( projects )
for i = #projects,1,-1 do
local prj = projects[ i ]
local relativelocation = path.getrelative( wks.location, prj.location )
local projectpath = path.join( relativelocation, prj.name )
p.w( projectpath )
end
p.pop()
end
end