diff --git a/payload/reggae/rules/common.d b/payload/reggae/rules/common.d index 13c96414..fe34f57e 100644 --- a/payload/reggae/rules/common.d +++ b/payload/reggae/rules/common.d @@ -548,7 +548,7 @@ private string staticLibraryShellCommand() @safe { } } -private Target[] srcFilesToObjectTargets( +Target[] srcFilesToObjectTargets( in imported!"reggae.options".Options options, in string[] srcFiles, in CompilerFlags flags, diff --git a/payload/reggae/rules/dub/external.d b/payload/reggae/rules/dub/external.d index 7965d021..b9250158 100644 --- a/payload/reggae/rules/dub/external.d +++ b/payload/reggae/rules/dub/external.d @@ -91,12 +91,37 @@ imported!"reggae.build".Target dubDependant auto ref A args, ) { - import reggae.rules.common: objectFiles; + import reggae.rules.common: sourcesToFileNames; + import std.functional: forward; + + const srcFiles = sourcesToFileNames!sourcesFunc(options); + return dubDependant(options, targetName, targetType, srcFiles, forward!args); +} + +// runtime version +imported!"reggae.build".Target dubDependant + (A...) + ( + in imported!"reggae.options".Options options, + in imported!"reggae.types".TargetName targetName, + DubPackageTargetType targetType, + in string[] srcFiles, + // the other arguments can be: + // * DubPath + // * DubVersion + // * CompilerFlags + // * LinkerFlags + // * ImportPaths + // * StringImportPaths + auto ref A args, + ) +{ + import reggae.rules.common: objectFiles, srcFilesToObjectTargets; import reggae.rules.d: dlink; import reggae.types: TargetName, CompilerFlags, LinkerFlags, ImportPaths, StringImportPaths; import std.algorithm: map, joiner; import std.array: array; - import std.range: chain; + import std.range: chain, only; import std.traits: Unqual; template oneOptionalOf(T) { @@ -151,8 +176,14 @@ imported!"reggae.build".Target dubDependant dubVersDependencies.map!(d => d.dubInfo.packages.map!(p => p.stringImportPaths).joiner).joiner, ); - auto objs = objectFiles!sourcesFunc( + // auto allLinkerFlags = chain( + // "-L--no-as-needed".only, + // linkerFlags.value, + // ); + + auto objs = srcFilesToObjectTargets( options, + srcFiles, compilerFlags, const ImportPaths(allImportPaths), const StringImportPaths(allStringImportPaths), @@ -168,10 +199,11 @@ imported!"reggae.build".Target dubDependant return dlink( TargetName(targetNameWithExt), objs ~ dubDepsObjs, - linkerFlags, + linkerFlags, //const LinkerFlags(allLinkerFlags), ); } + private struct DubPathDependency { import reggae.options: Options; import reggae.build: Target; diff --git a/payload/reggae/types.d b/payload/reggae/types.d index 19f1eec1..d05b3c28 100644 --- a/payload/reggae/types.d +++ b/payload/reggae/types.d @@ -52,6 +52,8 @@ struct CompilerFlags { } struct LinkerFlags { + import std.range.primitives: isInputRange; + string[] value; this(string value) @trusted pure { @@ -63,6 +65,11 @@ struct LinkerFlags { this.value = values.dup; } + this(R)(R range) inout @trusted /*array*/ if(isInputRange!R) { + import std.array: array; + this.value = cast(typeof(this.value)) range.array; + } + this(inout(string)[] values) inout @safe @nogc pure nothrow { this.value = values; }