@@ -521,6 +521,8 @@ bool runcpp2::CleanupDependencies( const runcpp2::Data::Profile& profile,
521521 return true ;
522522}
523523
524+ // #define RUNCPP2_USE_PARALLEL_FOR_DEP 0
525+
524526bool runcpp2::SetupDependenciesIfNeeded (const runcpp2::Data::Profile& profile,
525527 const ghc::filesystem::path& buildDir,
526528 const Data::ScriptInfo& scriptInfo,
@@ -550,12 +552,14 @@ bool runcpp2::SetupDependenciesIfNeeded(const runcpp2::Data::Profile& profile,
550552 if (!PopulateAbsoluteIncludePaths (availableDependencies, dependenciesLocalCopiesPaths))
551553 return false ;
552554
555+ #if RUNCPP2_USE_PARALLEL_FOR_DEP
553556 std::vector<std::future<bool >> actions;
554557 std::vector<bool > finished;
555558
556559 // Cache logs for worker threads
557560 ssLOG_ENABLE_CACHE_OUTPUT_FOR_NEW_THREADS ();
558561 int logLevel = ssLOG_GET_CURRENT_THREAD_TARGET_LEVEL ();
562+ #endif
559563
560564 // Run setup steps
561565 for (int i = 0 ; i < availableDependencies.size (); ++i)
@@ -567,6 +571,7 @@ bool runcpp2::SetupDependenciesIfNeeded(const runcpp2::Data::Profile& profile,
567571 continue ;
568572 }
569573
574+ #if RUNCPP2_USE_PARALLEL_FOR_DEP
570575 actions.emplace_back
571576 (
572577 std::async
@@ -575,7 +580,8 @@ bool runcpp2::SetupDependenciesIfNeeded(const runcpp2::Data::Profile& profile,
575580 [i, &profile, &availableDependencies, &dependenciesLocalCopiesPaths, logLevel]()
576581 {
577582 ssLOG_SET_CURRENT_THREAD_TARGET_LEVEL (logLevel);
578-
583+ #endif
584+
579585 ssLOG_INFO (" Running setup commands for " << availableDependencies.at (i)->Name );
580586 if (!RunDependenciesSteps ( profile,
581587 availableDependencies.at (i)->Setup ,
@@ -586,6 +592,8 @@ bool runcpp2::SetupDependenciesIfNeeded(const runcpp2::Data::Profile& profile,
586592 availableDependencies.at (i)->Name );
587593 return false ;
588594 }
595+
596+ #if RUNCPP2_USE_PARALLEL_FOR_DEP
589597 return true ;
590598 }
591599 )
@@ -638,6 +646,8 @@ bool runcpp2::SetupDependenciesIfNeeded(const runcpp2::Data::Profile& profile,
638646 actions.clear ();
639647 finished.clear ();
640648 }
649+
650+ #endif // #if RUNCPP2_USE_PARALLEL_FOR_DEP
641651 }
642652
643653 ssLOG_OUTPUT_ALL_CACHE_GROUPED ();
@@ -656,18 +666,21 @@ bool runcpp2::BuildDependencies(const runcpp2::Data::Profile& profile,
656666 if (!scriptInfo.Populated )
657667 return true ;
658668
669+ #if RUNCPP2_USE_PARALLEL_FOR_DEP
659670 std::vector<std::future<bool >> actions;
660671 std::vector<bool > finished;
661672
662673 // Cache logs for worker threads
663674 ssLOG_ENABLE_CACHE_OUTPUT_FOR_NEW_THREADS ();
664675 int logLevel = ssLOG_GET_CURRENT_THREAD_TARGET_LEVEL ();
676+ #endif
665677
666678 // Run build steps
667679 for (int i = 0 ; i < availableDependencies.size (); ++i)
668680 {
669681 ssLOG_INFO (" Running build commands for " << availableDependencies.at (i)->Name );
670682
683+ #if RUNCPP2_USE_PARALLEL_FOR_DEP
671684 actions.emplace_back
672685 (
673686 std::async
@@ -676,6 +689,7 @@ bool runcpp2::BuildDependencies(const runcpp2::Data::Profile& profile,
676689 [i, &profile, &availableDependencies, &dependenciesLocalCopiesPaths, logLevel]()
677690 {
678691 ssLOG_SET_CURRENT_THREAD_TARGET_LEVEL (logLevel);
692+ #endif
679693
680694 if (!RunDependenciesSteps ( profile,
681695 availableDependencies.at (i)->Build ,
@@ -685,6 +699,8 @@ bool runcpp2::BuildDependencies(const runcpp2::Data::Profile& profile,
685699 ssLOG_ERROR (" Failed to build dependency " << availableDependencies.at (i)->Name );
686700 return false ;
687701 }
702+
703+ #if RUNCPP2_USE_PARALLEL_FOR_DEP
688704 return true ;
689705 }
690706 )
@@ -737,6 +753,7 @@ bool runcpp2::BuildDependencies(const runcpp2::Data::Profile& profile,
737753 actions.clear ();
738754 finished.clear ();
739755 }
756+ #endif // //#if RUNCPP2_USE_PARALLEL_FOR_DEP
740757 }
741758
742759 ssLOG_OUTPUT_ALL_CACHE_GROUPED ();
0 commit comments