X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcomponent.cpp;h=3b1f872ae92292529b845ab09e9b7b112763fa4f;hb=b1c51196b34f644e821f351c2acdb48619aed2e3;hp=48675f7e5d7c0148cc2752f39f6946ff163a9f32;hpb=766dad2d4f7ca73dc182f22e306ba0def6fd8722;p=builder.git diff --git a/source/component.cpp b/source/component.cpp index 48675f7..3b1f872 100644 --- a/source/component.cpp +++ b/source/component.cpp @@ -7,7 +7,7 @@ #include "builder.h" #include "component.h" #include "csourcefile.h" -#include "datafile.h" +#include "datapack.h" #include "executable.h" #include "file.h" #include "objectfile.h" @@ -156,16 +156,26 @@ void Component::create_targets() const inst->add_dependency(*copy.create_target(*ft, name)); } } - else if(type==DATAFILE) + else if(type==DATAPACK) { const Tool &dcomp = toolchain.get_tool("DATA"); - File *source; - if(Target *tgt = builder.get_vfs().get_target(source_filenames.front())) - source = dynamic_cast(tgt); - else - source = new File(builder, package, source_filenames.front()); - Target *result = dcomp.create_target(*source); + list files; + for(SourceList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i) + { + string ext = FS::extpart(FS::basename(*i)); + if(ext==".mdt") + { + Target *src = dcomp.create_source(*this, *i); + files.push_back(dcomp.create_target(*src, "collection")); + } + else if(Target *tgt = builder.get_vfs().get_target(*i)) + files.push_back(tgt); + else + files.push_back(new File(builder, package, *i)); + } + + Target *result = dcomp.create_target(files, "pack"); build_graph.add_primary_target(*result); if(install)