-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpremake.lua
215 lines (167 loc) · 5.49 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
require("premake-modules/raspberry")
include "ispc-premake/premake.lua"
-- ------------------------------------------------------------------------------
function GetFileName(str)
return str:match("^.+/(.+)$")
end
function GetFileNameNoExtension(str)
return str:match("([^/]+)$")
end
function GetFileExtension(str)
return str:match("^.+(%..+)$")
end
-- ------------------------------------------------------------------------------
function ConfigureCommonBuildSettings()
objdir ( "$(SolutionDir)_obj/%{cfg.shortname}/$(ProjectName)/" )
debugdir ( "$(OutDir)" )
targetdir ( "$(SolutionDir)_builds/$(Configuration)/%{cfg.platform}" )
end
function ConfigureCommonBuildFiles()
includedirs { "src/support" }
files {
"src/**.cpp",
"src/**.h",
"src/**.inl",
"src/**.ispc",
"src/**.isph",
}
end
-- ------------------------------------------------------------------------------
workspace ("Tether_" .. _ACTION)
configurations { "Debug", "Release", "Release-AVX2" }
platforms { "x86", "x86_64" }
useISPC()
filter "platforms:x86"
architecture "x86"
system "windows"
defines {
"WIN32",
"_WINDOWS",
}
vectorextensions "SSE2"
ispcVars {
OS = "windows",
Architecture = "x86",
CPU = "core2",
TargetISA = "sse2-i32x8",
}
filter "platforms:x86_64"
architecture "x64"
system "windows"
defines {
"WIN32",
"_WINDOWS",
}
vectorextensions "AVX"
ispcVars {
OS = "windows",
Architecture = "x64",
CPU = "corei7-avx",
TargetISA = "avx1-i32x16",
}
filter {}
floatingpoint "Fast"
ispcVars {
MathLibrary = "Fast",
}
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
ispcVars {
GenerateDebugInformation = true,
Opt = "disabled"
}
filter "configurations:Release"
defines { "NDEBUG" }
flags { "LinkTimeOptimization" }
optimize "Full"
ispcVars {
Opt = "maximum",
}
filter "configurations:Release-AVX2"
defines { "NDEBUG" }
flags { "LinkTimeOptimization" }
optimize "Full"
vectorextensions "AVX2"
ispcVars {
CPU = "core-avx2",
TargetISA = "avx2-i32x16",
}
filter {}
-- ------------------------------------------------------------------------------
project "Tether"
kind "ConsoleApp"
language "C++"
ConfigureCommonBuildSettings()
ConfigureCommonBuildFiles()
-- ------------------------------------------------------------------------------
workspace ("Tether_Raspberry_" .. _ACTION)
configurations { "Debug", "Release" }
platforms { "Pi-3", "Pi-4" }
useISPC()
ispcVars {
OS = "linux",
Architecture = "arm",
TargetISA = "neon-i32x4",
}
filter "platforms:Pi-3"
defines {
"RPI=3",
}
ispcVars {
CPU = "arm-cortex-a53", -- tested on my Raspberry Pi 3 Model B+
}
filter "platforms:Pi-4"
defines {
"RPI=4",
}
ispcVars {
CPU = "arm-cortex-a72", --
}
filter {}
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
ispcVars {
GenerateDebugInformation = true,
Opt = "disabled"
}
filter "configurations:Release"
defines { "NDEBUG" }
flags { "LinkTimeOptimization" }
optimize "Full"
ispcVars {
Opt = "maximum",
MathLibrary = "Fast",
}
filter {}
project "Tether_Raspberry"
kind "ConsoleApp"
language "C++"
system "raspberry"
ConfigureCommonBuildSettings()
-- for tasksys code
buildoptions { "-pthread" }
linkoptions { "-lpthread" }
-- currently we have to manually inject the ISPC object files into the remote
-- copy procedure and into the linker as the Linux VS stuff doesn't pick up
-- the local compilation process outputs
--
-- this is a combination of the VS-Linux stuff not expecting something doing cross-compilation
-- on the Windows-side and my inability to decode the nightmare realm MSBuild that might somehow fix this properly
--
-- THIS IS MAKING ASSUMPTIONS THAT YOUR ISPC .O OUTPUT FILES DROP IN THE DEFAULT PLACE
--
manualISPC = os.matchfiles("src/ispc/*.ispc")
remoteCopyFiles = {}
for i, ifile in ipairs(manualISPC) do
-- "rt.ispc.sdf"
justFilename = GetFileNameNoExtension(ifile)
-- to match the `objdir` defined in ConfigureCommonBuildSettings()
remoteObjectFile = string.format( "$(RemoteProjectDir)/_obj/%%{cfg.shortname}/$(ProjectName)/%s.o", justFilename )
table.insert( remoteCopyFiles, string.format("$(IntDir)%s.o:=%s", justFilename, remoteObjectFile) )
table.insert( remoteCopyFiles, string.format("$(SolutionDir)%s:=$(RemoteProjectDir)/%s", ifile, ifile) )
linkoptions { remoteObjectFile }
end
additionalcopy { remoteCopyFiles }
ConfigureCommonBuildFiles()