-
Notifications
You must be signed in to change notification settings - Fork 12
/
premake.lua
186 lines (146 loc) · 2.54 KB
/
premake.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
require './Dependencies/premake'
newoption
{
trigger = "pch",
description = "Build with precompiled headers",
}
newoption
{
trigger = "shared",
description = "Build as shared libraries",
}
newoption
{
trigger = "nortti",
description = "Disable run-time type information",
}
-- Common settings for projects linking with libraries.
Helium.DoBasicProjectSettings = function()
filter {}
language "C++"
floatingpoint "Fast"
flags
{
"FatalWarnings",
}
if _OPTIONS['shared'] then
defines
{
"HELIUM_SHARED=1",
}
else
defines
{
"HELIUM_SHARED=0",
}
end
if _OPTIONS['nortti'] then
rtti "Off"
end
includedirs
{
"Source",
"Dependencies/rapidjson/include",
"Dependencies/mongo-c/src",
}
filter { "system:windows", "kind:SharedLib or *App" }
links
{
"dbghelp",
"ws2_32",
"wininet",
}
filter "system:macosx or linux"
buildoptions
{
"-std=c++11",
}
filter { "system:macosx", "kind:SharedLib or *App" }
linkoptions
{
"-stdlib=libc++",
"-framework CoreFoundation",
"-framework Carbon",
"-framework IOKit",
}
filter "system:linux"
buildoptions
{
"-pthread",
}
filter {}
end
Helium.DoTestsProjectSettings = function()
filter {}
kind "ConsoleApp"
Helium.DoBasicProjectSettings()
includedirs
{
".",
"Dependencies/googletest/googletest/include"
}
links
{
"googletest"
}
postbuildcommands
{
"\"%{cfg.linktarget.abspath}\""
}
filter "system:linux"
links
{
"pthread",
"dl",
"rt",
"m",
"stdc++",
}
filter {}
end
Helium.DoModuleProjectSettings = function( baseDirectory, tokenPrefix, moduleName, moduleNameUpper )
filter {}
defines
{
"HELIUM_HEAP=1",
"HELIUM_MODULE=" .. moduleName
}
if _OPTIONS["pch"] then
pchheader( "Precompile.h" )
local source = "Precompile.cpp"
source = path.join( moduleName, source )
source = path.join( baseDirectory, source )
pchsource( source )
local include = ""
source = path.join( moduleName, include )
source = path.join( baseDirectory, include )
includedirs
{
include,
}
end
Helium.DoBasicProjectSettings()
if _OPTIONS['shared'] then
kind "SharedLib"
else
kind "StaticLib"
end
if string.len(tokenPrefix) > 0 then
tokenPrefix = tokenPrefix .. "_"
end
if os.host() == "windows" then
filter "kind:SharedLib"
defines
{
tokenPrefix .. moduleNameUpper .. "_EXPORTS",
}
end
if os.host() == "macosx" then
filter "kind:SharedLib"
linkoptions
{
"-Wl,-install_name,@executable_path/lib" .. project().name .. ".dylib",
}
end
filter {}
end