forked from Gaztin/premake-qmake
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqmake_workspace.lua
More file actions
65 lines (55 loc) · 1.06 KB
/
qmake_workspace.lua
File metadata and controls
65 lines (55 loc) · 1.06 KB
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
local p = premake
local qmake = p.extensions.qmake
qmake.workspace = {}
local m = qmake.workspace
--
-- Generate a qmake workspace
--
function m.generate(wks)
m.template()
m.subprojects(wks)
m.depends(wks)
m.subdirs(wks)
end
--
-- Project type
--
function m.template()
p.w('TEMPLATE = subdirs')
p.outln('')
end
--
-- Sub-project names
--
function m.subprojects(wks)
p.out('SUBDIRS =')
for prj in p.workspace.eachproject(wks) do
p.out(string.format(' \\\n\t%s', prj.name))
end
p.outln('\n')
end
--
-- Locations of sub-projects
--
function m.subdirs(wks)
for prj in p.workspace.eachproject(wks) do
local prjpath = p.workspace.getrelative(wks, prj.location .. "/" .. prj.name)
p.w('%s.subdir = %s', prj.name, prjpath)
end
p.outln('')
end
--
-- Project dependencies
--
function m.depends(wks)
for prj in p.workspace.eachproject(wks) do
local deps = p.project.getdependencies(prj)
if #deps > 0 then
p.out(string.format('%s.depends =', prj.name))
for _, dep in ipairs(deps) do
p.out(' ' .. dep.name)
end
p.outln('')
end
end
end