From: Mikko Rasa Date: Tue, 17 Jul 2012 13:05:35 +0000 (+0300) Subject: Refactor create_build_info functions and fix build info application order X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=53d84f0eeb41813ab1ea96f68a06db01ba841da4;p=builder.git Refactor create_build_info functions and fix build info application order --- diff --git a/source/component.cpp b/source/component.cpp index e9d9a70..5a735d0 100644 --- a/source/component.cpp +++ b/source/component.cpp @@ -38,6 +38,8 @@ void Component::prepare() void Component::create_build_info() { + BuildInfo final_build_info; + const PackageList &pkg_reqs = package.get_required_packages(); PackageList direct_reqs = requires; direct_reqs.insert(direct_reqs.end(), pkg_reqs.begin(), pkg_reqs.end()); @@ -48,7 +50,7 @@ void Component::create_build_info() BuildInfo::UpdateLevel level = BuildInfo::CHAINED; if(find(direct_reqs.begin(), direct_reqs.end(), *i)!=direct_reqs.end()) level = BuildInfo::DEPENDENCY; - build_info.update_from((*i)->get_exported_build_info(), level); + final_build_info.update_from((*i)->get_exported_build_info(), level); const PackageList &reqs = (*i)->get_required_packages(); for(PackageList::const_iterator j=reqs.begin(); j!=reqs.end(); ++j) @@ -56,13 +58,16 @@ void Component::create_build_info() all_reqs.push_back(*j); } - build_info.update_from(package.get_build_info()); + final_build_info.update_from(package.get_build_info()); for(BuildInfo::PathList::iterator i=build_info.incpath.begin(); i!=build_info.incpath.end(); ++i) *i = (package.get_source_directory() / *i).str(); for(BuildInfo::PathList::iterator i=build_info.libpath.begin(); i!=build_info.libpath.end(); ++i) *i = (package.get_source_directory() / *i).str(); + final_build_info.update_from(build_info); + build_info = final_build_info; + if(type==LIBRARY || type==MODULE) if(build_info.libmodeget_build_info()); + final_build_info.update_from(build_type->get_build_info()); + + final_build_info.update_from(build_info); + build_info = final_build_info; build_info.incpath.push_back((builder.get_prefix()/"include").str()); build_info.libpath.push_back((builder.get_prefix()/"lib").str()); - bool export_paths = false; - for(ComponentList::const_iterator i=components.begin(); (!export_paths && i!=components.end()); ++i) - export_paths = (i->get_type()==Component::LIBRARY); - - if(export_paths) - { - export_binfo.incpath.push_back((builder.get_prefix()/"include").str()); - export_binfo.libpath.push_back((builder.get_prefix()/"lib").str()); - } - for(FeatureList::iterator i=features.begin(); i!=features.end(); ++i) if(lexical_cast(config.get_option("with_"+i->name).value)) build_info.defines["WITH_"+toupper(i->name)] = "1"; + bool export_paths = false; for(list::iterator i=components.begin(); i!=components.end(); ++i) { i->prepare(); i->create_build_info(); + if(i->get_type()==Component::LIBRARY) + { export_binfo.libs.push_back(i->get_name()); + export_paths = true; + } + } + + if(export_paths) + { + export_binfo.incpath.push_back((builder.get_prefix()/"include").str()); + export_binfo.libpath.push_back((builder.get_prefix()/"lib").str()); } }