Instead let SharedLibrary set a flag in ObjectFiles and use that.
}
if(binfo.threads && architecture->get_system()!="windows" && architecture->get_system()!="darwin")
argv.push_back("-pthread");
- if((comp.get_type()==Component::LIBRARY || comp.get_type()==Component::MODULE) && architecture->get_system()!="windows")
+ if(object.is_used_in_shared_library() && architecture->get_system()!="windows")
argv.push_back("-fPIC");
const Architecture &native_arch = builder.get_native_arch();
ObjectFile::ObjectFile(Builder &b, const Component &c, SourceFile &s):
FileTarget(b, c.get_package(), generate_target_path(c, s.get_path())),
- source(s)
+ source(s),
+ used_in_shlib(false)
{
component = &c;
add_dependency(source);
return temp_dir/(FS::basepart(fn)+".o");
}
+void ObjectFile::set_used_in_shared_library(bool u)
+{
+ used_in_shlib = u;
+}
+
void ObjectFile::collect_build_info(BuildInfo &binfo) const
{
Target::collect_build_info(binfo);
{
private:
SourceFile &source;
+ bool used_in_shlib;
public:
ObjectFile(Builder &, const Component &, SourceFile &);
virtual const char *get_type() const { return "ObjectFile"; }
SourceFile &get_source() const { return source; }
+ void set_used_in_shared_library(bool);
+ bool is_used_in_shared_library() const { return used_in_shlib; }
+
virtual void collect_build_info(BuildInfo &) const;
private:
#include <msp/strings/format.h>
#include "builder.h"
#include "component.h"
+#include "objectfile.h"
#include "sharedlibrary.h"
#include "sourcepackage.h"
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)