26 #ifndef _BASIS_UTILITIES_H 27 #define _BASIS_UTILITIES_H 53 namespace basis {
namespace util {
121 virtual std::string
targetuid(
const std::string& target)
const = 0;
130 virtual bool istarget(
const std::string& target)
const = 0;
139 virtual std::string
basename(
const std::string& target)
const = 0;
148 virtual std::string
dirname(
const std::string& target)
const = 0;
180 const char* project = NULL,
181 const char* copyright = NULL,
182 const char* license = NULL);
233 std::string
exepath(
const std::string& name = std::string(),
253 std::string
exename(
const std::string& name = std::string(),
267 std::string
exedir(
const std::string& name = std::string(),
299 std::string
tostring(
const std::vector<std::string>& args);
310 std::vector<std::string>
qsplit(
const std::string& args);
343 int execute(
const std::string& cmd,
346 std::ostream* out = NULL,
347 bool allow_fail =
false,
349 bool simulate =
false,
383 int execute(std::vector<std::string> args,
386 std::ostream* out = NULL,
387 bool allow_fail =
false,
389 bool simulate =
false,
399 #endif // _BASIS_UTILITIES_H Basic exceptions and related helper macros.
virtual bool istarget(const std::string &target) const =0
Determine whether a given build target is known.
std::string exedir(const std::string &name=std::string(), const IExecutableTargetInfo *targets=NULL)
Get directory of executable file.
virtual std::string basename(const std::string &target) const =0
Get name of executable file without directory path.
virtual std::string targetuid(const std::string &target) const =0
Get UID of build target.
virtual ~IExecutableTargetInfo()
Destructor.
std::vector< std::string > qsplit(const std::string &args)
Split quoted string.
void print_contact(const char *contact)
Print contact information.
int execute(const std::string &cmd, bool quiet=false, std::ostream *out=NULL, bool allow_fail=false, int verbose=0, bool simulate=false, const IExecutableTargetInfo *targets=NULL)
Execute command as subprocess.
System related macro definitions.
Exception type thrown by execute().
Defines macros used for assertions.
Provides information about executable build targets.
std::string exepath(const std::string &name=std::string(), const IExecutableTargetInfo *targets=NULL)
Get absolute path of executable file.
Operating system dependent functions.
SubprocessError(const std::string &msg)
std::string tostring(const std::vector< std::string > &args)
Convert array of arguments to quoted string.
MultiSwitchArg verbose("v", "verbose", "Increase verbosity of output messages.", false)
std::string exename(const std::string &name=std::string(), const IExecutableTargetInfo *targets=NULL)
Get name of executable file.
virtual std::string dirname(const std::string &target) const =0
Get absolute path to directory containing executable.
Manages command line definition and parsing of arguments.
void print_version(const char *name, const char *version, const char *project=NULL, const char *copyright=NULL, const char *license=NULL)
Print version information including copyright and license notices.
IExecutableTargetInfo()
Constructor.