Skip to content

Commit 4d1bd62

Browse files
authored
Merge pull request #53 from KitsunebiGames/link-merge-ex
Add lflags exceptions for exclusiveMerge
2 parents f82456c + b3625a1 commit 4d1bd62

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

source/redub/buildapi.d

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,9 @@ private auto save(TRange)(TRange input)
498498
/**
499499
* This version is actually faster than the other one
500500
*/
501-
ref string[] exclusiveMerge(StringRange)(return scope ref string[] a, StringRange b, scope const string[] excludeFromMerge = null)
501+
ref string[] exclusiveMerge(StringRange)(return scope ref string[] a, StringRange b, scope const string[] excludeFromMerge = null, scope const string[] alwaysKeep = null)
502502
{
503-
import std.algorithm.searching:countUntil;
503+
import std.algorithm.searching : countUntil;
504504
import std.array;
505505
auto app = appender!(string[]);
506506
scope(exit)
@@ -511,7 +511,12 @@ ref string[] exclusiveMerge(StringRange)(return scope ref string[] a, StringRang
511511
{
512512
if(bV.length == 0) continue;
513513
if(countUntil(excludeFromMerge, bV) != -1) continue;
514-
foreach(aV; a)
514+
else if (countUntil(alwaysKeep, bV) != -1)
515+
{
516+
app ~= bV;
517+
continue outer;
518+
}
519+
else foreach(aV; a)
515520
{
516521
if(aV == bV)
517522
continue outer;

source/redub/parsers/base.d

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ void addFrameworks(ref BuildRequirements req, JSONStringArray frameworks, ParseC
138138
}
139139
void addVersions(ref BuildRequirements req, JSONStringArray vers, ParseConfig c){req.cfg.versions.exclusiveMerge(vers);}
140140
void addDebugVersions(ref BuildRequirements req, JSONStringArray vers, ParseConfig c){req.cfg.debugVersions.exclusiveMerge(vers);}
141-
void addLinkFlags(ref BuildRequirements req, JSONStringArray lFlags, ParseConfig c){req.cfg.linkFlags.exclusiveMerge(lFlags);}
141+
void addLinkFlags(ref BuildRequirements req, JSONStringArray lFlags, ParseConfig c){req.cfg.linkFlags.exclusiveMerge(lFlags, null, linkerMergeKeep);}
142142
void addDflags(ref BuildRequirements req, JSONStringArray dFlags, ParseConfig c){req.cfg.dFlags.exclusiveMerge(dFlags);}
143143
void addDependency(
144144
ref BuildRequirements req,
@@ -214,3 +214,10 @@ void addSubConfiguration(
214214
else
215215
req.dependencies[depIndex].subConfiguration = BuildRequirements.Configuration(subConfigurationName, false);
216216
}
217+
218+
const string[] linkerMergeKeep = [
219+
"-l",
220+
"-framework",
221+
"-L",
222+
"/LIBPATH",
223+
];

0 commit comments

Comments
 (0)