@@ -630,10 +630,14 @@ void Build::build_and_resolve(int n_runs)
630630 sr.restoreNow (true );
631631
632632 sw_check_abi_version (getModuleStorage (*this ).get (dll).sw_get_module_abi_version ());
633- getModuleStorage (*this ).get (dll).check (*this , checker);
634- // we can use new (clone of this) solution, then copy known targets
635- // to allow multiple passes-builds
636- getModuleStorage (*this ).get (dll).build (*this );
633+ for (auto &s : settings)
634+ {
635+ current_settings = &s;
636+ getModuleStorage (*this ).get (dll).check (*this , checker);
637+ // we can use new (clone of this) solution, then copy known targets
638+ // to allow multiple passes-builds
639+ getModuleStorage (*this ).get (dll).build (*this );
640+ }
637641
638642 sr.restoreNow (true );
639643
@@ -842,9 +846,12 @@ void Build::resolvePass(const Target &t, const DependenciesType &deps) const
842846 auto i = h->getChildren ().find (d->getPackage ());
843847 if (i != h->getChildren ().end ())
844848 {
845- auto t = std::static_pointer_cast<NativeTarget>(i->second .begin ()->second );
846- if (t)
847- d->setTarget (*t);
849+ auto i2 = i->second .find (TargetSettings{ t.getSettings () });
850+ if (i2 == i->second .end ())
851+ throw SW_RUNTIME_ERROR (" no such target: " + d->getPackage ().toString ());
852+ auto t2 = std::static_pointer_cast<NativeTarget>(i2->second );
853+ if (t2)
854+ d->setTarget (*t2);
848855 else
849856 throw SW_RUNTIME_ERROR (" bad target cast to NativeTarget during resolve" );
850857
@@ -903,11 +910,9 @@ void Build::addFirstConfig()
903910 addSettings (ss);
904911}
905912
906- void Build::findCompiler ()
913+ /* void Build::findCompiler()
907914{
908- SW_UNIMPLEMENTED;
909-
910- /* Settings.init();
915+ Settings.init();
911916
912917 if (!disable_compiler_lookup)
913918 detectCompilers(*this);
@@ -1154,8 +1159,8 @@ void Build::findCompiler()
11541159 add_target("org.LLVM.clangpp");
11551160 }
11561161
1157- setSettings();*/
1158- }
1162+ setSettings();
1163+ }*/
11591164
11601165static auto getFilesHash (const Files &files)
11611166{
@@ -2612,7 +2617,7 @@ void Build::load_packages(const StringSet &pkgs)
26122617 // now we set ours TargetsToBuild to this object
26132618 // execute() will propagate them to solutions
26142619 for (auto &[porig, p] : m)
2615- TargetsToBuild[p];
2620+ TargetsToBuild[p] = getChildren ()[p] ;
26162621}
26172622
26182623void Build::build_packages (const StringSet &pkgs)
@@ -2887,10 +2892,9 @@ void Build::createSolutions(const path &dll, bool usedll)
28872892 // compiler
28882893 auto set_cl = [](auto &s, const String &compiler)
28892894 {
2890- SW_UNIMPLEMENTED;
28912895 auto t = compilerTypeFromStringCaseI (compiler);
2892- // if (toIndex(t))
2893- // s.Native.CompilerType = t;
2896+ if (toIndex (t))
2897+ s.Native .CompilerType1 = t;
28942898 };
28952899
28962900 mult_and_action (compiler.size (), [&set_cl](auto &s, int i)
@@ -2941,12 +2945,10 @@ void Build::load_dll(const path &dll, bool usedll)
29412945 // add cc if needed
29422946 // getHostSolution();
29432947
2948+ // initiate libc
29442949 for (auto &s : settings)
29452950 {
2946- // apply config settings
2947- // s.findCompiler();
2948-
2949- // initiate libc
2951+ current_settings = &s;
29502952 // if (s.Settings.Native.libc)
29512953 // {
29522954 // Resolver r;
@@ -3001,7 +3003,10 @@ void Build::load_dll(const path &dll, bool usedll)
30013003 if (usedll)
30023004 {
30033005 for (auto &s : settings)
3006+ {
3007+ current_settings = &s;
30043008 getModuleStorage (*this ).get (dll).check (*this , checker);
3009+ }
30053010 }
30063011 }
30073012
0 commit comments