throw invalid_argument("MsvcCompiler::MsvcCompiler");
set_command((ms_tools.get_vc_bin_dir()/"cl.exe").str(), false);
+ set_run(_run);
}
Target *MsvcCompiler::create_source(const Component &comp, const FS::Path &path) const
return new CSourceFile(builder, path);
}
-Target *MsvcCompiler::create_target(const list<Target *> &sources, const string &)
+Target *MsvcCompiler::create_target(const vector<Target *> &sources, const string &)
{
if(sources.size()!=1)
throw invalid_argument("MsvcCompiler::create_target");
string MsvcCompiler::create_build_signature(const BuildInfo &binfo) const
{
- string result = FS::basename(executable->get_path());
+ string result = Tool::create_build_signature(binfo);
result += ',';
if(binfo.debug)
result += 'g';
system_path.push_back(win_sdk_dir/"include"/win_sdk_ver/"um");
string path;
- for(SearchPath::const_iterator i=system_path.begin(); i!=system_path.end(); ++i)
+ for(const FS::Path &p: system_path)
{
- append(path, ";", i->str());
- builder.get_logger().log("tools", format("Got %s system path: %s", tag, *i));
+ append(path, ";", p.str());
+ builder.get_logger().log("tools", "Got %s system path: %s", tag, p);
}
setenv("INCLUDE", path);
}
-Task *MsvcCompiler::run(const Target &target) const
+Task *MsvcCompiler::_run(const ObjectFile &object)
{
- const ObjectFile &object = dynamic_cast<const ObjectFile &>(target);
+ const Tool &tool = *object.get_tool();
ExternalTask::Arguments argv;
- argv.push_back(executable->get_path().str());
+ argv.push_back(tool.get_executable()->get_path().str());
argv.push_back("/nologo");
argv.push_back("/c");
BuildInfo binfo;
- target.collect_build_info(binfo);
+ object.collect_build_info(binfo);
- if(binfo.standards.count(tag))
+ if(binfo.standards.count(tool.get_tag()))
{
- const BuildInfo::LanguageStandard &std = get_item(binfo.standards, tag);
- if((tag=="CXX" && std.year>2011) || (tag=="CC" && std.year>1999))
+ const BuildInfo::LanguageStandard &std = get_item(binfo.standards, tool.get_tag());
+ if((tool.get_tag()=="CXX" && std.year>2011) || (tool.get_tag()=="CC" && std.year>1999))
argv.push_back("/std:"+std.str());
}
else
argv.push_back("/w");
- for(BuildInfo::PathList::const_iterator i=binfo.local_incpath.begin(); i!=binfo.local_incpath.end(); ++i)
+ for(const FS::Path &p: binfo.local_incpath)
{
argv.push_back("/I");
- argv.push_back(i->str());
+ argv.push_back(p.str());
}
- for(BuildInfo::PathList::const_iterator i=binfo.incpath.begin(); i!=binfo.incpath.end(); ++i)
+ for(const FS::Path &p: binfo.incpath)
{
argv.push_back("/I");
- argv.push_back(i->str());
+ argv.push_back(p.str());
}
- for(BuildInfo::DefineMap::const_iterator i=binfo.defines.begin(); i!=binfo.defines.end(); ++i)
+ for(const auto &kvp: binfo.defines)
{
argv.push_back("/D");
- if(i->second.empty())
- argv.push_back(i->first);
+ if(kvp.second.empty())
+ argv.push_back(kvp.first);
else
- argv.push_back(format("%s=%s", i->first, i->second));
+ argv.push_back(format("%s=%s", kvp.first, kvp.second));
}
if(binfo.debug)