1 /// Wrapper which accepts DM lib.exe command-line syntax 2 /// and passes the transformed options to a MSVC lib.exe. 3 module msvc_lib; 4 5 import std.algorithm.searching; 6 import std.array; 7 import std.file; 8 import std.path; 9 import std.process; 10 import std.stdio; 11 12 int main(string[] args) 13 { 14 auto lib = environment.get("MSVC_AR", 15 environment.get("VCINSTALLDIR", `\Program Files (x86)\Microsoft Visual Studio 10.0\VC\`) 16 .buildPath("bin", "amd64", "lib.exe")); 17 string[] newArgs = [lib]; 18 newArgs ~= "/NOLOGO"; 19 20 foreach (arg; args[1..$]) 21 { 22 switch (arg) 23 { 24 case "-n": // "do not create backup file" 25 case "-c": // "create" 26 break; 27 default: 28 if (arg.startsWith("-p")) // "set page size to nnn (a power of 2)" 29 continue; 30 if (arg.endsWith(".lib")) 31 newArgs ~= "/OUT:" ~ arg; 32 else 33 newArgs ~= arg; 34 break; 35 } 36 } 37 stderr.writeln(escapeShellCommand(newArgs)); 38 return spawnProcess(newArgs).wait(); 39 }