X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fsharedlibrary.cpp;h=c25c6f213f3e7c791525aad240259384335c60ac;hb=HEAD;hp=4ef9bb6fdf09bfd76ab7820f6cbc4f58515e1d5b;hpb=aa053d637e8259755af7d2e4b510a242f4d29c7b;p=builder.git diff --git a/source/sharedlibrary.cpp b/source/sharedlibrary.cpp deleted file mode 100644 index 4ef9bb6..0000000 --- a/source/sharedlibrary.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include -#include -#include "binarycomponent.h" -#include "builder.h" -#include "objectfile.h" -#include "sharedlibrary.h" -#include "sourcepackage.h" - -using namespace std; -using namespace Msp; - -SharedLibrary::SharedLibrary(Builder &b, const Msp::FS::Path &p): - Binary(b, p), - import_lib(0) -{ - libname = FS::basepart(FS::basename(path)); - if(!libname.compare(0, 3, "lib")) - libname = libname.substr(3); -} - -SharedLibrary::SharedLibrary(Builder &b, const Component &c, const vector &objs): - 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(*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(format("%s-%s", libname, version)); - else if(arch.get_system()=="darwin") - soname = arch.create_filename(format("%s.%s", libname, version)); - else - soname = format("%s.%s", arch.create_filename(libname), version); - - install_filename = soname; - } - } - - for(ObjectFile *o: objects) - o->set_used_in_shared_library(true); -} - -string SharedLibrary::generate_filename(const Component &comp) -{ - const BinaryComponent &bcomp = dynamic_cast(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(comp.get_name()); - } -} - -void SharedLibrary::set_import_library(ImportLibrary *imp) -{ - import_lib = imp; -}