X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmsvclinker.cpp;h=62e9d2af0a8def642427bbcdbe43f1299652b08b;hb=1ed833343bc83b83c5f61cbfd74423bbba677a04;hp=8ff4d9cdd96dc98df028f60d80c579a2b7c40550;hpb=bc6d4c540e7132c829dd558ca9d8acfbde7d71e1;p=builder.git diff --git a/source/msvclinker.cpp b/source/msvclinker.cpp index 8ff4d9c..62e9d2a 100644 --- a/source/msvclinker.cpp +++ b/source/msvclinker.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include "builder.h" #include "component.h" @@ -27,21 +26,18 @@ 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 list &sources, const string &arg) +Target *MsvcLinker::create_target(const vector &sources, const string &arg) { if(sources.empty()) throw invalid_argument("MsvcLinker::create_target"); - list objs; + vector objs; + objs.reserve(sources.size()); for(Target *s: sources) - { - if(ObjectFile *obj = dynamic_cast(s)) - objs.push_back(obj); - else - throw invalid_argument("MsvcLinker::create_target"); - } + objs.push_back(&dynamic_cast(*s)); const Component &comp = *objs.front()->get_component(); Binary *bin = 0; @@ -83,18 +79,18 @@ void MsvcLinker::do_prepare() for(const FS::Path &p: system_path) { append(path, ";", p.str()); - builder.get_logger().log("tools", format("Got %s system path: %s", tag, p)); + builder.get_logger().log("tools", "Got %s system path: %s", tag, p); } setenv("LIB", path); } -Task *MsvcLinker::run(const Target &target) const +Task *MsvcLinker::_run(const Binary &bin) { - const Binary &bin = dynamic_cast(target); + const Tool &tool = *bin.get_tool(); vector 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(); @@ -103,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());*/ @@ -114,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(d); Target *tgt = d->get_real_target();