X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmingwdlltool.cpp;h=922fe51a10b724c5daa0608e55e5efb90e2392fc;hb=aa053d637e8259755af7d2e4b510a242f4d29c7b;hp=5f62a02c954dadbcbc808b15b37d55938d90d812;hpb=a957405689fafa1afc233182a3756e36ea34281c;p=builder.git diff --git a/source/mingwdlltool.cpp b/source/mingwdlltool.cpp index 5f62a02..922fe51 100644 --- a/source/mingwdlltool.cpp +++ b/source/mingwdlltool.cpp @@ -1,7 +1,6 @@ #include #include #include -#include "architecture.h" #include "builder.h" #include "component.h" #include "exportdefinitions.h" @@ -19,22 +18,19 @@ using namespace Msp; MingwDllTool::MingwDllTool(Builder &b, const Architecture &a): Tool(b, a, "DLL") { - string command = "dlltool"; - if(architecture->is_cross()) - command = format("%s-%s", architecture->get_cross_prefix(), command); - executable = builder.get_vfs().find_binary(command); + set_command("dlltool", true); } -Target *MingwDllTool::create_target(const list &sources, const string &) const +Target *MingwDllTool::create_target(const vector &sources, const string &) { if(sources.size()!=1) throw invalid_argument("MingwDllTool::create_target"); SharedLibrary &shlib = dynamic_cast(*sources.front()); - list objs; - const Target::Dependencies &depends = shlib.get_dependencies(); - for(Target::Dependencies::const_iterator i=depends.begin(); i!=depends.end(); ++i) - if(ObjectFile *obj = dynamic_cast(*i)) + vector objs; + objs.reserve(shlib.get_dependencies().size()); + for(Target *d: shlib.get_dependencies()) + if(ObjectFile *obj = dynamic_cast(d)) objs.push_back(obj); ExportDefinitions *exp = new ExportDefinitions(builder, *shlib.get_component(), objs); @@ -50,7 +46,7 @@ Target *MingwDllTool::create_install(Target &target) const { if(ImportLibrary *imp = dynamic_cast(&target)) { - const Tool © = builder.get_toolchain().get_tool("CP"); + Tool © = builder.get_toolchain().get_tool("CP"); InstalledFile *inst_tgt = dynamic_cast(copy.create_target(target)); string link_name = format("lib%s.dll.a", imp->get_shared_library()->get_libname()); if(link_name!=FS::basename(inst_tgt->get_path())) @@ -104,12 +100,9 @@ Task *MingwDllTool::run(const Target &target) const } else { - const Target::Dependencies &depends = exp->get_dependencies(); - for(Target::Dependencies::const_iterator i=depends.begin(); i!=depends.end(); ++i) - { - if(ObjectFile *obj = dynamic_cast(*i)) + for(Target *d: exp->get_dependencies()) + if(ObjectFile *obj = dynamic_cast(d)) argv.push_back(relative(obj->get_path(), work_dir).str()); - } // XXX Should use dllexport, but that has some other problems to solve argv.push_back("--export-all-symbols");