CBuild
C++ build system with scripts written in c++
|
Filebuffer for CBuild ecosystem. More...
Namespaces | |
namespace | consts |
Constants. | |
namespace | fs |
namespace | Registry |
namespace | types |
namespace | vars |
Classes | |
class | CBuildDependency |
class | CBuildHash |
class | CBuildHashV2 |
class | CBuildRebuildScript |
class | ccj_out |
Generates compile_commands.json. More... | |
class | CLANG |
class | CLANGMT |
class | CLANGXX |
class | CLANGXXMT |
struct | cmd |
Command for compile_commands.json. More... | |
class | CmdList |
class | ConfigToolchain |
class | CrossCompiler |
class | Dependency |
class | filebuff |
Base class of filebuffer. More... | |
class | GCC |
class | GCCHash |
class | GCCMT |
class | generator_base |
Base for any generator. More... | |
class | GeneratorList |
class | GXX |
class | GXXMT |
class | Hash |
class | Help |
class | Init |
Init task. More... | |
class | line_filebuff |
class | makefile_out |
Generate Makefile from task/target, works as command logger. More... | |
class | MetaToolchain |
class | MINGW_GCC |
class | MINGW_GCCMT |
class | MINGW_GXX |
class | MINGW_GXXMT |
class | NetDependency |
struct | package_info |
Package info struct for data for pkg-config. More... | |
struct | Path |
Path datatype. More... | |
struct | Project_dependency |
Project dependency data. More... | |
class | SimpleToolchain |
Very simple generic toolchain, rely on compiler to support '-c' flat to specify files to compile and '-o' flag to specify output object file, linker need to support '-o' flag to specify output binary. This should work with all gcc and clang variants. More... | |
struct | source_metadata_file |
Metadata for source files (.cpp/.c/etc) Structure of file: More... | |
class | str_filebuff |
struct | target_metadata_file |
Metadata for a full toolchain Structure of file: More... | |
class | Task |
Task, can be runned from shell or code. More... | |
class | TaskList |
class | Toolchain |
Toolchain class. More... | |
class | ToolchainList |
struct | ToolState |
class | Version |
Version task. More... | |
Concepts | |
concept | HashImpl |
Hasher implementation. | |
concept | ToolchainImpl |
Toolchain implementation. | |
Typedefs | |
typedef enum CBuild::ARG_TYPE | ARG_TYPE |
using | handler = ARG_TYPE (*)(lib::map<std::string, std::string>*, char**, int, int, CBuild::RType*) |
Handler for specific argument. | |
typedef struct CBuild::package_info | package_info |
Package info struct for data for pkg-config. | |
Enumerations | |
enum | stage { PRE , POST } |
Type of depencesies for toolchain. More... | |
enum | build_type { EXECUTABLE , STATIC_LIBRARY , DYNAMIC_LIBRARY } |
enum | RType { TASK , BUILD , RUN , BUILD_RUN , DEBUG , CLEAR , REBUILD , LOAD_DEPS , ERROR } |
Run mode. More... | |
enum | ARG_TYPE { BLANK_ARG = 0 , SIMPLE_ARG = 1 , TASK_ARG = 2 , TOOLCHAIN_ARG = 2 , GENERICK_ARG = 2 , GENERATOR_ARG = 2 , INC_ONE = 1 , INC_TWO = 2 , INC_THREE = 3 , INC_FOUR = 4 , INC_FIVE = 5 , INC_SIX = 6 , INC_SEVEN = 7 , INC_EIGHT = 8 , INC_NINE = 9 , INC_TEN = 10 } |
Type of argument, indicate how many tokens this argument consumes, including self. More... | |
enum | buffer_state { MATCH , FILE_NEWER , BUFFER_NEWER } |
Represent atate of buffer. More... | |
enum | color { BLACK = 30 , RED = 31 , GREEN = 32 , YELLOW = 33 , BLUE = 34 , MAGENTA = 35 , CYAN = 36 , WHITE = 37 } |
Text color. More... | |
Functions | |
int | read_file_metadata (std::string target_id, std::string src_file, CBuild::source_metadata_file *metadata) |
Load metadata for source file. | |
int | read_file_metadata_direct (std::string target_id, std::string file, CBuild::source_metadata_file *metadata) |
Load metadata for source file. | |
int | read_target_metadata (std::string target_id, CBuild::target_metadata_file *metadata) |
Load metadata for a full target. | |
int | read_target_metadata_direct (std::string path, CBuild::target_metadata_file *metadata) |
Load metadata for a full target using path to metdata file. | |
int | read_file_hash (std::string target_id, std::string file, uint64_t *hash) |
Get a file hash (internally uses read_file_metadata, so no performance benefits, but easiier to use in hasher) | |
int | write_file_metadata (std::string target_id, std::string src_file, CBuild::source_metadata_file *metadata) |
Write a metadata for a file to a file. | |
int | write_target_metadata (std::string target_id, CBuild::target_metadata_file *metadata) |
Write a metadata for a full target. | |
int | write_file_hash (std::string target_id, std::string file, uint64_t *hash) |
std::string | get_file_metadata_path (std::string target_id, std::string file) |
Get the path to a file metadata file. | |
std::string | get_target_metadata_path (std::string target_id) |
Get the path to a target metadata file. | |
RType | parse (lib::map< std::string, std::string > *args, int argc, char **argv) |
Parse arguments. | |
void | loop (RType mode, lib::map< std::string, std::string > *args) |
loop of CBuild | |
void | rebuild (std::string scripts) |
Rebuild userspace part of CBuild. | |
std::string | get_version_string () |
Return version as string. | |
int | get_version_major () |
Get major component of CBuild version. | |
int | get_version_minor () |
Get minor component of CBuild version. | |
int * | get_version_array () |
Get full CBuild version as int array of two components, no oveflow or rewrite check ! | |
std::string | get_random_string (unsigned int length) |
Generate random string with specified range, on Linux can use /dev/urandom. | |
void | exit (int code) |
bool | register_parse_handler (std::string cmd, CBuild::handler parser) |
Register new handler for parsing cli args, see handler typedef comment to guide how to write handlers. | |
void | add_env_var (std::string var, std::string value) |
Add environment variable to CBuild::system and CBuild::system_piped calls. | |
std::string | remove_env_var (std::string var) |
Remove registered environment var. | |
void | change_env_var (std::string var, std::string new_value) |
Change value for environment var. | |
std::vector< std::string > | parse_lines (std::string in) |
Parse string to vector of strings. | |
std::vector< std::string > | get_files (std::vector< std::string > files, std::vector< std::string > objects, std::string toolchain_id) |
Get changed files. | |
void | print_files () |
Print temporary file array. | |
lib::map< std::string, std::string > | gcc_hash_impl (std::vector< std::string > file_list, std::vector< std::string > objects_list, std::string target_id) |
Implementation of GCC hasher. | |
uint64_t | hash_djb2 (std::string str) |
djb2 hashing function for std::string | |
uint64_t | hash_fnv_1a (std::string str) |
FNV-1a hashing function for std::string. | |
bool | get_pkg_info (CBuild::package_info *package) |
Get the package info from pkg-config database. | |
void | print (std::string msg, color fg=CBuild::WHITE) |
Print colored text to STDOUT. | |
void | print_full (std::string msg, color fg=CBuild::WHITE) |
Print colored text to STDOUT if verbose flag is set. | |
void | printf (color fg, const char *fmt,...) __attribute__((format(printf |
Some poor printf implementation. | |
void void | printf_full (color fg, const char *fmt,...) __attribute__((format(printf |
Some poor printf implementation for verbouse-only prints. | |
void void void | print_verbose () |
Enable verbose flag. | |
void | print_none () |
Fully disable all print though CBuild::print. | |
void | print_toggle () |
Toogle print betwen none and currently selected level. | |
int | system (std::string cmd) |
Call stdlib system() and print cmd to shell. | |
std::string | system_piped (std::string cmd, unsigned int buffsize) |
Execute command and return it's output. | |
std::vector< std::string > * | get_log () |
Get the internall command log. | |
void | disable_system () |
Disable system commands execution. | |
void | enable_system () |
Reanable system commands execution, used only in pkg-config. | |
bool | is_system_enabled () |
Check if CBuild::system enabled. | |
ARG_TYPE | force_handler (lib::map< std::string, std::string > *args, char **argv, int argc, int ptr, CBuild::RType *type) |
ARG_TYPE | out_handler (lib::map< std::string, std::string > *args, char **argv, int argc, int ptr, CBuild::RType *type) |
ARG_TYPE | generator_handler (lib::map< std::string, std::string > *args, char **argv, int argc, int ptr, CBuild::RType *type) |
ARG_TYPE | build_handler (lib::map< std::string, std::string > *args, char **argv, int argc, int ptr, CBuild::RType *type) |
ARG_TYPE | task_handler (lib::map< std::string, std::string > *args, char **argv, int argc, int ptr, CBuild::RType *type) |
ARG_TYPE | arg_handler (lib::map< std::string, std::string > *args, char **argv, int argc, int ptr, CBuild::RType *type) |
ARG_TYPE | rebuild_handler (lib::map< std::string, std::string > *args, char **argv, int argc, int ptr, CBuild::RType *type) |
std::string | eval_cmd (std::array< std::string, 4 > data) |
Evaluate compilation cmd. | |
std::string | preprocess_json_str (std::string_view str) |
Preprocess string for json. | |
CBuild::types::file_content | get_file_data (std::string path, std::string included_from="") |
Get content of file. | |
uint64_t | hash (std::string str) |
FNV-1a hashing function for std::string. | |
void | procces_files (std::vector< std::string > files, std::vector< std::string > objects, std::string toolchain_id) |
Procces file data. | |
void | store_hash (std::string toolchain_id) |
Store new hashes to file. | |
void | load_hash (std::string toolchain_id) |
Load old hashes. | |
void | print_internal (std::string msg, CBuild::color fg) |
void | printf_internal (CBuild::color fg, std::string msg, va_list va) |
std::string | get_env_vars () |
Variables | |
int | version [] = {CBUILD_VERSION_MAJOR, CBUILD_VERSION_MINOR} |
bool | real_exit = true |
int | arg = 0 |
int | parg = 0 |
lib::map< std::string, handler > | parsers_list |
All handlers. | |
bool | verbose = false |
bool | none = false |
bool | toogle = true |
std::vector< std::string > | log |
std::map< std::string, std::string > | env_vars |
bool | enabled = true |
Filebuffer for CBuild ecosystem.
Hasher v3.0 implementation.
Hasher v3.0 for CBuild.
@license GPL v3.0 or later
Copyright (C) 2022 WolodiaM This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
@license GPL v3.0 or later
Copyright (C) 2022 WolodiaM This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
@license GPL v3.0 or later
Copyright (C) 2022 WolodiaM This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
typedef enum CBuild::ARG_TYPE CBuild::ARG_TYPE |
using CBuild::handler = ARG_TYPE (*)(lib::map<std::string, std::string>*, char**, int, int, CBuild::RType*) |
Handler for specific argument.
Receives four arguments: lib::map<std::string, std::string> - arguments map char** - argv int - argc int - current parsing pointer, point to argument that call handler, default - 1 (self) CBuild::RType - type of run Returns int - consumed elements of argv
Possible internal args: out:none - disable cli out out:verbose - full cli out gen:<generator id> - pass used generator toolchain_id:<toolchain id> - pass used toolchain task_id:<task id> - pass used task id paX:<arg>, where X - unique number - pass arg to runned program (for -r and -br and possibly -d) aX:<arg>, where X - inique number - pass arg to runned toolchain/task
Definition at line 125 of file cli_parse_handler.hpp.
typedef struct CBuild::package_info CBuild::package_info |
Package info struct for data for pkg-config.
enum CBuild::ARG_TYPE |
Type of argument, indicate how many tokens this argument consumes, including self.
Enumerator | |
---|---|
BLANK_ARG | No argument. |
SIMPLE_ARG | Only argument and no subarguments (like -f, -v) |
TASK_ARG | Task argument (-t <task_id>) |
TOOLCHAIN_ARG | Toolchain argument (-b/-r/-br/-c/-d <toolchain_id>) |
GENERICK_ARG | Generick argument with subargument (-<arg> <subarg> |
GENERATOR_ARG | Generator arg (-g <generator_id>) |
INC_ONE | Increment by one, consumes only self. |
INC_TWO | Increment by two, consumes self and 1 subarg. |
INC_THREE | Increment by two, consumes self and 2 subarg. |
INC_FOUR | Increment by two, consumes self and 3 subarg. |
INC_FIVE | Increment by two, consumes self and 4 subarg. |
INC_SIX | Increment by two, consumes self and 5 subarg. |
INC_SEVEN | Increment by two, consumes self and 6 subarg. |
INC_EIGHT | Increment by two, consumes self and 7 subarg. |
INC_NINE | Increment by two, consumes self and 8 subarg. |
INC_TEN | Increment by two, consumes self and 9 subarg. |
Definition at line 37 of file cli_parse_handler.hpp.
enum CBuild::buffer_state |
Represent atate of buffer.
Enumerator | |
---|---|
MATCH | File match buffer. |
FILE_NEWER | File is newer, buffer is not updated. |
BUFFER_NEWER | Buffer is newer and file need update. |
Definition at line 57 of file filebuff.hpp.
enum CBuild::build_type |
enum CBuild::color |
enum CBuild::RType |
Run mode.
Definition at line 34 of file CBuild.hpp.
enum CBuild::stage |
void CBuild::add_env_var | ( | std::string | var, |
std::string | value ) |
Add environment variable to CBuild::system and CBuild::system_piped calls.
var | => std::string -> Var name |
value | => std::string -> Var value |
Definition at line 87 of file system.cpp.
References env_vars.
ARG_TYPE CBuild::arg_handler | ( | lib::map< std::string, std::string > * | args, |
char ** | argv, | ||
int | argc, | ||
int | ptr, | ||
CBuild::RType * | type ) |
Definition at line 223 of file cli_parser.cpp.
References arg, exit(), GREEN, parg, print(), lib::map< _K, _D >::push_back_check(), and RED.
ARG_TYPE CBuild::build_handler | ( | lib::map< std::string, std::string > * | args, |
char ** | argv, | ||
int | argc, | ||
int | ptr, | ||
CBuild::RType * | type ) |
Definition at line 114 of file cli_parser.cpp.
References BUILD, BUILD_RUN, CLEAR, DEBUG, exit(), lib::map< _K, _D >::get_ptr(), CBuild::Registry::GetToolchainsList(), GREEN, LOAD_DEPS, print(), print_full(), lib::map< _K, _D >::push_back_check(), RED, and RUN.
void CBuild::change_env_var | ( | std::string | var, |
std::string | new_value ) |
Change value for environment var.
var | => std::string -> Var name |
new_value | => std::string -> New var value |
Definition at line 95 of file system.cpp.
References env_vars.
void CBuild::disable_system | ( | ) |
Disable system commands execution.
Definition at line 77 of file system.cpp.
References enabled.
Referenced by get_pkg_info(), and CBuild::ccj_out::init().
void CBuild::enable_system | ( | ) |
Reanable system commands execution, used only in pkg-config.
Definition at line 80 of file system.cpp.
References enabled.
Referenced by get_pkg_info().
std::string CBuild::eval_cmd | ( | std::array< std::string, 4 > | data | ) |
Evaluate compilation cmd.
data | => std::array<std::string, 4> -> Data:
|
Definition at line 113 of file generator.cpp.
Referenced by CBuild::ccj_out::generate().
void CBuild::exit | ( | int | code | ) |
Definition at line 34 of file cli_parser.cpp.
References real_exit.
Referenced by arg_handler(), CBuild::ConfigToolchain::build(), build_handler(), CBuild::ConfigToolchain::call(), CBuild::ConfigToolchain::clear(), CBuild::ConfigToolchain::compile(), CBuild::CBuildDependency::compile(), CBuild::Toolchain::crash(), CBuild::ConfigToolchain::debug(), generator_handler(), CBuild::ConfigToolchain::get_cmds(), get_file_data(), CBuild::ConfigToolchain::init(), CBuild::ConfigToolchain::link(), CBuild::ConfigToolchain::link_pack(), CBuild::ConfigToolchain::load_project_deps(), loop(), out_handler(), parse(), CBuild::ConfigToolchain::post_build(), CBuild::ConfigToolchain::post_link(), CBuild::ConfigToolchain::pre_build(), CBuild::ConfigToolchain::pre_link(), CBuild::ConfigToolchain::run(), CBuild::ConfigToolchain::set_id(), CBuild::ConfigToolchain::set_name(), CBuild::ConfigToolchain::stdargs(), and task_handler().
ARG_TYPE CBuild::force_handler | ( | lib::map< std::string, std::string > * | args, |
char ** | argv, | ||
int | argc, | ||
int | ptr, | ||
CBuild::RType * | type ) |
Definition at line 39 of file cli_parser.cpp.
References print_full(), lib::map< _K, _D >::push_back_check(), and RED.
lib::map< std::string, std::string > CBuild::gcc_hash_impl | ( | std::vector< std::string > | file_list, |
std::vector< std::string > | objects_list, | ||
std::string | target_id ) |
Implementation of GCC hasher.
file_list | => std::vector<std::string> -> List of source files |
objects_list | => std::vector<std::string> -> List of coresponding object files |
target_id | => std::string -> ID of target that called hasher |
Definition at line 76 of file gcc_hash.cpp.
References lib::map< _K, _D >::at(), check_mismatch_recursive(), CBuild::Registry::GetToolchain(), hash_fnv_1a(), CBuild::fs::normalize_relative_path(), print_full(), print_toggle(), lib::map< _K, _D >::ptr_at(), lib::map< _K, _D >::push_back(), lib::map< _K, _D >::push_back_check(), read_file_metadata(), lib::map< _K, _D >::size(), system_piped(), and write_file_metadata().
Referenced by CBuild::GCCHash::get_files_for_recompilation().
ARG_TYPE CBuild::generator_handler | ( | lib::map< std::string, std::string > * | args, |
char ** | argv, | ||
int | argc, | ||
int | ptr, | ||
CBuild::RType * | type ) |
Definition at line 76 of file cli_parser.cpp.
References exit(), lib::map< _K, _D >::get_ptr(), CBuild::Registry::GetGeneratorsList(), GREEN, print(), print_full(), lib::map< _K, _D >::push_back_check(), and RED.
std::string CBuild::get_env_vars | ( | ) |
Definition at line 35 of file system.cpp.
References env_vars.
Referenced by system(), and system_piped().
CBuild::types::file_content CBuild::get_file_data | ( | std::string | path, |
std::string | included_from = "" ) |
Get content of file.
path | => std::string -> Path to file |
included_from | => std::string -> From what file included, for calculating path |
Definition at line 148 of file hash.cpp.
References CBuild::fs::base(), CBuild::consts::c_multiline_comment(), CBuild::types::file_content::content, CBuild::consts::cxx_line_comment(), CBuild::consts::doxygen_comment(), CBuild::fs::exists(), exit(), CBuild::consts::include_parser(), CBuild::types::file_content::includes, CBuild::fs::normalize_relative_path(), CBuild::types::file_content::path, print_full(), and RED.
Referenced by procces_files().
std::string CBuild::get_file_metadata_path | ( | std::string | target_id, |
std::string | file ) |
Get the path to a file metadata file.
target_id | => std::string -> Id of target that has this file |
file | => std::string -> File name |
Definition at line 170 of file metadata_file.cpp.
References CBUILD_BUILD_DIR, CBUILD_METADATA_FILE_EXTENSION, and CBUILD_METADATA_FOLDER.
Referenced by read_file_metadata(), store_hash(), and write_file_metadata().
std::vector< std::string > CBuild::get_files | ( | std::vector< std::string > | files, |
std::vector< std::string > | objects, | ||
std::string | toolchain_id ) |
Get changed files.
files | => std::vector<std::string> -> List of code files (.cpp/.c) |
objects | => std::vector<std::string> -> List of object files (.o/.obj) |
toolchain_id | => std::string -> Id of toolchain, to get hash file |
Definition at line 395 of file hash.cpp.
References CBuild::vars::filelist, CBuild::vars::headers, load_hash(), CBuild::vars::old_hashes, print_files(), procces_files(), and store_hash().
Referenced by CBuild::CBuildHash::get_files_for_recompilation().
std::vector< std::string > * CBuild::get_log | ( | ) |
Get the internall command log.
Definition at line 74 of file system.cpp.
References log.
Referenced by CBuild::makefile_out::generate().
bool CBuild::get_pkg_info | ( | CBuild::package_info * | package | ) |
Get the package info from pkg-config database.
package | => package_info* -> Input and output from function |
Definition at line 28 of file pkgconfig.cpp.
References CBuild::package_info::cargs, disable_system(), enable_system(), is_system_enabled(), CBuild::package_info::largs, MAGENTA, CBuild::package_info::name, print(), RED, and system_piped().
Referenced by CBuild::Toolchain::stdargs().
std::string CBuild::get_random_string | ( | unsigned int | length | ) |
Generate random string with specified range, on Linux can use /dev/urandom.
length | => usigned int -> String lenght |
Definition at line 570 of file CBuild.cpp.
References MAGENTA, and print_full().
Referenced by CBuild::makefile_out::generate().
std::string CBuild::get_target_metadata_path | ( | std::string | target_id | ) |
Get the path to a target metadata file.
target_id | => std::string -> Id of a target |
Definition at line 179 of file metadata_file.cpp.
References CBUILD_BUILD_DIR, and CBUILD_METADATA_FILE_EXTENSION.
Referenced by read_target_metadata(), and write_target_metadata().
int * CBuild::get_version_array | ( | ) |
Get full CBuild version as int array of two components, no oveflow or rewrite check !
Definition at line 567 of file CBuild.cpp.
References version.
int CBuild::get_version_major | ( | ) |
Get major component of CBuild version.
Definition at line 561 of file CBuild.cpp.
References CBUILD_VERSION_MAJOR.
int CBuild::get_version_minor | ( | ) |
Get minor component of CBuild version.
Definition at line 564 of file CBuild.cpp.
References CBUILD_VERSION_MINOR.
std::string CBuild::get_version_string | ( | ) |
Return version as string.
Definition at line 558 of file CBuild.cpp.
References CBUILD_VERSION_STR.
uint64_t CBuild::hash | ( | std::string | str | ) |
FNV-1a hashing function for std::string.
str | => std::string -> Input string |
Definition at line 218 of file hash.cpp.
References hash().
Referenced by CBuild::CLANG< hash >::CLANG(), CBuild::CLANG< hash >::CLANG(), CBuild::CLANGMT< hash >::CLANGMT(), CBuild::CLANGMT< hash >::CLANGMT(), CBuild::CLANGXX< hash >::CLANGXX(), CBuild::CLANGXX< hash >::CLANGXX(), CBuild::CLANGXXMT< hash >::CLANGXXMT(), CBuild::CLANGXXMT< hash >::CLANGXXMT(), CBuild::GCC< hash >::GCC(), CBuild::GCC< hash >::GCC(), CBuild::GCCMT< hash >::GCCMT(), CBuild::GCCMT< hash >::GCCMT(), CBuild::GXX< hash >::GXX(), CBuild::GXX< hash >::GXX(), CBuild::GXXMT< hash >::GXXMT(), CBuild::GXXMT< hash >::GXXMT(), hash(), hash_djb2(), hash_fnv_1a(), load_hash(), CBuild::MINGW_GCC< hash >::MINGW_GCC(), CBuild::MINGW_GCC< hash >::MINGW_GCC(), CBuild::MINGW_GCCMT< hash >::MINGW_GCCMT(), CBuild::MINGW_GCCMT< hash >::MINGW_GCCMT(), CBuild::MINGW_GXX< hash >::MINGW_GXX(), CBuild::MINGW_GXX< hash >::MINGW_GXX(), CBuild::MINGW_GXXMT< hash >::MINGW_GXXMT(), CBuild::MINGW_GXXMT< hash >::MINGW_GXXMT(), procces_files(), read_file_hash(), CBuild::SimpleToolchain< hash >::SimpleToolchain(), and write_file_hash().
|
inline |
djb2 hashing function for std::string
str | => std::string -> Input string |
Definition at line 41 of file hasher.hpp.
References hash().
|
inline |
FNV-1a hashing function for std::string.
str | => std::string -> Input string |
Definition at line 54 of file hasher.hpp.
References hash().
Referenced by gcc_hash_impl(), and parse_file().
bool CBuild::is_system_enabled | ( | ) |
Check if CBuild::system enabled.
Definition at line 83 of file system.cpp.
References enabled.
Referenced by get_pkg_info().
void CBuild::load_hash | ( | std::string | toolchain_id | ) |
Load old hashes.
toolchain_id | => std::string -> Id of toolchain |
Definition at line 329 of file hash.cpp.
References CBUILD_BUILD_DIR, CBUILD_METADATA_FOLDER, CBuild::fs::dir(), hash(), CBuild::source_metadata_file::hash, CBuild::vars::old_hashes, print_full(), read_file_metadata_direct(), RED, and CBuild::source_metadata_file::source.
Referenced by get_files().
void CBuild::loop | ( | CBuild::RType | mode, |
lib::map< std::string, std::string > * | args ) |
loop of CBuild
mode | => CBuild::RType -> from CBuild::parse function |
args | => lib::map<std::string, std::string>* -> args from CBuild::parse |
Definition at line 281 of file CBuild.cpp.
References lib::map< _K, _D >::at(), BUILD, BUILD_RUN, CBuild::Toolchain::call(), CBuild::Registry::CallTask(), CBUILD_CACHE_DIR, CBUILD_COPY_CACHE_DIR, CBUILD_PROJECT_DEPS_DIR, CBUILD_PROJECT_DEPS_HEADERS, CBuild::Toolchain::clear(), CLEAR, CBuild::fs::create(), CBuild::Toolchain::debug(), DEBUG, CBuild::fs::DIR, ERROR, CBuild::fs::exists(), exit(), lib::map< _K, _D >::get(), lib::map< _K, _D >::get_ptr(), CBuild::Registry::GetGenerator(), CBuild::Registry::GetToolchain(), LOAD_DEPS, CBuild::Toolchain::load_project_deps(), print_none(), print_verbose(), printf(), REBUILD, RED, CBuild::Toolchain::run(), RUN, lib::map< _K, _D >::size(), TASK, and CBuild::Registry::ToolchainAll().
ARG_TYPE CBuild::out_handler | ( | lib::map< std::string, std::string > * | args, |
char ** | argv, | ||
int | argc, | ||
int | ptr, | ||
CBuild::RType * | type ) |
Definition at line 48 of file cli_parser.cpp.
References exit(), lib::map< _K, _D >::get_ptr(), print(), print_full(), print_none(), print_verbose(), lib::map< _K, _D >::push_back_check(), and RED.
CBuild::RType CBuild::parse | ( | lib::map< std::string, std::string > * | args, |
int | argc, | ||
char ** | argv ) |
Parse arguments.
args | => lib::map<std::string, std::string>* -> Returned arguments for other functions |
argc | => int -> argc from main |
argv | => char** -> argv from main |
Definition at line 274 of file cli_parser.cpp.
References BLANK_ARG, ERROR, exit(), CBuild::Registry::GetKeywordsList(), CBuild::Registry::init(), parsers_list, print(), lib::map< _K, _D >::push_back_check(), RED, and TASK.
|
inline |
Parse string to vector of strings.
in | => std::string -> Input string |
Definition at line 38 of file filebuff.hpp.
Referenced by CBuild::line_filebuff::set_str().
std::string CBuild::preprocess_json_str | ( | std::string_view | str | ) |
Preprocess string for json.
str | => std::string_view -> Input string |
Definition at line 149 of file generator.cpp.
Referenced by CBuild::ccj_out::generate().
void CBuild::print | ( | std::string | msg, |
color | fg = CBuild::WHITE ) |
Print colored text to STDOUT.
msg | => std::string -> text to print |
fg | => CBuild::color -> color of text |
Definition at line 70 of file print.cpp.
References none, print_internal(), and toogle.
Referenced by arg_handler(), CBuild::ConfigToolchain::build(), build_handler(), CBuild::Toolchain::call(), CBuild::ConfigToolchain::call(), CBuild::MetaToolchain::call(), CBuild::Help::call(), CBuild::Version::call(), CBuild::TaskList::call(), CBuild::ToolchainList::call(), CBuild::GeneratorList::call(), CBuild::CmdList::call(), CBuild::Registry::CallTask(), CBuild::ConfigToolchain::clear(), CBuild::MetaToolchain::clear(), CBuild::ConfigToolchain::compile(), CBuild::CBuildDependency::compile(), CBuild::Toolchain::crash(), CBuild::Toolchain::debug(), CBuild::ConfigToolchain::debug(), CBuild::MetaToolchain::debug(), CBuild::MINGW_GXX< hash >::debug(), CBuild::MINGW_GXXMT< hash >::debug(), CBuild::MINGW_GCC< hash >::debug(), CBuild::MINGW_GCCMT< hash >::debug(), CBuild::ccj_out::generate(), CBuild::makefile_out::generate(), generator_handler(), CBuild::ConfigToolchain::get_cmds(), get_pkg_info(), CBuild::ConfigToolchain::init(), CBuild::ConfigToolchain::link(), CBuild::ConfigToolchain::link_pack(), CBuild::ConfigToolchain::load_project_deps(), CBuild::MetaToolchain::load_project_deps(), out_handler(), parse(), CBuild::ConfigToolchain::post_build(), CBuild::ConfigToolchain::post_link(), CBuild::ConfigToolchain::pre_build(), CBuild::ConfigToolchain::pre_link(), CBuild::CBuildDependency::prepare(), rebuild(), CBuild::Toolchain::run(), CBuild::ConfigToolchain::run(), CBuild::MetaToolchain::run(), CBuild::MINGW_GXX< hash >::run(), CBuild::MINGW_GXXMT< hash >::run(), CBuild::ConfigToolchain::set_id(), CBuild::ConfigToolchain::set_name(), CBuild::ConfigToolchain::stdargs(), system(), system_piped(), and task_handler().
void CBuild::print_files | ( | ) |
Print temporary file array.
Definition at line 369 of file hash.cpp.
References CBuild::vars::filelist, MAGENTA, and print_full().
Referenced by get_files().
void CBuild::print_full | ( | std::string | msg, |
color | fg = CBuild::WHITE ) |
Print colored text to STDOUT if verbose flag is set.
msg | => std::string -> text to print |
fg | => CBuild::color -> color of text |
Definition at line 75 of file print.cpp.
References none, print_internal(), toogle, and verbose.
Referenced by build_handler(), force_handler(), gcc_hash_impl(), CBuild::Toolchain::gen_file_list(), CBuild::ccj_out::generate(), generator_handler(), get_file_data(), CBuild::CBuildHashV2::get_files_for_recompilation(), get_random_string(), load_hash(), out_handler(), parse_file(), CBuild::CBuildDependency::prepare(), print_files(), procces_files(), CBuild::Registry::RegisterGenerator(), CBuild::Registry::RegisterKeyword(), CBuild::Registry::RegisterTarget(), CBuild::Registry::RegisterTask(), and task_handler().
void CBuild::print_internal | ( | std::string | msg, |
CBuild::color | fg ) |
Definition at line 30 of file print.cpp.
Referenced by print(), and print_full().
void CBuild::print_none | ( | ) |
Fully disable all print though CBuild::print.
Definition at line 101 of file print.cpp.
References none.
Referenced by loop(), and out_handler().
void CBuild::print_toggle | ( | ) |
Toogle print betwen none and currently selected level.
Definition at line 104 of file print.cpp.
References toogle.
Referenced by gcc_hash_impl().
void CBuild::print_verbose | ( | ) |
Enable verbose flag.
Definition at line 98 of file print.cpp.
References verbose.
Referenced by loop(), and out_handler().
void CBuild::printf | ( | CBuild::color | fg, |
const char * | fmt, | ||
... ) |
Some poor printf implementation.
Definition at line 80 of file print.cpp.
References none, printf_internal(), and toogle.
Referenced by CBuild::MetaToolchain::call(), CBuild::MetaToolchain::clear(), CBuild::MetaToolchain::debug(), CBuild::MetaToolchain::load_project_deps(), loop(), and CBuild::MetaToolchain::run().
void CBuild::printf_full | ( | CBuild::color | fg, |
const char * | fmt, | ||
... ) |
Some poor printf implementation for verbouse-only prints.
Definition at line 89 of file print.cpp.
References none, printf_internal(), toogle, and verbose.
Referenced by CBuild::CBuildHashV2::compare_and_set_cargs(), CBuild::CBuildHashV2::compare_and_set_commands(), CBuild::CBuildHashV2::compare_and_set_largs(), CBuild::CBuildHashV2::compare_and_set_output_file(), CBuild::fs::dir(), CBuild::fs::dir(), CBuild::fs::dir_rec(), CBuild::fs::dir_rec(), and print_metadata().
void CBuild::printf_internal | ( | CBuild::color | fg, |
std::string | msg, | ||
va_list | va ) |
Definition at line 49 of file print.cpp.
Referenced by printf(), and printf_full().
void CBuild::procces_files | ( | std::vector< std::string > | files, |
std::vector< std::string > | objects, | ||
std::string | toolchain_id ) |
Procces file data.
files | => std::vector<std::string> -> File list |
toolchain_id | => std::string -> used toolchain, for working with hash database |
Definition at line 233 of file hash.cpp.
References CBuild::vars::filelist, get_file_data(), GREEN, hash(), CBuild::vars::headers, MAGENTA, CBuild::vars::old_hashes, print_full(), and RED.
Referenced by get_files().
int CBuild::read_file_hash | ( | std::string | target_id, |
std::string | file, | ||
uint64_t * | hash ) |
Get a file hash (internally uses read_file_metadata, so no performance benefits, but easiier to use in hasher)
target_id | => std::string -> Id of target that has this file |
file | => std::string -> File name |
hash | => uint64_t -> Hash value |
Definition at line 120 of file metadata_file.cpp.
References hash(), CBuild::source_metadata_file::hash, and read_file_metadata().
int CBuild::read_file_metadata | ( | std::string | target_id, |
std::string | src_file, | ||
CBuild::source_metadata_file * | metadata ) |
Load metadata for source file.
target_id | => std::string -> Id of target that has this file |
src_file | => std::string -> File name |
metadata | => CBuild::source_metadata_file* -> Pointer to file metadata struct |
Definition at line 66 of file metadata_file.cpp.
References get_file_metadata_path(), and read_file_metadata_internal().
Referenced by gcc_hash_impl(), parse_file(), read_file_hash(), and write_file_hash().
int CBuild::read_file_metadata_direct | ( | std::string | target_id, |
std::string | file, | ||
CBuild::source_metadata_file * | metadata ) |
Load metadata for source file.
target_id | => std::string -> Id of target that has this filelibsfml-dev |
file | => std::string -> Metadata file name |
metadata | => CBuild::source_metadata_file* -> Pointer to file metadata struct |
Definition at line 71 of file metadata_file.cpp.
References read_file_metadata_internal().
Referenced by load_hash(), and CBuild::CBuildDependency::prepare().
int CBuild::read_target_metadata | ( | std::string | target_id, |
CBuild::target_metadata_file * | metadata ) |
Load metadata for a full target.
target_id | => std::string ->Id of target |
metadata | => CBuild::target_metadata_file* -> Pointer to a target metadata struct |
Definition at line 76 of file metadata_file.cpp.
References get_target_metadata_path(), and read_target_metadata_direct().
Referenced by CBuild::CBuildHashV2::compare_and_set_cargs(), CBuild::GCCHash::compare_and_set_cargs(), CBuild::CBuildHash::compare_and_set_cargs(), CBuild::CBuildHashV2::compare_and_set_commands(), CBuild::GCCHash::compare_and_set_commands(), CBuild::CBuildHash::compare_and_set_commands(), CBuild::CBuildHashV2::compare_and_set_largs(), CBuild::GCCHash::compare_and_set_largs(), CBuild::CBuildHash::compare_and_set_largs(), CBuild::CBuildHashV2::compare_and_set_output_file(), CBuild::GCCHash::compare_and_set_output_file(), and CBuild::CBuildHash::compare_and_set_output_file().
int CBuild::read_target_metadata_direct | ( | std::string | path, |
CBuild::target_metadata_file * | metadata ) |
Load metadata for a full target using path to metdata file.
path | => std::string -> File path |
metadata | => CBuild::target_metadata_file* -> Metadata |
Definition at line 80 of file metadata_file.cpp.
References CBuild::target_metadata_file::cargs, CBuild::target_metadata_file::compiler, CBuild::fs::exists(), CBuild::target_metadata_file::largs, CBuild::target_metadata_file::linker, CBuild::target_metadata_file::out, and CBuild::target_metadata_file::packer.
Referenced by CBuild::CBuildDependency::largs(), CBuild::CBuildDependency::need_prepare(), CBuild::CBuildDependency::prepare(), and read_target_metadata().
void CBuild::rebuild | ( | std::string | scripts | ) |
Rebuild userspace part of CBuild.
scripts | => std::string -> path to scripts dir |
Definition at line 550 of file CBuild.cpp.
ARG_TYPE CBuild::rebuild_handler | ( | lib::map< std::string, std::string > * | args, |
char ** | argv, | ||
int | argc, | ||
int | ptr, | ||
CBuild::RType * | type ) |
Definition at line 254 of file cli_parser.cpp.
References lib::map< _K, _D >::push_back_check(), and REBUILD.
bool CBuild::register_parse_handler | ( | std::string | cmd, |
CBuild::handler | parser ) |
Register new handler for parsing cli args, see handler typedef comment to guide how to write handlers.
cmd | => std::string -> Command that trigers this parser |
parser | => CBuild::handler -> Custom parsing function |
Definition at line 315 of file cli_parser.cpp.
References parsers_list.
std::string CBuild::remove_env_var | ( | std::string | var | ) |
Remove registered environment var.
var | => std::string -> Var name |
Definition at line 90 of file system.cpp.
References env_vars.
void CBuild::store_hash | ( | std::string | toolchain_id | ) |
Store new hashes to file.
toolchain_id | => std::string -> Id of toolchain |
Definition at line 294 of file hash.cpp.
References CBuild::fs::create(), CBuild::source_metadata_file::deps, CBuild::fs::FILE, CBuild::vars::filelist, get_file_metadata_path(), CBuild::source_metadata_file::hash, CBuild::vars::headers, write_file_hash(), and write_file_metadata().
Referenced by get_files().
int CBuild::system | ( | std::string | cmd | ) |
Call stdlib system() and print cmd to shell.
cmd | => std::string -> command |
Definition at line 47 of file system.cpp.
References BLUE, enabled, get_env_vars(), and print().
Referenced by CBuild::Toolchain::call(), CBuild::Toolchain::clear(), CBuild::Toolchain::compile(), CBuild::CBuildDependency::compile(), CBuild::Toolchain::debug(), CBuild::NetDependency::file_fetch(), CBuild::NetDependency::git_fetch(), CBuild::Toolchain::load_project_deps(), CBuild::CBuildRebuildScript::post_link(), CBuild::Toolchain::run(), CBuild::MINGW_GXX< hash >::run(), and CBuild::MINGW_GXXMT< hash >::run().
std::string CBuild::system_piped | ( | std::string | cmd, |
unsigned int | buffsize ) |
Execute command and return it's output.
cmd | => stt::string -> command |
buffsize | => unsigned int -> Size of output buffer, malloc and fread |
Definition at line 58 of file system.cpp.
References BLUE, enabled, get_env_vars(), log, and print().
Referenced by gcc_hash_impl(), and get_pkg_info().
ARG_TYPE CBuild::task_handler | ( | lib::map< std::string, std::string > * | args, |
char ** | argv, | ||
int | argc, | ||
int | ptr, | ||
CBuild::RType * | type ) |
Definition at line 178 of file cli_parser.cpp.
References exit(), lib::map< _K, _D >::get_ptr(), CBuild::Registry::GetTasksList(), GREEN, print(), print_full(), lib::map< _K, _D >::push_back_check(), RED, and TASK.
int CBuild::write_file_hash | ( | std::string | target_id, |
std::string | file, | ||
uint64_t * | hash ) |
@brief Write a file hash (internally uses write_file_metadata, so no performance benefits, but easiier to use in hasher)
target_id | => std::string -> Id of target that has this file |
file | => std::string -> File name |
hash | => uint64_t -> Pointer to a hash value |
Definition at line 161 of file metadata_file.cpp.
References hash(), CBuild::source_metadata_file::hash, read_file_metadata(), and write_file_metadata().
Referenced by store_hash().
int CBuild::write_file_metadata | ( | std::string | target_id, |
std::string | src_file, | ||
CBuild::source_metadata_file * | metadata ) |
Write a metadata for a file to a file.
target_id | => std::string -> Id of a target that has this file |
src_file | => std::string -> File name |
metadata | => CBuild::source_metadata_file* -> Pointer to a file metadata struct |
Definition at line 126 of file metadata_file.cpp.
References CBuild::source_metadata_file::deps, get_file_metadata_path(), CBuild::source_metadata_file::hash, CBuild::source_metadata_file::object, and CBuild::source_metadata_file::source.
Referenced by gcc_hash_impl(), parse_file(), store_hash(), and write_file_hash().
int CBuild::write_target_metadata | ( | std::string | target_id, |
CBuild::target_metadata_file * | metadata ) |
Write a metadata for a full target.
target_id | => std::string -> Id of a target |
metadata | => CBuild::target_metadata_file* -> Pointer to a target metadata struct |
Definition at line 141 of file metadata_file.cpp.
References CBuild::target_metadata_file::cargs, CBuild::target_metadata_file::compiler, get_target_metadata_path(), CBuild::target_metadata_file::largs, CBuild::target_metadata_file::linker, CBuild::target_metadata_file::out, and CBuild::target_metadata_file::packer.
Referenced by CBuild::CBuildHashV2::compare_and_set_cargs(), CBuild::GCCHash::compare_and_set_cargs(), CBuild::CBuildHash::compare_and_set_cargs(), CBuild::CBuildHashV2::compare_and_set_commands(), CBuild::GCCHash::compare_and_set_commands(), CBuild::CBuildHash::compare_and_set_commands(), CBuild::CBuildHashV2::compare_and_set_largs(), CBuild::GCCHash::compare_and_set_largs(), CBuild::CBuildHash::compare_and_set_largs(), CBuild::CBuildHashV2::compare_and_set_output_file(), CBuild::GCCHash::compare_and_set_output_file(), CBuild::CBuildHash::compare_and_set_output_file(), CBuild::CBuildHashV2::set_target_meta(), CBuild::GCCHash::set_target_meta(), and CBuild::CBuildHash::set_target_meta().
int CBuild::arg = 0 |
Definition at line 221 of file cli_parser.cpp.
Referenced by CBuild::Toolchain::add_compile_arg(), CBuild::Toolchain::add_link_arg(), CBuild::Registry::AddCompileArg(), CBuild::Registry::AddLinkArg(), arg_handler(), CBuild::MetaToolchain::call(), CBuild::MetaToolchain::debug(), and CBuild::Toolchain::get_compile_args().
bool CBuild::enabled = true |
Definition at line 34 of file system.cpp.
Referenced by disable_system(), enable_system(), is_system_enabled(), system(), and system_piped().
std::map<std::string, std::string> CBuild::env_vars |
Definition at line 33 of file system.cpp.
Referenced by add_env_var(), change_env_var(), get_env_vars(), and remove_env_var().
std::vector<std::string> CBuild::log |
Definition at line 32 of file system.cpp.
Referenced by CBuild::makefile_out::generate(), get_log(), and system_piped().
bool CBuild::none = false |
Definition at line 28 of file print.cpp.
Referenced by print(), print_full(), print_none(), printf(), and printf_full().
int CBuild::parg = 0 |
Definition at line 222 of file cli_parser.cpp.
Referenced by arg_handler().
All handlers.
Definition at line 266 of file cli_parser.cpp.
Referenced by parse(), and register_parse_handler().
bool CBuild::real_exit = true |
Definition at line 33 of file cli_parser.cpp.
Referenced by exit().
bool CBuild::toogle = true |
Definition at line 29 of file print.cpp.
Referenced by print(), print_full(), print_toggle(), printf(), and printf_full().
bool CBuild::verbose = false |
Definition at line 27 of file print.cpp.
Referenced by print_full(), print_verbose(), and printf_full().
int CBuild::version[] = {CBUILD_VERSION_MAJOR, CBUILD_VERSION_MINOR} |
Definition at line 556 of file CBuild.cpp.
Referenced by get_version_array(), CBuild::Toolchain::set_version_major(), and CBuild::ConfigToolchain::set_version_major().