-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpremake_extension.lua
More file actions
59 lines (49 loc) · 1.58 KB
/
premake_extension.lua
File metadata and controls
59 lines (49 loc) · 1.58 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
require('vstudio')
premake.api.register {
name = "unitybuild",
scope = "config",
kind = "boolean",
default_value = "off",
}
premake.api.register {
name = "dontincludeinunity",
scope = "config",
kind = "boolean",
default_value = "off",
}
local function enable_unitybuild(cfg)
if cfg.unitybuild then
--print("Unity build enabled!")
premake.w('<PropertyGroup><EnableUnitySupport>true</EnableUnitySupport></PropertyGroup>')
end
end
local function include_in_unitybuild(cfg)
if cfg.unitybuild then
--print("Included in unity build!")
premake.w('<IncludeInUnityFile>true</IncludeInUnityFile>')
end
end
local function dont_include_in_unitybuild(cfg)
if cfg.dontincludeinunity then
--print("Not included in unity build!")
--print(cfg.name)
premake.w('<IncludeInUnityFile>false</IncludeInUnityFile>') --todo use premake.element
premake.w('<PrecompiledHeader>NotUsing</PrecompiledHeader>')
end
end
premake.override(premake.vstudio.vc2010.elements, "project", function(base, cfg)
local calls = base(cfg)
table.insertafter(calls, premake.vstudio.vc2010.project, enable_unitybuild)
return calls
end)
premake.override(premake.vstudio.vc2010.elements, "clCompile", function(base, cfg)
local calls = base(cfg)
table.insertafter(calls, premake.vstudio.vc2010.precompilerHeaders, include_in_unitybuild)
return calls
end)
premake.override(premake.vstudio.vc2010, "excludedFromBuild", function(base, cfg)
local calls = base(cfg)
dont_include_in_unitybuild(cfg)
--table.insertafter(calls, premake.vstudio.vc2010.excludedFromBuild, dont_include_in_unitybuild)
return calls
end)