static_binfo.threads = true;
}
- list<Target *> libs_to_process;
+ list<Target *>::iterator insert_pos = j;
+ ++insert_pos;
for(BuildInfo::WordList::const_iterator i=binfo.libs.begin(); i!=binfo.libs.end(); ++i)
{
if(i->size()>10 && !i->compare(i->size()-10, 10, ".framework"))
BuildInfo::LibraryMode libmode = component->get_build_info().get_libmode_for(*i);
Target *lib = builder.get_vfs().find_library(*i, binfo.libpath, libmode);
if(lib)
- libs_to_process.push_back(lib);
+ {
+ Target *real = lib->get_real_target();
+ if(StaticLibrary *stlib = dynamic_cast<StaticLibrary *>(real))
+ queue.insert(insert_pos, stlib);
+ else
+ dep_libs.push_back(lib);
+ }
else if(missing_libs.insert(*i).second)
problems.push_back(format("Required library %s not found", *i));
}
-
- if(tgt!=this)
- {
- const Target::Dependencies &tdeps = tgt->get_transitive_dependencies();
- libs_to_process.insert(libs_to_process.end(), tdeps.begin(), tdeps.end());
- }
-
- list<Target *>::iterator insert_pos = j;
- ++insert_pos;
- for(list<Target *>::const_iterator i=libs_to_process.begin(); i!=libs_to_process.end(); ++i)
- {
- Target *real = (*i)->get_real_target();
- if(StaticLibrary *stlib = dynamic_cast<StaticLibrary *>(real))
- queue.insert(insert_pos, stlib);
- else
- dep_libs.push_back(*i);
- }
}
queue.pop_front();
#include "binarypackage.h"
#include "builder.h"
#include "filetarget.h"
+#include "staticlibrary.h"
using namespace std;
using namespace Msp;
if(!static_binfo.libs.empty())
{
- BuildInfo::PathList combined_libpath = static_binfo.libpath;
- combined_libpath.insert(combined_libpath.end(), export_binfo.libpath.begin(), export_binfo.libpath.end());
-
- Target::Dependencies static_dep_libs;
- for(BuildInfo::WordList::const_iterator i=static_binfo.libs.begin(); i!=static_binfo.libs.end(); ++i)
- if(Target *lib = builder.get_vfs().find_library(*i, combined_libpath, BuildInfo::STATIC, system))
- static_dep_libs.push_back(lib);
-
for(BuildInfo::WordList::const_iterator i=export_binfo.libs.begin(); i!=export_binfo.libs.end(); ++i)
if(Target *lib = builder.get_vfs().find_library(*i, export_binfo.libpath, BuildInfo::FORCE_STATIC, system))
- {
- for(Target::Dependencies::const_iterator j=static_dep_libs.begin(); j!=static_dep_libs.end(); ++j)
- lib->add_transitive_dependency(**j);
- }
+ if(StaticLibrary *stlib = dynamic_cast<StaticLibrary *>(lib))
+ {
+ for(BuildInfo::WordList::const_iterator j=static_binfo.libs.begin(); j!=static_binfo.libs.end(); ++j)
+ stlib->add_required_library(*j);
+ }
}
}
const Architecture &arch = comp.get_package().get_builder().get_current_arch();
return arch.get_static_library_patterns().front().apply(comp.get_name());
}
+
+void StaticLibrary::add_required_library(const string &lib)
+{
+ build_info.libs.push_back(lib);
+}
+
+void StaticLibrary::collect_build_info(BuildInfo &binfo) const
+{
+ Target::collect_build_info(binfo);
+ binfo.update_from(build_info);
+}
*/
class StaticLibrary: public FileTarget
{
+private:
+ /* TODO this really belongs in a Component, but some refactoring is required
+ to allow non-builder packages to have components. Rename BinaryPackage to
+ ExternalPackage, add BuildableComponent and ExternalComponent classes. */
+ BuildInfo build_info;
+
public:
StaticLibrary(Builder &, const Msp::FS::Path &);
StaticLibrary(Builder &, const Component &, const std::list<ObjectFile *> &);
public:
virtual const char *get_type() const { return "StaticLibrary"; }
+
+ void add_required_library(const std::string &);
+ virtual void collect_build_info(BuildInfo &) const;
};
#endif