@@ -31,18 +31,15 @@ namespace
3131 *runcpp2::GetValueFromPlatformMap (overrideFlags);
3232
3333 std::string foundProfileName;
34+ std::vector<std::string> currentProfileNames;
35+ profile.GetNames (currentProfileNames);
3436
35- if (currentFlagsOverride.FlagsOverrides .count (profile.Name ) > 0 )
36- foundProfileName = profile.Name ;
37- else
37+ for (int i = 0 ; i < currentProfileNames.size (); ++i)
3838 {
39- for ( auto it = profile. NameAliases . begin (); it != profile. NameAliases . end (); ++it )
39+ if (currentFlagsOverride. FlagsOverrides . count (currentProfileNames. at (i)) > 0 )
4040 {
41- if (currentFlagsOverride.FlagsOverrides .count (*it) > 0 )
42- {
43- foundProfileName = *it;
44- break ;
45- }
41+ foundProfileName = currentProfileNames.at (i);
42+ break ;
4643 }
4744 }
4845
@@ -83,6 +80,7 @@ namespace
8380
8481 bool CompileScript ( const std::string& scriptPath,
8582 const runcpp2::Data::ScriptInfo& scriptInfo,
83+ const std::vector<runcpp2::Data::DependencyInfo*>& availableDependencies,
8684 const runcpp2::Data::Profile& profile,
8785 bool compileAsExecutable,
8886 std::string& outScriptObjectFilePath)
@@ -112,15 +110,13 @@ namespace
112110
113111 // Include Directories
114112 {
115- for (int i = 0 ; i < scriptInfo.Dependencies .size (); ++i)
113+ // TODO(NOW): Use filtered dependencies instead
114+ for (int i = 0 ; i < availableDependencies.size (); ++i)
116115 {
117- if (!runcpp2::IsDependencyAvailableForThisPlatform (scriptInfo.Dependencies .at (i)))
118- continue ;
119-
120- for (int j = 0 ; j < scriptInfo.Dependencies .at (i).AbsoluteIncludePaths .size (); ++j)
116+ for (int j = 0 ; j < availableDependencies.at (i)->AbsoluteIncludePaths .size (); ++j)
121117 {
122118 const std::string& currentIncludePath =
123- scriptInfo. Dependencies . at (i). AbsoluteIncludePaths .at (j);
119+ availableDependencies. at (i)-> AbsoluteIncludePaths .at (j);
124120
125121 substitutionMap[" {IncludeDirectoryPath}" ].push_back (currentIncludePath);
126122 }
@@ -262,6 +258,7 @@ namespace
262258
263259 bool LinkScript (const std::string& scriptPath,
264260 const runcpp2::Data::ScriptInfo& scriptInfo,
261+ const std::vector<runcpp2::Data::DependencyInfo*>& availableDependencies,
265262 const runcpp2::Data::Profile& profile,
266263 const std::string& scriptObjectFilePath,
267264 const std::vector<std::string>& copiedDependenciesBinariesPaths,
@@ -288,46 +285,27 @@ namespace
288285 AppendAndRemoveFlags (profile, scriptInfo.OverrideLinkFlags , linkFlags);
289286
290287 // Add link flags for the dependencies
291- for (int i = 0 ; i < scriptInfo.Dependencies .size (); ++i)
288+ // TODO(NOW): Use the filtered dependencies
289+ for (int i = 0 ; i < availableDependencies.size (); ++i)
292290 {
293- if (!runcpp2::IsDependencyAvailableForThisPlatform (scriptInfo.Dependencies .at (i)))
294- continue ;
295-
296291 std::string targetProfileName;
292+ std::vector<std::string> currentProfileNames;
293+ profile.GetNames (currentProfileNames);
297294
298- // Check for profile name first
299- if ( scriptInfo.Dependencies .at (i).LinkProperties .find (profile.Name ) !=
300- scriptInfo.Dependencies .at (i).LinkProperties .end ())
295+ for (int j = 0 ; j < currentProfileNames.size (); ++j)
301296 {
302- targetProfileName = profile.Name ;
303- }
304- else
305- {
306- // If not check for profile name aliases
307- for (const auto & alias : profile.NameAliases )
308- {
309- if ( scriptInfo.Dependencies .at (i).LinkProperties .find (alias) !=
310- scriptInfo.Dependencies .at (i).LinkProperties .end ())
311- {
312- targetProfileName = alias;
313- break ;
314- }
315- }
316-
317- // Final check for "All"
318- if ( targetProfileName.empty () &&
319- scriptInfo.Dependencies .at (i).LinkProperties .find (" All" ) !=
320- scriptInfo.Dependencies .at (i).LinkProperties .end ())
297+ if ( availableDependencies.at (i)->LinkProperties .find (currentProfileNames.at (j)) !=
298+ availableDependencies.at (i)->LinkProperties .end ())
321299 {
322- targetProfileName = " All " ;
300+ targetProfileName = currentProfileNames. at (j) ;
323301 }
324302 }
325303
326304 if (targetProfileName.empty ())
327305 continue ;
328306
329307 const runcpp2::Data::DependencyLinkProperty& currentLinkProperty =
330- scriptInfo. Dependencies . at (i). LinkProperties .at (targetProfileName);
308+ availableDependencies. at (i)-> LinkProperties .at (targetProfileName);
331309
332310 if (runcpp2::HasValueFromPlatformMap (currentLinkProperty.AdditionalLinkOptions ))
333311 {
@@ -648,6 +626,7 @@ namespace
648626
649627bool runcpp2::CompileAndLinkScript ( const std::string& scriptPath,
650628 const Data::ScriptInfo& scriptInfo,
629+ const std::vector<Data::DependencyInfo*>& availableDependencies,
651630 const Data::Profile& profile,
652631 const std::vector<std::string>& copiedDependenciesBinariesPaths,
653632 bool buildExecutable,
@@ -661,14 +640,20 @@ bool runcpp2::CompileAndLinkScript( const std::string& scriptPath,
661640
662641 std::string scriptObjectFilePath;
663642
664- if (!CompileScript (scriptPath, scriptInfo, profile, buildExecutable, scriptObjectFilePath))
643+ if (!CompileScript ( scriptPath,
644+ scriptInfo,
645+ availableDependencies,
646+ profile,
647+ buildExecutable,
648+ scriptObjectFilePath))
665649 {
666650 ssLOG_ERROR (" CompileScript failed" );
667651 return false ;
668652 }
669653
670654 if (!LinkScript ( scriptPath,
671655 scriptInfo,
656+ availableDependencies,
672657 profile,
673658 scriptObjectFilePath,
674659 copiedDependenciesBinariesPaths,
0 commit comments