#include <msp/strings/format.h>
+#include "architecture.h"
+#include "builder.h"
+#include "component.h"
+#include "exportdefinitions.h"
#include "importlibrary.h"
+#include "sharedlibrary.h"
+#include "sourcepackage.h"
+using namespace std;
using namespace Msp;
ImportLibrary::ImportLibrary(Builder &b, const FS::Path &p):
- FileTarget(b, p)
+ FileTarget(b, p),
+ shared_lib(0)
{ }
+
+ImportLibrary::ImportLibrary(Builder &b, const Component &c, SharedLibrary &sl, ExportDefinitions &exp):
+ FileTarget(b, c.get_package(), c.get_package().get_output_directory()/generate_filename(c, sl)),
+ shared_lib(&sl)
+{
+ component = &c;
+ add_dependency(exp);
+ shared_lib->set_import_library(this);
+
+ install_location = "lib";
+
+ const string &version = component->get_package().get_interface_version();
+ if(!version.empty())
+ {
+ const Architecture &arch = builder.get_current_arch();
+ install_filename = arch.create_filename<ImportLibrary>(format("%s-%s", sl.get_libname(), version));
+ }
+}
+
+string ImportLibrary::generate_filename(const Component &comp, const SharedLibrary &sl)
+{
+ const Architecture &arch = comp.get_package().get_builder().get_current_arch();
+ return arch.create_filename<ImportLibrary>(sl.get_libname());
+}