X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fstaticlibrary.cpp;h=853d1b45c4916557321703b9a58d9862644b309f;hb=9f885c3eec8f065b7dc400acfb9dd67158284fcf;hp=f69f98f85fd141e7e0a386d7be01c6c3bf44780e;hpb=338eefb513953ae55e8e3614c009c242ba8ad74e;p=builder.git diff --git a/source/staticlibrary.cpp b/source/staticlibrary.cpp index f69f98f..853d1b4 100644 --- a/source/staticlibrary.cpp +++ b/source/staticlibrary.cpp @@ -1,21 +1,46 @@ +#include "builder.h" #include "component.h" #include "objectfile.h" #include "sourcepackage.h" #include "staticlibrary.h" using namespace std; +using namespace Msp; + +StaticLibrary::StaticLibrary(Builder &b, const FS::Path &p): + FileTarget(b, p) +{ } StaticLibrary::StaticLibrary(Builder &b, const Component &c, const list &objs): - FileTarget(b, &c.get_package(), generate_target_path(c)), - Library(b, package, path, c.get_name()), - comp(c) + FileTarget(b, c.get_package(), c.get_package().get_output_directory()/generate_filename(c)) +{ + component = &c; + for(ObjectFile *o: objs) + add_dependency(*o); + + install_location = "lib"; + nested_build_sig = true; + arch_in_build_sig = true; +} + +string StaticLibrary::generate_filename(const Component &comp) +{ + const Architecture &arch = comp.get_package().get_builder().get_current_arch(); + return arch.create_filename(comp.get_name()); +} + +void StaticLibrary::add_required_library(const string &lib) +{ + build_info.libs.push_back(lib); +} + +void StaticLibrary::add_library_path(const FS::Path &pth) { - buildable = true; - for(list::const_iterator i=objs.begin(); i!=objs.end(); ++i) - add_depend(*i); + build_info.libpath.push_back(pth); } -Msp::FS::Path StaticLibrary::generate_target_path(const Component &c) +void StaticLibrary::collect_build_info(BuildInfo &binfo) const { - return c.get_package().get_out_dir()/("lib"+c.get_name()+".a"); + Target::collect_build_info(binfo); + binfo.update_from(build_info); }