forked from Jebbs/DSFML
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.d
More file actions
116 lines (90 loc) · 1.94 KB
/
build.d
File metadata and controls
116 lines (90 loc) · 1.94 KB
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
module build;
import std.stdio;
import std.file;
import std.process;
version(DigitalMars)
{
}
else
{
static assert(false, "Only DMD is currently supported by this build script.");
}
string currentDirectory;
string impDirectory;
string libDirectory;
string prefix;
string extension;
string compilerSwitches;
version(Windows)
{
bool isWindows = true;
bool isLinux = false;
bool isMac = false;
}
else version(linux)
{
bool isWindows = false;
bool isLinux = true;
bool isMac = false;
}
else version(OSX)
{
bool isWindows = false;
bool isLinux = false;
bool isMac = true;
}
else
{
static assert(false, "DSFML is only supported on OSX, Windows, and Linux. Try using an OS someone actually likes. ;D");
}
string[5] modules = ["system", "audio", "network", "window", "graphics"];
void initialize()
{
currentDirectory = getcwd;
impDirectory = currentDirectory~"/src";
libDirectory = currentDirectory~"/lib/";
if(isWindows)
{
writeln("Building for Windows");
prefix = "";
extension = ".lib";
compilerSwitches = "-lib -O -release -inline -property -I"~impDirectory;
}
else if(isLinux)
{
writeln("Building for Linux");
prefix = "lib";
extension = ".a";
compilerSwitches = "-lib -O -release -inline -property -I"~impDirectory;
}
else
{
writeln("Building for OSX");
prefix = "lib";
extension = ".a";
compilerSwitches = "-lib -O -release -inline -property -I"~impDirectory;
}
writeln();
}
void build()
{
foreach(theModule;modules)
{
string fileList = "";
foreach (string name; dirEntries("src/dsfml/"~theModule, SpanMode.depth))
{
fileList~= name ~ " ";
}
string buildCommand = "dmd "~ fileList ~ compilerSwitches ~ " -of"~libDirectory~prefix~"dsfml-"~theModule~"-2"~extension;
writeln("Building " ~ theModule~ " module.");
auto status = executeShell(buildCommand);
}
}
void main(string[] args)
{
writeln("You're about to build DSFML! Go you!");
writeln();
initialize();
build();
writeln("Done!");
}