303 std::vector<std::string> pargs, ppargs;
306 for (
unsigned int i = 0; i < args->
size(); i++) {
307 auto elem = args->
at(i);
310 if (elem.key.at(0) ==
'a') {
311 pargs.push_back(elem.data);
313 }
else if (elem.key.at(0) ==
'p' && elem.key.at(1) ==
'a') {
314 ppargs.push_back(elem.data);
316 }
else if (elem.key == std::string(
"force")) {
319 }
else if (elem.key == std::string(
"out")) {
321 if (elem.data == std::string(
"verbose")) {
324 }
else if (elem.data == std::string(
"none")) {
328 }
catch (std::exception& e) {
332 if (args->
get_ptr(
"gen") != NULL) {
334 if (!generator->init()) {
335 generator->generate(mode, args, &pargs);
344 if (*(args->
get(
"toolchain_id")) == std::string(
"all")) {
348 std::string
id = *(args->
get(
"toolchain_id"));
351 if (target == NULL) {
356 target->
call(&pargs, force);
362 std::string
id = *(args->
get(
"toolchain_id"));
365 if (target == NULL) {
370 target->
call(&pargs, force);
372 target->
run(&ppargs);
377 std::string
id = *(args->
get(
"toolchain_id"));
380 if (target == NULL) {
385 target->
run(&ppargs);
390 std::string
id = *(args->
get(
"toolchain_id"));
393 if (target == NULL) {
398 target->
debug(&pargs, &ppargs);
403 std::string
id = *(args->
get(
"toolchain_id"));
406 if (target == NULL) {
421 std::string
id = *(args->
get(
"toolchain_id"));
424 if (target == NULL) {
438 if (args->
get(
"gen") != NULL) {
440 generator->generate(mode, args, &pargs);
552 "Dont use this function direclty, simply call toolchain \"cbuild_rebuild_build_script\"",
572 const std::string characters =
573 "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-";
574 std::uniform_int_distribution<> dis(0, characters.size() - 1);
579 std::ifstream urandom(
"/dev/urandom", std::ios::binary);
585 std::random_device::result_type seed;
586 urandom.read(
reinterpret_cast<char*
>(&seed),
sizeof(seed));
591 std::seed_seq seedSeq{seed};
600 std::random_device rd;
605 std::string randomString;
606 for (
unsigned int i = 0; i < length; ++i) {
607 randomString += characters[dis(gen)];
Main headers of CBuild core.
#define CBUILD_PROJECT_DEPS_DIR
For other included project, in cache dir.
#define CBUILD_VERSION_MAJOR
Different representation of CBuild version.
#define CBUILD_VERSION_STR
#define CBUILD_COPY_CACHE_DIR
tmp dir in cache dir
#define CBUILD_CACHE_DIR
Cache directory of CBuild.
#define CBUILD_PROJECT_DEPS_HEADERS
For other included project, in cache dir.
#define CBUILD_VERSION_MINOR
Simple map implementation with some stack operation added.
__SIZE_TYPE__ size()
Size of map.
const _D * get(_K key)
Get element by it's key.
lib::mapData< _K, _D > at(__SIZE_TYPE__ i)
Array operation, get element at index.
lib::mapData< _K, _D > * get_ptr(_K key)
Get reference to key and value of map.
Custom implementation of map datatype.
CBuild::Toolchain * GetToolchain(std::string name, bool force=false)
Get the registered toolchain.
void CallTask(std::string name, std::vector< std::string > args)
Run tasks.
CBuild::generator_base * GetGenerator(std::string id)
Get generator for specified id.
void ToolchainAll(bool force, std::string path, std::vector< std::string > *args)
Call and execute all toolchains.
bool exists(std::string path)
Check if file exists.
bool create(std::vector< std::string > paths, CBuild::fs::type what)
Create element.
@ DIR
Alias for DIRECTORY.
Filebuffer for CBuild ecosystem.
void void void print_verbose()
Enable verbose flag.
void print(std::string msg, color fg=CBuild::WHITE)
Print colored text to STDOUT.
std::string get_version_string()
Return version as string.
int * get_version_array()
Get full CBuild version as int array of two components, no oveflow or rewrite check !
int get_version_major()
Get major component of CBuild version.
@ REBUILD
Rebuild user executable.
@ ERROR
Some error occurred.
@ DEBUG
Build and run target in debug mode.
@ CLEAR
Clear build output and cache.
@ BUILD_RUN
Build and run target.
@ LOAD_DEPS
Load other project deps.
void printf(color fg, const char *fmt,...) __attribute__((format(printf
Some poor printf implementation.
int get_version_minor()
Get minor component of CBuild version.
std::string get_random_string(unsigned int length)
Generate random string with specified range, on Linux can use /dev/urandom.
void print_none()
Fully disable all print though CBuild::print.
void print_full(std::string msg, color fg=CBuild::WHITE)
Print colored text to STDOUT if verbose flag is set.
void loop(RType mode, lib::map< std::string, std::string > *args)
loop of CBuild
void rebuild(std::string scripts)
Rebuild userspace part of CBuild.
Custom print that support color codes.