-
Notifications
You must be signed in to change notification settings - Fork 2
/
_preload.lua
144 lines (122 loc) · 2.79 KB
/
_preload.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
-- Package management module
-- Copyright (c) 2017 Blizzard Entertainment
---
local p = premake
---
-- Load the entire module.
---
require("packagemanager")
---
-- Command line options.
---
newoption {
trigger = "compiler",
value = "gcc44",
description = "Select which compiler to use for package system"
}
newoption {
trigger = 'no-http',
description = 'Disable http queries to package server.'
}
newoption {
trigger = 'to',
default = 'build',
value = 'path',
description = 'Set the output location for the generated files'
}
newoption {
trigger = "package-help",
description = "Display all package options for all imported packages."
}
---
-- Premake API keys.
---
p.api.register {
name = 'includedependencies',
scope = 'config',
kind = 'tableorstring'
}
p.api.register {
name = 'linkdependencies',
scope = 'config',
kind = 'tableorstring'
}
p.api.register {
name = 'bindirdependencies',
scope = 'config',
kind = 'tableorstring'
}
p.api.register {
name = 'copybindependencies',
scope = 'config',
kind = 'tableorstring',
}
p.api.register {
name = 'copybintarget',
scope = 'config',
kind = 'path',
tokens = true,
pathVars = true,
}
p.api.register {
name = 'lockfile',
scope = 'global',
kind = 'file',
}
---
-- API's to control the output folders for imported packages.
---
p.api.register {
name = 'package_location',
scope = 'project',
kind = 'path',
tokens = true,
pathVars = true,
}
p.api.register {
name = 'package_buildlog',
scope = 'config',
kind = 'path',
tokens = true,
pathVars = true,
}
p.api.register {
name = 'package_objdir',
scope = 'config',
kind = 'path',
tokens = true,
pathVars = true,
}
p.api.register {
name = 'package_libdir', -- this controls the targetdir for StaticLib projects.
scope = 'config',
kind = 'path',
tokens = true,
pathVars = true,
}
p.api.register {
name = 'package_bindir', -- this controls the targetdir for SharedLib, WindowedApp and ConsoleApp projects.
scope = 'config',
kind = 'path',
tokens = true,
pathVars = true,
}
-- initialize sane defaults.
package_location '%{path.join(sln.location, "projects/packages")}'
package_bindir '%{path.join(_MAIN_SCRIPT_DIR, "bin", premake.packagemanager.buildVariantFromConfig(cfg))}'
package_objdir '%{path.join(sln.location, "obj", premake.packagemanager.buildVariantFromConfig(cfg))}'
package_libdir '%{path.join(sln.location, "lib", premake.packagemanager.buildVariantFromConfig(cfg))}'
---
-- shortcut if you need both include & link dependencies
---
function usedependencies(table)
includedependencies(table)
linkdependencies(table)
end
---
-- Module must always be loaded.
---
return function(cfg)
return true
end