]> git.tdb.fi Git - builder.git/blob - source/staticlibrary.cpp
9ee4a9a79771326c019206bc402645e32aa0b2b8
[builder.git] / source / staticlibrary.cpp
1 #include "builder.h"
2 #include "component.h"
3 #include "objectfile.h"
4 #include "sourcepackage.h"
5 #include "staticlibrary.h"
6
7 using namespace std;
8 using namespace Msp;
9
10 StaticLibrary::StaticLibrary(Builder &b, const FS::Path &p):
11         FileTarget(b, p)
12 { }
13
14 StaticLibrary::StaticLibrary(Builder &b, const Component &c, const list<ObjectFile *> &objs):
15         FileTarget(b, c.get_package(), c.get_package().get_output_directory()/generate_filename(c))
16 {
17         component = &c;
18         for(list<ObjectFile *>::const_iterator i=objs.begin(); i!=objs.end(); ++i)
19                 add_dependency(**i);
20
21         install_location = "lib";
22         nested_build_sig = true;
23         arch_in_build_sig = true;
24 }
25
26 string StaticLibrary::generate_filename(const Component &comp)
27 {
28         const Architecture &arch = comp.get_package().get_builder().get_current_arch();
29         return arch.get_static_library_patterns().front().apply(comp.get_name());
30 }