1 /** 2 Determines the strings to identify the current build platform. 3 4 Copyright: © 2012 rejectedsoftware e.K. 5 License: Subject to the terms of the MIT license, as written in the included LICENSE.txt file. 6 Authors: Sönke Ludwig 7 */ 8 module dub.platform; 9 10 import std.array; 11 12 string[] determinePlatform() 13 { 14 auto ret = appender!(string[])(); 15 version(Windows) ret.put("windows"); 16 version(linux) ret.put("linux"); 17 version(Posix) ret.put("posix"); 18 version(OSX) ret.put("osx"); 19 version(FreeBSD) ret.put("freebsd"); 20 version(OpenBSD) ret.put("openbsd"); 21 version(NetBSD) ret.put("netbsd"); 22 version(DragonFlyBSD) ret.put("dragonflybsd"); 23 version(BSD) ret.put("bsd"); 24 version(Solaris) ret.put("solaris"); 25 version(AIX) ret.put("aix"); 26 version(Haiku) ret.put("haiku"); 27 version(SkyOS) ret.put("skyos"); 28 version(SysV3) ret.put("sysv3"); 29 version(SysV4) ret.put("sysv4"); 30 version(Hurd) ret.put("hurd"); 31 version(Android) ret.put("android"); 32 version(Cygwin) ret.put("cygwin"); 33 version(MinGW) ret.put("mingw"); 34 return ret.data; 35 } 36 37 string[] determineArchitecture() 38 { 39 auto ret = appender!(string[])(); 40 version(X86) ret.put("x86"); 41 version(X86_64) ret.put("x86_64"); 42 version(ARM) ret.put("arm"); 43 version(ARM_Thumb) ret.put("arm_thumb"); 44 version(ARM_SoftFloat) ret.put("arm_softfloat"); 45 version(ARM_HardFloat) ret.put("arm_hardfloat"); 46 version(ARM64) ret.put("arm64"); 47 version(PPC) ret.put("ppc"); 48 version(PPC_SoftFP) ret.put("ppc_softfp"); 49 version(PPC_HardFP) ret.put("ppc_hardfp"); 50 version(PPC64) ret.put("ppc64"); 51 version(IA64) ret.put("ia64"); 52 version(MIPS) ret.put("mips"); 53 version(MIPS32) ret.put("mips32"); 54 version(MIPS64) ret.put("mips64"); 55 version(MIPS_O32) ret.put("mips_o32"); 56 version(MIPS_N32) ret.put("mips_n32"); 57 version(MIPS_O64) ret.put("mips_o64"); 58 version(MIPS_N64) ret.put("mips_n64"); 59 version(MIPS_EABI) ret.put("mips_eabi"); 60 version(MIPS_NoFloat) ret.put("mips_nofloat"); 61 version(MIPS_SoftFloat) ret.put("mips_softfloat"); 62 version(MIPS_HardFloat) ret.put("mips_hardfloat"); 63 version(SPARC) ret.put("sparc"); 64 version(SPARC_V8Plus) ret.put("sparc_v8plus"); 65 version(SPARC_SoftFP) ret.put("sparc_softfp"); 66 version(SPARC_HardFP) ret.put("sparc_hardfp"); 67 version(SPARC64) ret.put("sparc64"); 68 version(S390) ret.put("s390"); 69 version(S390X) ret.put("s390x"); 70 version(HPPA) ret.put("hppa"); 71 version(HPPA64) ret.put("hppa64"); 72 version(SH) ret.put("sh"); 73 version(SH64) ret.put("sh64"); 74 version(Alpha) ret.put("alpha"); 75 version(Alpha_SoftFP) ret.put("alpha_softfp"); 76 version(Alpha_HardFP) ret.put("alpha_hardfp"); 77 return ret.data; 78 } 79 80 string determineCompiler() 81 { 82 version(DigitalMars) return "dmd"; 83 else version(GNU) return "gdc"; 84 else version(LDC) return "ldc2"; 85 else version(SDC) return "sdc"; 86 else return null; 87 }