X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmingwdlltool.cpp;h=922fe51a10b724c5daa0608e55e5efb90e2392fc;hb=aa053d637e8259755af7d2e4b510a242f4d29c7b;hp=f44f5754a1ef4f8d45ec639ff045716a9f7b830a;hpb=9e28243c9687608ec3c32954b4031490296ae877;p=builder.git diff --git a/source/mingwdlltool.cpp b/source/mingwdlltool.cpp index f44f575..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" @@ -18,18 +17,20 @@ using namespace Msp; MingwDllTool::MingwDllTool(Builder &b, const Architecture &a): Tool(b, a, "DLL") -{ } +{ + set_command("dlltool", true); +} -Target *MingwDllTool::create_target(const list &sources, const string &) +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); @@ -56,14 +57,6 @@ Target *MingwDllTool::create_install(Target &target) const return 0; } -void MingwDllTool::do_prepare() -{ - string command = "dlltool"; - if(architecture->is_cross()) - command = format("%s-%s", architecture->get_cross_prefix(), command); - executable = builder.get_vfs().find_binary(command); -} - Task *MingwDllTool::run(const Target &target) const { const ImportLibrary *imp = dynamic_cast(&target); @@ -107,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");