buildable = true;
for(list<ObjectFile *>::const_iterator i=objs.begin(); i!=objs.end(); ++i)
add_depend(*i);
+
+ if(c.get_type()==Component::LIBRARY)
+ install_location = "lib";
+ else if(c.get_type()==Component::MODULE)
+ install_location = "lib/"+package->get_name();
+ else if(c.get_type()==Component::PROGRAM)
+ install_location = "bin";
}
void Binary::find_depends()
{
buildable = true;
add_depend(&source);
+
+ install_location = "share/"+package->get_name();
}
Msp::FS::Path DataFile::generate_target_path(const Component &comp)
#ifndef HEADER_H_
#define HEADER_H_
+#include "component.h"
#include "sourcefile.h"
/**
protected:
Header(Builder &b, const std::string &f): SourceFile(b, f) { }
public:
- Header(Builder &b, const Component &c, const std::string &f): SourceFile(b, c, f) { }
+ Header(Builder &b, const Component &c, const std::string &f): SourceFile(b, c, f) { install_location = "include/"+c.get_name(); }
virtual const char *get_type() const { return "Header"; }
};
string mid;
if(!loc.empty())
mid = loc;
- else if(const Header *hdr = dynamic_cast<const Header *>(&tgt))
- {
- if(hdr->get_component()->get_type()!=Component::HEADERS)
- throw logic_error("Header install from non-header component?");
- mid = "include/"+hdr->get_component()->get_name();
- }
- else if(dynamic_cast<const Executable *>(&tgt))
- mid = "bin";
- else if(const SharedLibrary *shlib = dynamic_cast<const SharedLibrary *>(&tgt))
- {
- const Component &comp = shlib->get_component();
- if(comp.get_type()==Component::LIBRARY)
- {
- mid = "lib";
- if(!shlib->get_soname().empty())
- tgtname = shlib->get_soname();
- }
- else if(comp.get_type()==Component::MODULE)
- mid = "lib/"+tgt.get_package()->get_name();
- }
- else if(dynamic_cast<const StaticLibrary *>(&tgt))
- mid = "lib";
- else if(dynamic_cast<const PkgConfig *>(&tgt))
- mid = "lib/pkgconfig";
- else if(dynamic_cast<const ::DataFile *>(&tgt))
- mid = "share/"+tgt.get_package()->get_name();
+ else
+ mid = tgt.get_install_location();
if(mid.empty())
throw invalid_argument("Don't know where to install "+tgtname);
{
buildable = true;
tool = &builder.get_toolchain().get_tool("PCG");
+
+ install_location = "lib/pkgconfig";
}
buildable = true;
for(list<ObjectFile *>::const_iterator i=objs.begin(); i!=objs.end(); ++i)
add_depend(*i);
+
+ install_location = "lib";
}
Msp::FS::Path StaticLibrary::generate_target_path(const Component &c)
bool building;
bool rebuild;
std::string rebuild_reason;
+ std::string install_location;
Dependencies depends;
bool deps_ready;
bool is_buildable() const { return buildable; }
bool get_rebuild() const { return rebuild; }
const std::string &get_rebuild_reason() const { return rebuild_reason; }
+ bool is_installable() const { return !install_location.empty(); }
+ const std::string &get_install_location() const { return install_location; }
void add_depend(Target *);
const Dependencies &get_depends() const { return depends; }
bool get_depends_ready() const { return deps_ready; }