diff --git a/source/dub/compilers/dmd.d b/source/dub/compilers/dmd.d index 810c06b..152556b 100644 --- a/source/dub/compilers/dmd.d +++ b/source/dub/compilers/dmd.d @@ -189,14 +189,18 @@ { import std.string; auto tpath = Path(settings.targetPath) ~ getTargetFileName(settings, platform); - auto args = [platform.compilerBinary, "-of"~tpath.toNativeString()]; + auto args = ["-of"~tpath.toNativeString()]; args ~= objects; args ~= settings.sourceFiles; version(linux) args ~= "-L--no-as-needed"; // avoids linker errors due to libraries being speficied in the wrong order by DMD args ~= settings.lflags.map!(l => "-L"~l)().array; args ~= settings.dflags.filter!(f => isLinkerDFlag(f)).array; - logDiagnostic("%s", args.join(" ")); - invokeTool(args, output_callback); + + auto res_file = getTempFile("dub-build", ".lnk"); + std.file.write(res_file.toNativeString(), join(args, "\n")); + + logDiagnostic("%s %s", platform.compilerBinary, args.join(" ")); + invokeTool([platform.compilerBinary, "@"~res_file.toNativeString()], output_callback); } private static bool isLinkerDFlag(string arg) diff --git a/source/dub/generators/build.d b/source/dub/generators/build.d index cc826ad..fcac60f 100644 --- a/source/dub/generators/build.d +++ b/source/dub/generators/build.d @@ -350,7 +350,12 @@ /// Output an unique name to represent the source file. /// Calls with path that resolve to the same file on the filesystem will return the same, /// unless they include different symbolic links (which are not resolved). - static string pathToObjName(string path) { return std.path.buildNormalizedPath(getcwd(), path~objSuffix)[1..$].replace("/", "."); } + + static string pathToObjName(string path) + { + return std.path.stripDrive(std.path.buildNormalizedPath(getcwd(), path~objSuffix))[1..$].replace(std.path.dirSeparator, "."); + } + /// Compile a single source file (srcFile), and write the object to objName. static string compileUnit(string srcFile, string objName, BuildSettings bs, GeneratorSettings gs) { Path tempobj = Path(bs.targetPath)~objName;