]> git.tdb.fi Git - builder.git/blob - source/importlibrary.cpp
9d2ea8fae42da17f392d6913e0bdd1d8181c4121
[builder.git] / source / importlibrary.cpp
1 #include <msp/strings/format.h>
2 #include "architecture.h"
3 #include "builder.h"
4 #include "component.h"
5 #include "exportdefinitions.h"
6 #include "importlibrary.h"
7 #include "sharedlibrary.h"
8 #include "sourcepackage.h"
9
10 using namespace std;
11 using namespace Msp;
12
13 ImportLibrary::ImportLibrary(Builder &b, const FS::Path &p):
14         FileTarget(b, p)
15 { }
16
17 ImportLibrary::ImportLibrary(Builder &b, const Component &c, SharedLibrary &sl, ExportDefinitions &exp):
18         FileTarget(b, c.get_package(), c.get_package().get_output_directory()/generate_filename(c, sl)),
19         shared_lib(&sl)
20 {
21         component = &c;
22         add_dependency(exp);
23         shared_lib->set_import_library(this);
24
25         install_location = "lib";
26
27         const string &version = component->get_package().get_interface_version();
28         if(!version.empty())
29         {
30                 const Architecture &arch = builder.get_current_arch();
31                 install_filename = arch.create_filename<ImportLibrary>(format("%s-%s", sl.get_libname(), version));
32         }
33 }
34
35 string ImportLibrary::generate_filename(const Component &comp, const SharedLibrary &sl)
36 {
37         const Architecture &arch = comp.get_package().get_builder().get_current_arch();
38         return arch.create_filename<ImportLibrary>(sl.get_libname());
39 }