1 /**
2 * This module provides several variables. Paired with static if's these
3 * variables can be used for $(LINK2 https://dlang.org/spec/version.html, conditional compilation)
4 *
5 * example:
6 * ---
7 * static if(os == "Windows") {
8 *     //code for windows
9 * }
10 * else {
11 *     //generic code	
12 * }
13 * ---
14 */
15 
16 module caLib_util.build;
17 
18 
19 
20 /**
21 * An enum string representing the target operating system.
22 * $(BR)possible values:
23 * $(UL
24 *     $(LI "Windows")
25 *     $(LI "Linux")
26 *     $(LI "OSX")
27 * )
28 */
29 version(Windows)
30 {
31 	enum string os = "Windows";
32 }
33 version(linux)
34 {
35 	enum string os = "Linux";
36 }
37 version(OSX)
38 {
39 	enum string os = "OSX";
40 }
41 
42 static assert(is(typeof(os)), "This os is not supported. Windows, Linux"
43 	~ " and Mac os are the only os:es currently supported");
44 
45 
46 
47 /**
48 * An enum string representing the target architecture.
49 * $(BR)possible values:
50 * $(UL
51 *     $(LI "x86" (32-bit))
52 *     $(LI "x86_64" (64-bit))
53 *     $(LI "ARM" (32-bit))
54 * )
55 */
56 version(X86)
57 {
58 	enum string arch = "x86";
59 }
60 version(X86_64)
61 {
62 	enum string arch = "x86_64";
63 }
64 version(ARM)
65 {
66 	enum string arch = "ARM";
67 }
68 
69 static assert(is(typeof(arch)), "This computer architecture is not supported."
70 	~ "x86, x86_64 and ARM are the only architectures currently supported");
71 
72 
73 
74 pragma(msg, "----\ncompiling with settings:");
75 pragma(msg, "    os: " ~ os);
76 pragma(msg, "    architecture: " ~ arch);
77 pragma(msg, "----");