@@ -7,8 +7,9 @@ import redub.logging;
77import redub.building.cache;
88
99// / Parse G++ configuration
10- string [] parseBuildConfiguration (const BuildConfiguration b, CompilingSession s, string requirementCache , bool isRoot, const string [] extensions... )
10+ string [] parseBuildConfiguration (const BuildConfiguration b, CompilingSession s, string mainPackHash , bool isRoot, const string [] extensions... )
1111{
12+ import std.file ;
1213 import std.algorithm.iteration :map;
1314 import redub.misc.path;
1415
@@ -17,7 +18,7 @@ string[] parseBuildConfiguration(const BuildConfiguration b, CompilingSession s,
1718 with (b)
1819 {
1920 if (isDebug) commands~= " -g" ;
20- if (targetType.isLinkedSeparately) commands~= " -c" ;
21+ commands~= " -c" ;
2122
2223 commands = mapAppendPrefix(commands, versions, " -D" , false );
2324 commands~= dFlags;
@@ -26,14 +27,15 @@ string[] parseBuildConfiguration(const BuildConfiguration b, CompilingSession s,
2627
2728
2829 string outFlag = getTargetTypeFlag(targetType);
29- if (outFlag) commands ~= outFlag ;
30-
31- if (targetType.isLinkedSeparately )
32- {
33- commands~= " -o" ;
34- string cacheDir = getCacheOutputDir(requirementCache, b, s, isRoot);
30+ string cacheDir = getCacheOutputDir(mainPackHash, b, s, isRoot) ;
31+ mkdirRecurse(cacheDir);
32+ if (outFlag )
33+ commands ~= outFlag;
34+ commands~= " -o" ;
35+ if (outFlag)
3536 commands ~= buildNormalizedPath(cacheDir, getConfigurationOutputName(b, s.os)).escapePath;
36- }
37+ else
38+ commands ~= buildNormalizedPath(cacheDir, getObjectOutputName(b, os)).escapePath;
3739 }
3840
3941 return commands;
@@ -44,8 +46,7 @@ string getTargetTypeFlag(TargetType o)
4446 final switch (o) with (TargetType)
4547 {
4648 case invalid, none: throw new Exception (" Invalid targetType" );
47- case autodetect, executable, sourceLibrary: return null ;
49+ case autodetect, executable, sourceLibrary, staticLibrary, library : return null ;
4850 case dynamicLibrary: return " -shared" ;
49- case staticLibrary, library: return " -c" ;
5051 }
5152}
0 commit comments