1 #include <msp/io/print.h>
2 #include <msp/strings/utils.h>
3 #include "binarypackage.h"
9 BinaryPackage::BinaryPackage(Builder &b, const string &n):
12 use_pkgconfig = false;
15 void BinaryPackage::create_build_info()
17 for(BuildInfo::PathList::iterator i=export_binfo.incpath.begin(); i!=export_binfo.incpath.end(); ++i)
19 *i = builder.get_prefix()/i->subpath(1);
21 for(BuildInfo::PathList::iterator i=export_binfo.libpath.begin(); i!=export_binfo.libpath.end(); ++i)
23 *i = builder.get_prefix()/i->subpath(1);
26 BinaryPackage *BinaryPackage::from_flags(Builder &builder, const string &name, const vector<string> &flags)
28 BinaryPackage *pkg = new BinaryPackage(builder, name);
29 pkg->use_pkgconfig = true;
30 BuildInfo &binfo = pkg->export_binfo;
32 for(vector<string>::const_iterator i=flags.begin(); i!=flags.end(); ++i)
34 if(!i->compare(0, 2, "-I"))
35 binfo.incpath.push_back(i->substr(2));
36 else if(!i->compare(0, 2, "-D"))
38 string::size_type equals = i->find('=');
39 if(equals!=string::npos)
40 binfo.defines[i->substr(2, equals-2)] = i->substr(equals+1);
42 binfo.defines[i->substr(2)] = string();
44 else if(!i->compare(0, 2, "-L"))
45 binfo.libpath.push_back(i->substr(2));
46 else if(!i->compare(0, 2, "-l"))
47 binfo.libs.push_back(i->substr(2));
48 else if(*i=="-pthread")
56 BinaryPackage::Loader::Loader(BinaryPackage &p):
57 DataFile::DerivedObjectLoader<BinaryPackage, Package>(p)
59 add("build_info", &Loader::build_info);
62 void BinaryPackage::Loader::build_info()
64 load_sub(obj.export_binfo);