- FileTarget(b, &c.get_package(), generate_target_path(c)),
- Binary(b, c, objs),
- Library(b, &c.get_package(), path, c.get_name())
-{ }
+ Binary(b, c, generate_filename(c), objs),
+ libname(c.get_name()),
+ import_lib(0)
+{
+ if(builder.get_current_arch().get_system()=="windows")
+ install_location = "bin";
+ else
+ install_location = "lib";
+
+ const BinaryComponent &bcomp = dynamic_cast<const BinaryComponent &>(*component);
+ if(bcomp.get_type()==BinaryComponent::MODULE)
+ install_location /= package->get_name();
+ else
+ {
+ const string &version = component->get_package().get_interface_version();
+ if(!version.empty())
+ {
+ const Architecture &arch = builder.get_current_arch();
+ if(arch.get_system()=="windows")
+ soname = arch.create_filename<SharedLibrary>(format("%s-%s", libname, version));
+ else if(arch.get_system()=="darwin")
+ soname = arch.create_filename<SharedLibrary>(format("%s.%s", libname, version));
+ else
+ soname = format("%s.%s", arch.create_filename<SharedLibrary>(libname), version);
+
+ install_filename = soname;
+ }
+ }
+
+ for(list<ObjectFile *>::const_iterator i=objects.begin(); i!=objects.end(); ++i)
+ (*i)->set_used_in_shared_library(true);
+}
+
+string SharedLibrary::generate_filename(const Component &comp)
+{
+ const BinaryComponent &bcomp = dynamic_cast<const BinaryComponent &>(comp);
+ if(bcomp.get_type()==BinaryComponent::MODULE)
+ return comp.get_name()+".dlm";
+ else
+ {
+ const Architecture &arch = comp.get_package().get_builder().get_current_arch();
+ return arch.create_filename<SharedLibrary>(comp.get_name());
+ }
+}
+
+void SharedLibrary::set_import_library(ImportLibrary *imp)
+{
+ import_lib = imp;
+}