X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fvcxprojectgenerator.cpp;h=93c0eb49f7a6076608dd0cde22846492b94fbe36;hb=aa053d637e8259755af7d2e4b510a242f4d29c7b;hp=52451f59d939c51b62796294341ee63223ab6b64;hpb=9dd42116ce72f8b2288ab535f89242f87a44337a;p=builder.git diff --git a/source/vcxprojectgenerator.cpp b/source/vcxprojectgenerator.cpp index 52451f5..93c0eb4 100644 --- a/source/vcxprojectgenerator.cpp +++ b/source/vcxprojectgenerator.cpp @@ -16,7 +16,7 @@ VcxProjectGenerator::VcxProjectGenerator(Builder &b): Tool(b, "VCXG") { } -Target *VcxProjectGenerator::create_target(const list &, const string &) +Target *VcxProjectGenerator::create_target(const vector &, const string &) { throw logic_error("Not implemented"); } @@ -43,13 +43,13 @@ void VcxProjectGenerator::Worker::main() IO::print(out, "\t\n"); vector build_types = builder.get_build_types(); - const char *platforms[] = { "Win32", "x64", 0 }; - for(const char **i=platforms; *i; ++i) - for(vector::const_iterator j=build_types.begin(); j!=build_types.end(); ++j) + const char *platforms[] = { "Win32", "x64" }; + for(const char *p: platforms) + for(const string &b: build_types) { - IO::print(out, "\t\t\n", *j, *i); - IO::print(out, "\t\t\t%s\n", *j); - IO::print(out, "\t\t\t%s\n", *i); + IO::print(out, "\t\t\n", b, p); + IO::print(out, "\t\t\t%s\n", b); + IO::print(out, "\t\t\t%s\n", p); IO::print(out, "\t\t\n"); } IO::print(out, "\t\n"); @@ -57,43 +57,49 @@ void VcxProjectGenerator::Worker::main() IO::print(out, "\t\n"); IO::print(out, "\t\t15.0\n"); IO::print(out, "\t\tMakeFileProj\n"); + IO::print(out, "\t\t{%s}\n", target.get_guid()); IO::print(out, "\t\n"); IO::print(out, "\t\n"); - const Target *world = builder.get_build_graph().get_target("world"); - const Target::Dependencies &world_deps = world->get_dependencies(); const Executable *exe = 0; - for(Target::Dependencies::const_iterator i=world_deps.begin(); (!exe && i!=world_deps.end()); ++i) - if((*i)->get_package()==&spkg) - exe = dynamic_cast(*i); + for(const Target *t: builder.get_build_graph().get_target("world")->get_dependencies()) + if(t->get_package()==&spkg) + if((exe = dynamic_cast(t))) + break; const char *argv0 = Application::get_argv0(); const string &toolchain = builder.get_current_arch().get_toolchain(); - for(const char **i=platforms; *i; ++i) - for(vector::const_iterator j=build_types.begin(); j!=build_types.end(); ++j) + for(const char *p: platforms) + for(const string &b: build_types) { - string base_cmd = format("%s --arch=%s-%s --build-type=%s --prefix=%s", argv0, *i, toolchain, *j, builder.get_prefix()); - IO::print(out, "\t\n", *j, *i); + string base_cmd = format("%s --arch=%s-%s --build-type=%s --prefix=%s", argv0, p, toolchain, b, builder.get_prefix()); + IO::print(out, "\t\n", b, p); IO::print(out, "\t\tMakeFile\n"); IO::print(out, "\t\t%s\n", base_cmd); IO::print(out, "\t\t%s -c\n", base_cmd); IO::print(out, "\t\t%s -B\n", base_cmd); if(exe) IO::print(out, "\t\t%s\n", exe->get_path()); - IO::print(out, "\t\t\tv142\n"); IO::print(out, "\t\n"); } IO::print(out, "\t\n"); - const BuildGraph::TargetMap &targets = builder.get_build_graph().get_targets(); vector sources; vector includes; vector others; - for(BuildGraph::TargetMap::const_iterator i=targets.begin(); i!=targets.end(); ++i) - if(i->second->get_package()==&spkg && !i->second->is_buildable()) - if(const FileTarget *file = dynamic_cast(i->second)) + BuildInfo build_info; + for(const auto &kvp: builder.get_build_graph().get_targets()) + if(kvp.second->get_package()==&spkg) + { + if(kvp.second->is_buildable()) + { + BuildInfo tgt_binfo; + kvp.second->collect_build_info(tgt_binfo); + build_info.update_from(tgt_binfo, BuildInfo::CHAINED); + } + else if(const FileTarget *file = dynamic_cast(kvp.second)) { if(dynamic_cast(file)) { @@ -106,20 +112,31 @@ void VcxProjectGenerator::Worker::main() else others.push_back(file); } + } + + if(!build_info.incpath.empty()) + { + IO::print(out, "\t\n"); + string path_str; + for(const FS::Path &p: build_info.incpath) + append(path_str, ";", p.str()); + IO::print(out, "\t\t%s\n", path_str); + IO::print(out, "\t\n"); + } IO::print(out, "\t\n"); - for(vector::const_iterator i=sources.begin(); i!=sources.end(); ++i) - IO::print(out, "\t\t\n", (*i)->get_path()); + for(const FileTarget *s: sources) + IO::print(out, "\t\t\n", s->get_path()); IO::print(out, "\t\n"); IO::print(out, "\t\n"); - for(vector::const_iterator i=includes.begin(); i!=includes.end(); ++i) - IO::print(out, "\t\t\n", (*i)->get_path()); + for(const FileTarget *i: includes) + IO::print(out, "\t\t\n", i->get_path()); IO::print(out, "\t\n"); IO::print(out, "\t\n"); - for(vector::const_iterator i=others.begin(); i!=others.end(); ++i) - IO::print(out, "\t\t\n", (*i)->get_path()); + for(const FileTarget *t: others) + IO::print(out, "\t\t\n", t->get_path()); IO::print(out, "\t\n"); IO::print(out, "\t\n");