#include "externaltask.h"
#include "gnucompiler.h"
#include "gnulinker.h"
+#include "importlibrary.h"
#include "installedfile.h"
#include "objectfile.h"
#include "sharedlibrary.h"
argv.push_back("-l"+shlib->get_libname());
static_link_ok = false;
}
+ else if(ImportLibrary *imp = dynamic_cast<ImportLibrary *>(tgt))
+ {
+ argv.push_back(imp->get_path().str());
+ static_link_ok = false;
+ }
}
if(static_link_ok)
--- /dev/null
+#include <msp/strings/format.h>
+#include "importlibrary.h"
+
+using namespace Msp;
+
+ImportLibrary::ImportLibrary(Builder &b, const FS::Path &p):
+ FileTarget(b, p)
+{ }
--- /dev/null
+#ifndef IMPORTLIBRARY_H_
+#define IMPORTLIBRARY_H_
+
+#include "filetarget.h"
+
+/**
+A special case of static library which pulls in a shared library. Used on
+platforms with no true dynamic linking support.
+*/
+class ImportLibrary: public FileTarget
+{
+public:
+ ImportLibrary(Builder &, const Msp::FS::Path &);
+
+ virtual const char *get_type() const { return "ImportLibrary"; }
+};
+
+#endif
#include "builder.h"
#include "csourcefile.h"
#include "executable.h"
+#include "importlibrary.h"
#include "sharedlibrary.h"
#include "staticlibrary.h"
#include "tool.h"
builder.get_logger().log("vfs", format("Library %s (%s) found in %s", lib, *j, i->str()));
if(cur_names==&shared_names)
{
- // XXX Hack: create StaticLibrary targets for import libraries
+ /* XXX Hack: create ImportLibraries here; they should be handled
+ separately, but I need a more generic way of handling all these
+ filename patterns */
if(FS::extpart(*j)==".a")
- return new StaticLibrary(builder, filename);
+ return new ImportLibrary(builder, filename);
return new SharedLibrary(builder, filename);
}
else