This repository has been archived by the owner on Apr 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
premake5.lua
139 lines (118 loc) · 4.18 KB
/
premake5.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
require 'ndk'
dofile( "sampleConfig.lua" )
--[[
Define command line options. These must come before the action on the command line.
--]]
newoption {
trigger = "gfxapi",
value = "API",
description = "Choose a particular 3D API for rendering",
allowed = {
{ "gl", "OpenGL" },
{ "gles", "OpenGL ES" },
{ "dx", "Direct3D" }
}
}
newoption {
trigger = "os",
value = "TARGET",
description = "Choose a target operating system",
allowed = {
{ "windows", "Microsoft Windows" },
{ "linux", "Ubuntu Linux" },
{ "android", "Android" }
}
}
--[[
Define the solution and projects. Settings that will be applied to both the CPUT library and the sample
go under the solution. Settings that are only applicable to either the sample executable or the CPUT library
go under the respective project.
--]]
solution( sampleName )
platforms( { "x32", "x64" } )
language( "C++" )
flags( { "MultiProcessorCompile", "NoMinimalRebuild", "NoRTTI" } )
startproject( sampleName )
-- Specifying a graphics api on the command line enables a subset of possible configurations
if _OPTIONS["gfxapi"] == "gl" then
configurations( { "Debug_GL", "Release_GL" } )
elseif _OPTIONS["gfxapi"] == "dx" then
configurations( { "Debug_DX", "Release_DX" } )
elseif _OPTIONS["gfxapi"] == "gles" then
configurations( { "Debug_GLES", "Release_GLES" } )
else
configurations( { "Debug_GL", "Release_GL" } )
configurations( { "Debug_DX", "Release_DX" } )
configurations( { "Debug_GLES", "Release_GLES" } )
end
if not _OPTIONS["os"] then
_OPTIONS["os"] = "windows"
end
configuration( { "x32" } )
architecture( "x32" )
configuration( { "x64" } )
architecture( "x64" )
-- Settings dependent on target rendering API
configuration( { "*_DX" } )
defines( { "CPUT_FOR_DX11" } )
configuration( { "*_GL" } )
defines( { "CPUT_FOR_OGL", "GLEW_STATIC" } )
configuration( { "*_GLES" } )
defines( { "CPUT_FOR_OGLES3", "CPUT_FOR_OGLES" } )
-- Settings dependent on target operating system
configuration( { "os=windows" } )
flags( { "Unicode" } )
defines( { "CPUT_OS_WINDOWS" } )
configuration( { "os=linux" } )
defines( { "CPUT_OS_LINUX" } )
configuration( { "os=android or *GLES" } )
defines( { "CPUT_OS_ANDROID" } )
removeconfigurations( { "Release*" } )
removeplatforms( { "x32", "x64" } )
framework( "android-18" )
buildoptions( { "-std=c++11" } )
platforms( { "android" } )
abis( { "x86", "armeabi-v7a" } )
stl( "stlport_static" )
-- Settings dependent on build profile
configuration( { "Debug*" } )
defines( { "DEBUG" } )
optimize( "Off" )
flags( { "Symbols" } )
configuration( { "Release*" } )
optimize( "Full" )
flags( { "LinkTimeOptimization" } )
configuration( { "Release", "vs*" } )
buildoptions( { "/Oi", "/Ob2" } )
-- Settings dependent on host compiler
configuration( { "vs*" } )
defines( { "NOMINMAX", "_CRT_SECURE_NO_WARNINGS" } )
if _OPTIONS["gfxapi"] == "gl" then
CPUTSuffix = ""
CPUTRemoveConfigs = { "*_DX", "*_GLES" }
dofile( "CPUT/CPUT.lua" )
dofile( "sample.lua" )
elseif _OPTIONS["gfxapi"] == "dx" then
CPUTSuffix = ""
CPUTRemoveConfigs = { "*_GL", "*_GLES" }
dofile( "CPUT/CPUT.lua" )
dofile( "sample.lua" )
elseif _OPTIONS["gfxapi"] == "gles" then
CPUTSuffix = ""
CPUTRemoveConfigs = { "*_GL", "*_DX" }
dofile( "CPUT/CPUT.lua" )
dofile( "sample.lua" )
else
CPUTSuffix = "GL"
CPUTRemoveConfigs = { "*_DX", "*_GLES" }
dofile( "CPUT/CPUT.lua" )
dofile( "sample.lua" )
CPUTSuffix = "DX"
CPUTRemoveConfigs = { "*_GL", "*_GLES" }
dofile( "CPUT/CPUT.lua" )
dofile( "sample.lua" )
CPUTSuffix = "Android"
CPUTRemoveConfigs = { "*_GL", "*_DX" }
dofile( "CPUT/CPUT.lua" )
dofile( "sample.lua" )
end