@@ -493,6 +493,66 @@ bool runcpp2::CopyDependenciesBinaries( const ghc::filesystem::path& buildDir,
493493
494494 for (int i = 0 ; i < availableDependencies.size (); ++i)
495495 {
496+ std::vector<std::string> currentProfileNames;
497+ profile.GetNames (currentProfileNames);
498+
499+ if (runcpp2::HasValueFromPlatformMap (availableDependencies.at (i)->FilesToCopy ))
500+ {
501+ const runcpp2::Data::FilesToCopyInfo& filesToCopy =
502+ *runcpp2::GetValueFromPlatformMap (availableDependencies.at (i)->FilesToCopy );
503+
504+ std::string profileNameToUse;
505+ for (int j = 0 ; j < currentProfileNames.size (); ++j)
506+ {
507+ if ( filesToCopy.ProfileFiles .find (currentProfileNames.at (j)) !=
508+ filesToCopy.ProfileFiles .end ())
509+ {
510+ profileNameToUse = currentProfileNames.at (j);
511+ break ;
512+ }
513+ }
514+
515+ if (!profileNameToUse.empty ())
516+ {
517+ const std::vector<std::string>& filesToCopyForProfile =
518+ filesToCopy.ProfileFiles .at (profileNameToUse);
519+
520+ for (int j = 0 ; j < filesToCopyForProfile.size (); ++j)
521+ {
522+ ghc::filesystem::path srcPath =
523+ ghc::filesystem::path (dependenciesCopiesPaths.at (i)) /
524+ filesToCopyForProfile.at (j);
525+
526+ ghc::filesystem::path destPath =
527+ buildDir / ghc::filesystem::path (filesToCopyForProfile.at (j)).filename ();
528+
529+ std::error_code e;
530+ // TODO: Maybe we can check if destPath timestamp is newer and avoid copy?
531+ if (ghc::filesystem::exists (srcPath, e))
532+ {
533+ ghc::filesystem::copy ( srcPath,
534+ destPath,
535+ ghc::filesystem::copy_options::overwrite_existing,
536+ e);
537+
538+ if (e)
539+ {
540+ ssLOG_ERROR (" Failed to copy file from " << srcPath.string () <<
541+ " to " << destPath.string ());
542+ ssLOG_ERROR (" Error: " << e.message ());
543+ return false ;
544+ }
545+
546+ ssLOG_INFO (" Copied from " << srcPath.string ());
547+ ssLOG_INFO (" Copied to " << destPath.string ());
548+ outCopiedBinariesPaths.push_back (runcpp2::ProcessPath (destPath));
549+ }
550+ else
551+ ssLOG_WARNING (" File not found: " << srcPath.string ());
552+ }
553+ }
554+ }
555+
496556 std::vector<std::string> extensionsToCopy;
497557
498558 // Get all the file extensions to copy
@@ -525,9 +585,6 @@ bool runcpp2::CopyDependenciesBinaries( const ghc::filesystem::path& buildDir,
525585 const PropertyMap& linkProperties = availableDependencies.at (i)->LinkProperties ;
526586
527587 // See if we can find the link properties with the profile name
528- std::vector<std::string> currentProfileNames;
529- profile.GetNames (currentProfileNames);
530-
531588 auto foundPropertyIt = linkProperties.end ();
532589 for (int j = 0 ; j < currentProfileNames.size (); ++j)
533590 {
0 commit comments