X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcomponent.cpp;h=26a0ab4b7246d5c24eccd6f26c494fa0fea54335;hb=refs%2Ftags%2F0.9;hp=e674b018aabf42c338585ef6072e76f70221f111;hpb=69ad3610053e140cb5108f53e4c46a0583e33559;p=builder.git diff --git a/source/component.cpp b/source/component.cpp index e674b01..26a0ab4 100644 --- a/source/component.cpp +++ b/source/component.cpp @@ -6,7 +6,9 @@ Distributed under the LGPL */ #include -#include +#include +#include +#include #include #include "builder.h" #include "component.h" @@ -46,6 +48,17 @@ void Component::create_build_info() for(StringList::iterator i=build_info.libpath.begin(); i!=build_info.libpath.end(); ++i) *i=(pkg.get_source() / *i).str(); + if(pkg.get_library_mode()!=DYNAMIC) + { + // XXX This may pull in some unnecessary libpaths too. More thought required. + PackageList reqs=pkg.collect_requires(); + for(PackageList::iterator i=reqs.begin(); i!=reqs.end(); ++i) + { + const BuildInfo &ebi=(*i)->get_exported_binfo(); + build_info.libpath.insert(build_info.libpath.end(), ebi.libpath.begin(), ebi.libpath.end()); + } + } + if(type==PROGRAM) { string strip=pkg.get_config().get_option("strip").value; @@ -85,8 +98,7 @@ void Component::create_targets() const list inst_tgts; for(PathList::const_iterator i=files.begin(); i!=files.end(); ++i) { - string basename=(*i)[-1]; - string ext=splitext(basename).ext; + string ext=FS::extpart(FS::basename(*i)); if((ext==".cpp" || ext==".c") && build_exe) { SourceFile *src=new SourceFile(builder, this, i->str()); @@ -151,8 +163,7 @@ PathList Component::collect_source_files() const PathList files; for(PathList::const_iterator i=sources.begin(); i!=sources.end(); ++i) { - struct stat st=stat(*i); - if(S_ISDIR(st.st_mode)) + if(FS::is_dir(*i)) { list sfiles=list_files(*i); for(list::iterator j=sfiles.begin(); j!=sfiles.end(); ++j)