#include "gnulinker.h"
#include "installedfile.h"
#include "package.h"
-#include "pkgconfigfile.h"
#include "pkgconfiggenerator.h"
#include "sharedlibrary.h"
#include "sourcepackage.h"
world->add_depend(tarballs);
for(PackageMap::const_iterator i=packages.begin(); i!=packages.end(); ++i)
- {
- if(!i->second || !i->second->is_configured())
- continue;
-
- SourcePackage *spkg = dynamic_cast<SourcePackage *>(i->second);
- if(!spkg)
- continue;
-
- const ComponentList &components = spkg->get_components();
- for(ComponentList::const_iterator j=components.begin(); j!=components.end(); ++j)
- j->create_targets();
-
- if(spkg->get_install_flags()&(SourcePackage::LIB|SourcePackage::INCLUDE))
- {
- PkgConfigFile *pc = new PkgConfigFile(*this, *spkg);
- install->add_depend(toolchain.get_tool("CP").create_target(*pc));
- }
- }
+ if(i->second && i->second->is_configured())
+ i->second->create_targets();
// Apply what-ifs
// XXX This does not currently work with targets found during dependency discovery
protected:
virtual void do_configure(const StringMap &, unsigned) { }
virtual void create_build_info() { }
+
+public:
+ virtual void create_targets() { }
};
#endif
#include "binarypackage.h"
#include "builder.h"
#include "misc.h"
+#include "pkgconfigfile.h"
+#include "tool.h"
#include "sourcepackage.h"
using namespace std;
}
}
+void SourcePackage::create_targets()
+{
+ bool pc_needed = false;
+ for(ComponentList::const_iterator i=components.begin(); i!=components.end(); ++i)
+ {
+ i->create_targets();
+ if(i->get_type()==Component::LIBRARY || i->get_type()==Component::HEADERS)
+ pc_needed = true;
+ }
+
+ if(pc_needed)
+ {
+ PkgConfigFile *pc = new PkgConfigFile(builder, *this);
+ builder.get_target("install")->add_depend(builder.get_toolchain().get_tool("CP").create_target(*pc));
+ }
+}
+
SourcePackage::Loader::Loader(Package &p):
Package::Loader(p)
/** Fills in build info based on configuration. All required packages must be
configured when this is called. */
virtual void create_build_info();
+
+ virtual void create_targets();
};
#endif