forked from atilaneves/dpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reggaefile.d
60 lines (47 loc) · 1.89 KB
/
reggaefile.d
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
import reggae;
import std.array: join;
import std.typecons: No;
enum debugFlags = ["-w", "-g", "-debug"];
alias exe = dubDefaultTarget!(CompilerFlags(debugFlags));
alias ut = dubTestTarget!(CompilerFlags(debugFlags), LinkerFlags(), CompilationMode.package_);
// unitThreadedLight, compiles the whole project per D package
alias utlPerPackage = dubTarget!(TargetName("utl_per_package"),
Configuration("unittest"),
CompilerFlags(debugFlags ~ "-version=unitThreadedLight"),
);
// The rest of this file is just to set up a custom unit test build
// that compiles the production code per package and the test code
// per module.
// The production code object files
alias prodObjs = dubObjects!(Configuration("default"),
CompilerFlags(debugFlags),
No.main,
CompilationMode.package_);
// The test code object files
// We build the default configuration to avoid depencencies
// or -unittest.
alias testObjs = dlangObjectsPerModule!(
Sources!"tests",
CompilerFlags(debugFlags ~ ["-unittest", "-version=unitThreadedLight"]),
dubImportPaths!(Configuration("unittest"))
);
// The object file(s) for unit-threaded.
// `dubDependencies` could give us this, but it'd include libclang etc. compile
// with -unittest, which we'd rather avoid.
alias unitThreaded = dubPackageObjects!(
DubPackageName("unit-threaded"),
Configuration("unittest"), // or else the dependency doesn't even exist
CompilerFlags(["-unittest", "-version=unitThreadedLight"]),
);
alias utl = dubLink!(
TargetName("utl"),
Configuration("unittest"),
targetConcat!(prodObjs, testObjs, unitThreaded),
LinkerFlags("-main"),
);
mixin build!(
exe,
ut, // investigate UT failures
optional!utl, // fast development
optional!utlPerPackage, // for benchmarking
);