@@ -119,7 +119,6 @@ namespace
119119 return true ;
120120
121121 // Find the platform name we use for setup
122- PlatformName chosenPlatformName;
123122 if (!runcpp2::HasValueFromPlatformMap (steps))
124123 {
125124 if (required)
@@ -134,39 +133,26 @@ namespace
134133 const runcpp2::Data::DependencyCommands& dependencySteps =
135134 *runcpp2::GetValueFromPlatformMap (steps);
136135
137- std::string profileNameToUse;
138- std::vector<std::string> currentProfileNames;
139- profile.GetNames (currentProfileNames);
140-
141- for (int i = 0 ; i < currentProfileNames.size (); ++i)
142- {
143- if (dependencySteps.CommandSteps .count (currentProfileNames.at (i)) > 0 )
144- {
145- profileNameToUse = currentProfileNames.at (i);
146- break ;
147- }
148- }
149-
150- if (profileNameToUse.empty ())
136+ const std::vector<std::string>* commands =
137+ runcpp2::GetValueFromProfileMap (profile, dependencySteps.CommandSteps );
138+
139+ if (!commands)
151140 {
152141 ssLOG_ERROR (" Failed to find steps for profile " << profile.Name <<
153142 " for current platform" );
154143 return false ;
155144 }
156145
157146 // Run the commands
158- const std::vector<std::string>& commands =
159- dependencySteps.CommandSteps .at (profileNameToUse);
160-
161- for (int k = 0 ; k < commands.size (); ++k)
147+ for (int k = 0 ; k < commands->size (); ++k)
162148 {
163149 std::string processedDependencyPath = runcpp2::ProcessPath (dependenciesCopiedDirectory);
164- ssLOG_INFO ( " Running command: " << commands. at (k) << " in " <<
150+ ssLOG_INFO ( " Running command: " << commands-> at (k) << " in " <<
165151 processedDependencyPath);
166152
167153 int returnCode = 0 ;
168154 std::string output;
169- if (!runcpp2::RunCommandAndGetOutput (commands. at (k),
155+ if (!runcpp2::RunCommandAndGetOutput (commands-> at (k),
170156 output,
171157 returnCode,
172158 processedDependencyPath))
@@ -485,7 +471,6 @@ bool runcpp2::GatherDependenciesBinaries( const std::vector<Data::DependencyIn
485471 const Data::Profile& profile,
486472 std::vector<std::string>& outBinariesPaths)
487473{
488- std::vector<std::string> platformNames = GetPlatformNames ();
489474 std::unordered_set<std::string> binariesPathsSet;
490475 for (int i = 0 ; i < outBinariesPaths.size (); ++i)
491476 binariesPathsSet.insert (outBinariesPaths[i]);
@@ -508,35 +493,22 @@ bool runcpp2::GatherDependenciesBinaries( const std::vector<Data::DependencyIn
508493 for (int i = 0 ; i < availableDependencies.size (); ++i)
509494 {
510495 ssLOG_INFO (" Evaluating dependency " << availableDependencies.at (i)->Name );
511- std::vector<std::string> currentProfileNames;
512- profile.GetNames (currentProfileNames);
513496
514497 if (runcpp2::HasValueFromPlatformMap (availableDependencies.at (i)->FilesToCopy ))
515498 {
516499 const runcpp2::Data::FilesToCopyInfo& filesToCopy =
517500 *runcpp2::GetValueFromPlatformMap (availableDependencies.at (i)->FilesToCopy );
518501
519- std::string profileNameToUse;
520- for (int j = 0 ; j < currentProfileNames.size (); ++j)
521- {
522- if ( filesToCopy.ProfileFiles .find (currentProfileNames.at (j)) !=
523- filesToCopy.ProfileFiles .end ())
524- {
525- profileNameToUse = currentProfileNames.at (j);
526- break ;
527- }
528- }
502+ const std::vector<std::string>* filesToGatherForProfile =
503+ runcpp2::GetValueFromProfileMap (profile, filesToCopy.ProfileFiles );
529504
530- if (!profileNameToUse. empty () )
505+ if (filesToGatherForProfile )
531506 {
532- const std::vector<std::string>& filesToGatherForProfile =
533- filesToCopy.ProfileFiles .at (profileNameToUse);
534-
535- for (int j = 0 ; j < filesToGatherForProfile.size (); ++j)
507+ for (int j = 0 ; j < filesToGatherForProfile->size (); ++j)
536508 {
537509 ghc::filesystem::path srcPath =
538510 ghc::filesystem::path (dependenciesCopiesPaths.at (i)) /
539- filesToGatherForProfile. at (j);
511+ filesToGatherForProfile-> at (j);
540512
541513 std::error_code e;
542514 if (ghc::filesystem::exists (srcPath, e))
@@ -563,21 +535,12 @@ bool runcpp2::GatherDependenciesBinaries( const std::vector<Data::DependencyIn
563535 {
564536 return false ;
565537 }
566-
567- for (int j = 0 ; j < platformNames.size (); ++j)
568- {
569- if ( profile.FilesTypes .DebugSymbolFile .Extension .find (platformNames.at (j)) ==
570- profile.FilesTypes .DebugSymbolFile .Extension .end ())
571- {
572- continue ;
573- }
538+
539+ const std::string* debugSymbolExt =
540+ runcpp2::GetValueFromPlatformMap (profile.FilesTypes .DebugSymbolFile .Extension );
574541
575- extensionsToLink.push_back (profile .FilesTypes
576- .DebugSymbolFile
577- .Extension
578- .at (platformNames.at (j)));
579- break ;
580- }
542+ if (debugSymbolExt)
543+ extensionsToLink.push_back (*debugSymbolExt);
581544 }
582545
583546 if (availableDependencies.at (i)->LibraryType == Data::DependencyLibraryType::HEADER)
@@ -597,36 +560,24 @@ bool runcpp2::GatherDependenciesBinaries( const std::vector<Data::DependencyIn
597560 const Data::DependencyLinkProperty& linkProperty =
598561 *runcpp2::GetValueFromPlatformMap (linkProperties);
599562
600- // Find the matching profile
601- ProfileName targetProfileName;
602- for (int j = 0 ; j < currentProfileNames.size (); ++j)
603- {
604- if ( linkProperty.ProfileProperties .find (currentProfileNames.at (j)) !=
605- linkProperty.ProfileProperties .end ())
606- {
607- targetProfileName = currentProfileNames.at (j);
608- break ;
609- }
610- }
611-
612- if (targetProfileName.empty ())
563+ const Data::ProfileLinkProperty* profileLinkProperty =
564+ runcpp2::GetValueFromProfileMap (profile, linkProperty.ProfileProperties );
565+
566+ if (!profileLinkProperty)
613567 continue ;
614568
615- const Data::ProfileLinkProperty& profileLinkProperty =
616- linkProperty.ProfileProperties .at (targetProfileName);
617-
618569 for (int searchLibIndex = 0 ;
619- searchLibIndex < profileLinkProperty. SearchLibraryNames .size ();
570+ searchLibIndex < profileLinkProperty-> SearchLibraryNames .size ();
620571 ++searchLibIndex)
621572 {
622573 for (int searchDirIndex = 0 ;
623- searchDirIndex < profileLinkProperty. SearchDirectories .size ();
574+ searchDirIndex < profileLinkProperty-> SearchDirectories .size ();
624575 ++searchDirIndex)
625576 {
626577 std::string currentSearchLibraryName =
627- profileLinkProperty. SearchLibraryNames .at (searchLibIndex);
578+ profileLinkProperty-> SearchLibraryNames .at (searchLibIndex);
628579 std::string currentSearchDirectory =
629- profileLinkProperty. SearchDirectories .at (searchDirIndex);
580+ profileLinkProperty-> SearchDirectories .at (searchDirIndex);
630581
631582 if (!ghc::filesystem::path (currentSearchDirectory).is_absolute ())
632583 {
@@ -662,10 +613,12 @@ bool runcpp2::GatherDependenciesBinaries( const std::vector<Data::DependencyIn
662613 if (currentFileName.find (currentSearchLibraryName) != std::string::npos)
663614 nameMatched = true ;
664615
665- for (int excludeIndex = 0 ; excludeIndex < profileLinkProperty.ExcludeLibraryNames .size (); ++excludeIndex)
616+ for (int excludeIndex = 0 ;
617+ excludeIndex < profileLinkProperty->ExcludeLibraryNames .size ();
618+ ++excludeIndex)
666619 {
667620 std::string currentExcludeLibraryName =
668- profileLinkProperty. ExcludeLibraryNames .at (excludeIndex);
621+ profileLinkProperty-> ExcludeLibraryNames .at (excludeIndex);
669622
670623 if (currentFileName.find (currentExcludeLibraryName) != std::string::npos)
671624 {
0 commit comments