const PathList &sources=j->get_sources();
for(PathList::const_iterator k=sources.begin(); k!=sources.end(); ++k)
{
- list<string> sfiles=list_files(*k);
- for(list<string>::iterator l=sfiles.begin(); l!=sfiles.end(); ++l)
- files.push_back(*k / *l);
+ struct stat st;
+ stat(*k, st);
+ if(S_ISDIR(st.st_mode))
+ {
+ list<string> sfiles=list_files(*k);
+ for(list<string>::iterator l=sfiles.begin(); l!=sfiles.end(); ++l)
+ files.push_back(*k / *l);
+ }
+ else
+ files.push_back(*k);
}
bool build_exe=j->get_type()!=Component::HEADERS;
vector<Action *> actions;
- //ProgressBar *progress=0;
if(chrome)
- {
- //progress=new ProgressBar(cout, total);
cout<<"0 targets built\n";
- }
unsigned count=0;
bool fail=false;
Target *tgt=cmdline->get_buildable_target();
if(tgt)
{
- /*if(chrome)
- {
- cout<<"\e["<<actions.size()+1<<'A';
- //progress->set(count);
- cout<<"\e["<<actions.size()+1<<'B';
- }*/
Action *action=tgt->build();
if(action)
actions.push_back(action);
}
}
- //delete progress;
-
return fail?-1:0;
}
l2.push_back(*i);
swap(l, l2);
}
+
+BuildInfo::Loader::Loader(BuildInfo &bi):
+ binfo(bi)
+{
+ add("cflag", &Loader::cflag);
+ add("incpath", &Loader::incpath);
+ add("define", &Loader::define);
+ add("ldflag", &Loader::ldflag);
+ add("libpath", &Loader::libpath);
+ add("library", &Loader::library);
+}
+
+
#include <list>
#include <string>
+#include <msp/parser/loader.h>
class BuildInfo
{
public:
+ class Loader: public Msp::Parser::Loader
+ {
+ public:
+ Loader(BuildInfo &);
+ private:
+ BuildInfo &binfo;
+
+ void cflag(const std::string &s) { binfo.cflags.push_back(s); }
+ void incpath(const std::string &s) { binfo.incpath.push_back(s); }
+ void define(const std::string &s) { binfo.defines.push_back(s); }
+ void ldflag(const std::string &s) { binfo.ldflags.push_back(s); }
+ void libpath(const std::string &s) { binfo.libpath.push_back(s); }
+ void library(const std::string &s) { binfo.libs.push_back(s); }
+ };
+
typedef std::list<std::string> InfoList;
InfoList cflags;
add("source", &Loader::source);
add("install", &Component::install);
add("install_headers", &Component::install_headers);
- add("cflag", &Loader::cflag);
+ add("build_info", &Loader::build_info);
}
void Component::Loader::source(const string &s)
comp.sources.push_back(comp.pkg.get_source()/s);
}
-void Component::Loader::cflag(const string &f)
+void Component::Loader::build_info()
{
- comp.build_info.cflags.push_back(f);
+ load_sub(comp.build_info);
}
Component ∁
void source(const std::string &);
- void cflag(const std::string &);
+ void build_info();
};
enum Type
add("program", &Loader::program);
add("library", &Loader::library);
add("headers", &Loader::headers);
+ add("build_info", &Loader::build_info);
}
Package::Loader::~Loader()
load_sub(prog);
pkg.components.push_back(prog);
}
+
+void Package::Loader::build_info()
+{
+ load_sub(pkg.build_info);
+}
void program(const std::string &);
void library(const std::string &);
void headers(const std::string &);
+ void build_info();
};
Package(Builder &, const std::string &, const Msp::Path::Path &);