]> git.tdb.fi Git - builder.git/blobdiff - source/msvccompiler.cpp
Redesign how tools are run
[builder.git] / source / msvccompiler.cpp
index dbbc64d41895baea735e41d2e7f8f5c19ec8dd59..099c1230b7e5e18518c429dd7bc3f865180ea9c8 100644 (file)
@@ -34,6 +34,7 @@ MsvcCompiler::MsvcCompiler(Builder &b, const Architecture &a, const string &t, c
                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
@@ -93,22 +94,22 @@ void MsvcCompiler::do_prepare()
        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());
        }