]> git.tdb.fi Git - builder.git/blobdiff - source/msvclinker.cpp
Refactor logger to do message formatting internally
[builder.git] / source / msvclinker.cpp
index 49744288fcc1ffaefb4e57a4eec29430646fe741..78cf0b25b0d9fd5b395528c641111d877a7bb8df 100644 (file)
@@ -1,6 +1,5 @@
 #include <msp/core/environ.h>
 #include <msp/fs/utils.h>
-#include <msp/strings/format.h>
 #include <msp/strings/utils.h>
 #include "builder.h"
 #include "component.h"
@@ -29,19 +28,15 @@ MsvcLinker::MsvcLinker(Builder &b, const Architecture &a, const MicrosoftTools &
        set_command((ms_tools.get_vc_bin_dir()/"link.exe").str(), false);
 }
 
-Target *MsvcLinker::create_target(const list<Target *> &sources, const string &arg)
+Target *MsvcLinker::create_target(const vector<Target *> &sources, const string &arg)
 {
        if(sources.empty())
                throw invalid_argument("MsvcLinker::create_target");
 
-       list<ObjectFile *> objs;
+       vector<ObjectFile *> objs;
+       objs.reserve(sources.size());
        for(Target *s: sources)
-       {
-               if(ObjectFile *obj = dynamic_cast<ObjectFile *>(s))
-                       objs.push_back(obj);
-               else
-                       throw invalid_argument("MsvcLinker::create_target");
-       }
+               objs.push_back(&dynamic_cast<ObjectFile &>(*s));
 
        const Component &comp = *objs.front()->get_component();
        Binary *bin = 0;
@@ -55,7 +50,7 @@ Target *MsvcLinker::create_target(const list<Target *> &sources, const string &a
 
 string MsvcLinker::create_build_signature(const BuildInfo &binfo) const
 {
-       string result = FS::basename(executable->get_path());
+       string result = Tool::create_build_signature(binfo);
        result += ',';
        if(binfo.strip)
                result += 's';
@@ -83,7 +78,7 @@ 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);