diff --git a/source/dub/compilers/buildsettings.d b/source/dub/compilers/buildsettings.d index f64362f..52089b5 100644 --- a/source/dub/compilers/buildsettings.d +++ b/source/dub/compilers/buildsettings.d @@ -185,7 +185,8 @@ library, sourceLibrary, dynamicLibrary, - staticLibrary + staticLibrary, + object } enum BuildRequirements { diff --git a/source/dub/compilers/compiler.d b/source/dub/compilers/compiler.d index 14ce05d..2acc298 100644 --- a/source/dub/compilers/compiler.d +++ b/source/dub/compilers/compiler.d @@ -366,6 +366,10 @@ if( platform.platform.canFind("windows") ) return settings.targetName ~ ".dll"; else return "lib" ~ settings.targetName ~ ".so"; + case TargetType.object: + if (platform.platform.canFind("windows")) + return settings.targetName ~ ".obj"; + else return settings.targetName ~ ".o"; } } diff --git a/source/dub/compilers/dmd.d b/source/dub/compilers/dmd.d index 152556b..599f809 100644 --- a/source/dub/compilers/dmd.d +++ b/source/dub/compilers/dmd.d @@ -169,6 +169,9 @@ version (Windows) settings.addDFlags("-shared"); else settings.addDFlags("-shared", "-fPIC"); break; + case TargetType.object: + settings.addDFlags("-c"); + break; } if (tpath is null) diff --git a/source/dub/compilers/gdc.d b/source/dub/compilers/gdc.d index 90bdcea..a82339c 100644 --- a/source/dub/compilers/gdc.d +++ b/source/dub/compilers/gdc.d @@ -167,6 +167,7 @@ case TargetType.executable: break; case TargetType.library: case TargetType.staticLibrary: + case TargetType.object: settings.addDFlags("-c"); break; case TargetType.dynamicLibrary: diff --git a/source/dub/compilers/ldc.d b/source/dub/compilers/ldc.d index fb214dd..32a4520 100644 --- a/source/dub/compilers/ldc.d +++ b/source/dub/compilers/ldc.d @@ -157,6 +157,9 @@ case TargetType.dynamicLibrary: settings.addDFlags("-shared"); break; + case TargetType.object: + settings.addDFlags("-c"); + break; } if (tpath is null) diff --git a/source/dub/generators/build.d b/source/dub/generators/build.d index fcac60f..685b34c 100644 --- a/source/dub/generators/build.d +++ b/source/dub/generators/build.d @@ -362,8 +362,8 @@ string objPath = tempobj.toNativeString(); bs.libs = null; bs.lflags = null; - bs.addDFlags("-c"); bs.sourceFiles = [ srcFile ]; + bs.targetType = TargetType.object; gs.compiler.prepareBuildSettings(bs, BuildSetting.commandLine); gs.compiler.setTarget(bs, gs.platform, objPath); gs.compiler.invoke(bs, gs.platform, gs.compileCallback);