]> git.tdb.fi Git - builder.git/blobdiff - source/msvclinker.cpp
Redesign how tools are run
[builder.git] / source / msvclinker.cpp
index 78cf0b25b0d9fd5b395528c641111d877a7bb8df..62e9d2af0a8def642427bbcdbe43f1299652b08b 100644 (file)
@@ -26,6 +26,7 @@ MsvcLinker::MsvcLinker(Builder &b, const Architecture &a, const MicrosoftTools &
        processing_unit = COMPONENT;
 
        set_command((ms_tools.get_vc_bin_dir()/"link.exe").str(), false);
+       set_run(_run);
 }
 
 Target *MsvcLinker::create_target(const vector<Target *> &sources, const string &arg)
@@ -84,12 +85,12 @@ void MsvcLinker::do_prepare()
        setenv("LIB", path);
 }
 
-Task *MsvcLinker::run(const Target &target) const
+Task *MsvcLinker::_run(const Binary &bin)
 {
-       const Binary &bin = dynamic_cast<const Binary &>(target);
+       const Tool &tool = *bin.get_tool();
 
        vector<string> argv;
-       argv.push_back(executable->get_path().str());
+       argv.push_back(tool.get_executable()->get_path().str());
        argv.push_back("/NOLOGO");
 
        FS::Path work_dir = bin.get_component()->get_package().get_source_directory();
@@ -98,7 +99,7 @@ Task *MsvcLinker::run(const Target &target) const
                argv.push_back("/DLL");
 
        BuildInfo binfo;
-       target.collect_build_info(binfo);
+       bin.collect_build_info(binfo);
 
        /*for(const FS::Path &p: binfo.libpath)
                argv.push_back("/LIBPATH:"+p.str());*/
@@ -109,7 +110,7 @@ Task *MsvcLinker::run(const Target &target) const
 
        argv.push_back("/OUT:"+relative(bin.get_path(), work_dir).str());
 
-       for(Target *d: target.get_dependencies())
+       for(Target *d: bin.get_dependencies())
        {
                FileTarget *file = dynamic_cast<FileTarget *>(d);
                Target *tgt = d->get_real_target();