]> git.tdb.fi Git - builder.git/blob - source/importlibrary.cpp
Use a separate category for import library filename patterns
[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         shared_lib(0)
16 { }
17
18 ImportLibrary::ImportLibrary(Builder &b, const Component &c, SharedLibrary &sl, ExportDefinitions &exp):
19         FileTarget(b, c.get_package(), c.get_package().get_output_directory()/generate_filename(c, sl)),
20         shared_lib(&sl)
21 {
22         component = &c;
23         add_dependency(exp);
24         shared_lib->set_import_library(this);
25
26         install_location = "lib";
27
28         const string &version = component->get_package().get_interface_version();
29         if(!version.empty())
30         {
31                 const Architecture &arch = builder.get_current_arch();
32                 install_filename = arch.create_filename<ImportLibrary>(format("%s-%s", sl.get_libname(), version));
33         }
34 }
35
36 string ImportLibrary::generate_filename(const Component &comp, const SharedLibrary &sl)
37 {
38         const Architecture &arch = comp.get_package().get_builder().get_current_arch();
39         return arch.create_filename<ImportLibrary>(sl.get_libname());
40 }