arch_in_build_sig = true;
}
+void Binary::collect_build_info(BuildInfo &binfo) const
+{
+ for(list<ObjectFile *>::const_iterator i=objects.begin(); i!=objects.end(); ++i)
+ if(const Tool *obj_tool = (*i)->get_tool())
+ binfo.update_from(obj_tool->get_build_info());
+
+ Target::collect_build_info(binfo);
+}
+
void Binary::find_dependencies()
{
if(!component)
Binary(Builder &, const Msp::FS::Path &);
Binary(Builder &, const Component &, const std::string &, const std::list<ObjectFile *> &);
+public:
+ virtual void collect_build_info(BuildInfo &) const;
+
+protected:
virtual void find_dependencies();
};
argv.push_back(relative(bin.get_path(), work_dir).str());
bool static_link_ok = (binfo.libmode<=BuildInfo::STATIC);
- bool need_l_objc = false;
const Target::Dependencies &depends = target.get_dependencies();
for(Target::Dependencies::const_iterator i=depends.begin(); i!=depends.end(); ++i)
Target *tgt = (*i)->get_real_target();
if(ObjectFile *obj = dynamic_cast<ObjectFile *>(tgt))
- {
argv.push_back(relative(obj->get_path(), work_dir).str());
- /* XXX This is a hack. A more generic way is needed for tools to pass
- information down the chain. */
- if(obj->get_tool()->get_tag()=="OBJC")
- need_l_objc = true;
- }
else if(StaticLibrary *stlib = dynamic_cast<StaticLibrary *>(tgt))
argv.push_back((file?file:stlib)->get_path().str());
else if(SharedLibrary *shlib = dynamic_cast<SharedLibrary *>(tgt))
argv.push_back(i->substr(0, i->size()-10));
}
- if(need_l_objc)
- argv.push_back("-lobjc");
if(static_link_ok)
argv.push_back("-static");
else if(architecture->get_system()=="windows")
{
set_command("gcc", true);
input_suffixes.push_back(".m");
+ build_info.libs.push_back("objc");
}
Target *GnuObjCCompiler::create_source(const Component &comp, const FS::Path &path) const
void Target::collect_build_info(BuildInfo &binfo) const
{
+ if(tool)
+ binfo.update_from(tool->get_build_info());
if(component)
binfo.update_from(component->get_build_info());
else if(package)
#include <list>
#include <string>
#include <msp/fs/path.h>
+#include "buildinfo.h"
class Architecture;
class Builder;
SuffixList input_suffixes;
SuffixList aux_suffixes;
SearchPath system_path;
+ BuildInfo build_info;
bool prepared;
std::list<std::string> problems;
/// Returns the systemwide search path for source files.
const SearchPath &get_system_path() const { return system_path; }
+ /** Returns tool-specific build info. This can be used by other tools down
+ the chain. */
+ const BuildInfo &get_build_info() const { return build_info; }
+
/// Creates a source file appropriate for this tool.
virtual Target *create_source(const Component &, const Msp::FS::Path &) const { return 0; }