@@ -2279,7 +2279,7 @@ void Build::setupSolutionName(const path &file_or_dir)
22792279
22802280 bool dir = fs::is_directory (file_or_dir);
22812281 if (dir || isFrontendConfigFilename (file_or_dir))
2282- ide_solution_name = fs::canonical (file_or_dir).filename ().u8string ();
2282+ ide_solution_name = fs::canonical (file_or_dir).parent_path (). filename ().u8string ();
22832283 else
22842284 ide_solution_name = file_or_dir.stem ().u8string ();
22852285}
@@ -2636,23 +2636,62 @@ void Build::load_configless(const path &file_or_dir)
26362636
26372637 bool dir = fs::is_directory (config_file_or_dir);
26382638
2639- auto &s = solutions[0 ];
2640- auto &exe = s.addExecutable (ide_solution_name);
2641- bool read_deps_from_comments = false ;
2639+ Strings comments;
26422640 if (!dir)
26432641 {
2644- exe += file_or_dir;
2642+ // for generators
2643+ config = file_or_dir;
26452644
2646- // read deps from comments
2647- // read_deps_from_comments = true;
2645+ auto f = read_file (file_or_dir);
2646+
2647+ auto b = f.find (" /*" );
2648+ if (b != f.npos )
2649+ {
2650+ auto e = f.find (" */" , b);
2651+ if (e != f.npos )
2652+ {
2653+ auto s = f.substr (b + 2 , e - b - 2 );
2654+ if (!s.empty ())
2655+ comments.push_back (s);
2656+ }
2657+ }
26482658 }
26492659
2650- if (!read_deps_from_comments)
2660+ createSolutions (" " , false );
2661+ for (auto &s : solutions)
26512662 {
2652- for (auto &[p, d] : getPackageStore ().resolved_packages )
2663+ current_solution = &s;
2664+ if (!dir)
2665+ {
2666+ // exe += file_or_dir;
2667+
2668+ for (auto &c : comments)
2669+ {
2670+ auto root = YAML::Load (c);
2671+ cppan_load (root, file_or_dir.stem ().u8string ());
2672+ }
2673+
2674+ if (s.children .size () == 1 )
2675+ {
2676+ if (auto nt = s.children .begin ()->second ->as <NativeExecutedTarget>())
2677+ *nt += file_or_dir;
2678+ }
2679+
2680+ TargetsToBuild = s.children ;
2681+ }
2682+ else
26532683 {
2654- if (d.installed )
2655- exe += std::make_shared<Dependency>(p.toString ());
2684+ auto &exe = s.addExecutable (ide_solution_name);
2685+ bool read_deps_from_comments = false ;
2686+
2687+ if (!read_deps_from_comments)
2688+ {
2689+ for (auto &[p, d] : getPackageStore ().resolved_packages )
2690+ {
2691+ if (d.installed )
2692+ exe += std::make_shared<Dependency>(p.toString ());
2693+ }
2694+ }
26562695 }
26572696 }
26582697}
@@ -2697,6 +2736,7 @@ void Build::build_packages(const StringSet &pkgs)
26972736 getExecutor (e.get ());
26982737 }
26992738
2739+ //
27002740 UnresolvedPackages upkgs;
27012741 for (auto &p : pkgs)
27022742 upkgs.insert (extractFromString (p));
0 commit comments