-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.d
More file actions
42 lines (38 loc) · 1018 Bytes
/
build.d
File metadata and controls
42 lines (38 loc) · 1018 Bytes
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
import std;
void main(string[] args)
{
string outname = "grid";
auto compiler = "ldc2";
if (args.length == 2)
{
compiler = args[1];
}
string[] compileFiles =
dirEntries(".", "*.{c,d}", SpanMode.shallow, false)
.map!(e => e.name.baseName)
.array;
size_t removeIndex =
compileFiles.countUntil(args[0].baseName.stripExtension ~ ".d");
compileFiles = compileFiles.remove(removeIndex);
compileFiles.sort!((a, b) => a.split(".")[0] < b.split(".")[0]);
compileFiles.sort!((a, b) => a.split(".")[1] < b.split(".")[1]);
writefln("Building from files:%-(\n %s%)", compileFiles);
version (Posix)
{
auto p = pipeProcess(compiler ~ compileFiles ~ [
"-of=" ~ "grid", "-O3",
"-L-L/usr/local/lib", "-L-lSDL3", "-L-rpath", "-L/usr/local/lib"
]);
scope (exit)
wait(p.pid);
foreach (l; p.stdout.byLine)
writeln(l);
foreach (l; p.stderr.byLine)
stderr.writeln(l);
}
else
{
static assert(0, "not implemented");
}
dirEntries(".", "*.o", SpanMode.shallow, false).each!remove;
}