CBuild
C++ build system with scripts written in c++
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
CBuild::ConfigToolchain Class Reference
Inheritance diagram for CBuild::ConfigToolchain:
CBuild::Toolchain

Public Member Functions

 ConfigToolchain ()
 
void call (std::vector< std::string > *args, bool force=false, bool debug=false, bool dummy=false) override
 Call tollchain to execute.
 
void debug (std::vector< std::string > *args, std::vector< std::string > *pargs) override
 Build program in debug mode and after run gdb on it.
 
void clear () override
 Clear all caches and builded app.
 
void init () override
 Initialize folder structure.
 
void run (std::vector< std::string > *args) override
 Run builded app.
 
void pre_build () override
 Before build.
 
void build () override
 Build.
 
void post_build () override
 After build.
 
void pre_link () override
 Before linking.
 
void link_pack () override
 Linking for static libraries.
 
void link () override
 Linking.
 
void post_link () override
 After linking.
 
void stdargs () override
 Add standard compile and link arguments into compilation Need to be publick for some hashers to work.
 
void compile (std::string cmd) override
 Call compiler.
 
void load_project_deps (std::string curr_path) override
 Load all project dependencies.
 
std::array< std::string, 3 > get_cmds () override
 Get all three commands from class - compile, linker and packer.
 
void set_id (std::string id) override
 Change id of this toolchain, if done after registering it can brake things.
 
void set_name (std::string name) override
 Change out file name.
 
void set_version_major (int version) override
 Set major version component, used in -Wl,-soname
 
void set_type (CBuild::build_type type) override
 Set the type of build.
 
void clone_config (CBuild::Toolchain *tool)
 
- Public Member Functions inherited from CBuild::Toolchain
virtual std::string gen_out_name (std::string executable=".run", std::string dyn_lib=".so", std::string stat_lib=".a")
 Generate output file name (after linking)
 
 Toolchain ()
 
virtual ~Toolchain ()
 
std::string get_id ()
 
virtual void add_define (std::string define, std::string val="")
 Add new define.
 
virtual void add_undef (std::string define)
 Add new undefine (undefine previvious define)
 
virtual void add_include (std::string include_path)
 Add compile-time include.
 
virtual void add_compile_arg (std::string arg)
 Directly add compiler argument.
 
virtual void add_link_arg (std::string arg)
 Add linker arguments.
 
virtual void add_library_include (std::string library)
 Add system library include, library include folder need to be in PATH.
 
virtual void add_library_dir (std::string include, std::string lib)
 Add library include directory (with *.h files) and directory with library *.a and *.so/*.dll files.
 
virtual void add_requirment (std::string task_, CBuild::stage run_stage=CBuild::PRE)
 Add required task, that task will be executed before toolchain, it can have dependecies, but toolchain can depend on multiple tasks also.
 
virtual void depends_on (std::string target)
 This target depends on other target.
 
virtual void warn ()
 Enable more warnings.
 
virtual void static_analizer ()
 Enable static anlizer (very slow)
 
virtual void error ()
 Add -Werror.
 
virtual void multithreaded_target ()
 Add -pthread argument.
 
virtual void set_standart (std::string std_)
 Set standart for code (-std=std_)
 
virtual void add_file (std::string path)
 Add file for compilation.
 
virtual void add_folder (std::string path)
 Add folder to compile path, scan is not recursive.
 
virtual void depends_on_project (std::string path, std::string name, std::string id, std::string headers_path)
 Add another CBuild project as dependency.
 
virtual void set_profiling_mode ()
 Enable -pg for gprof.
 
virtual lib::map< std::string, std::string > gen_file_list_force ()
 Generate list of all files, that is tracked by this target.
 
virtual std::string get_compile_args ()
 Get preprocessed compile args.
 
virtual void crash () __attribute__((__noreturn__))
 Crash compilation, needed when gcc throws error.
 
virtual void add_pkgconfig_entry (std::string id)
 Add a lib, data for what need to be searched using pkg-config tool.
 
virtual void set_hasher (Hash *hasher)
 Set used hasher for this target.
 
void add_external_dependency (CBuild::Dependency *dep)
 Add external dependency to this toolchain.
 

Protected Attributes

bool type_set
 
bool vmajor_set
 
- Protected Attributes inherited from CBuild::Toolchain
std::string name = ""
 Name of output, if undefined (""), for id is used for binary name.
 
std::string id
 Must be initialized in derived classes.
 
lib::map< std::string, CBuild::stagerequired
 Save task id with run stage sprecified for this task.
 
std::vector< std::string > depends
 All other targets, that is needed for this target.
 
std::vector< CBuild::Pathtargets
 Target files or folders.
 
std::vector< std::string > compiler_args
 Compiler args (specified and generated)
 
std::vector< std::string > link_args
 Linker args (specified and generated)
 
std::string compiler
 Compiler command.
 
std::string linker
 Linker command.
 
std::string packer
 ar command for packing static libraries
 
CBuild::build_type build_type
 Type of build.
 
std::vector< CBuild::Project_dependencyproject_deps
 Project dependencies.
 
bool dummy = false
 We do dummy compilation.
 
int version_major = -1
 Major version, can be necesary for shared libraries.
 
bool gen_out_name_without_base_path = false
 gen_out_name() dont prepend base path
 
bool gen_file_list_for_linking = false
 Generate file list for linking - force and no changes to hashes.
 
std::vector< std::string > pkg_config_include_entries
 Libs that need to be searched in pkg-config.
 
Hashhasher
 Hasher used here.
 
std::vector< CBuild::Dependency * > dependency_list
 Dependencies.
 
std::vector< std::string > * args
 Argument pointer (scratch variable)
 
bool force
 Force argument (scratch variable)
 
bool stdargs_lock = false
 Lock that specifies that stdargs() function need to do nothing.
 

Additional Inherited Members

- Protected Member Functions inherited from CBuild::Toolchain
virtual lib::map< std::string, std::string > gen_file_list (bool force)
 Generate list of files that need to be compiles.
 
virtual std::string gen_out_file (std::string file)
 Generate output object file from input file.
 
virtual std::string cmd_str (std::string in)
 Replace spaces by "\ ".
 

Detailed Description

Definition at line 35 of file cross_compile.cpp.

Constructor & Destructor Documentation

◆ ConfigToolchain()

CBuild::ConfigToolchain::ConfigToolchain ( )
inline

Definition at line 41 of file cross_compile.cpp.

References CBuild::Toolchain::hasher, type_set, and vmajor_set.

Member Function Documentation

◆ build()

void CBuild::ConfigToolchain::build ( )
inlineoverridevirtual

Build.

Implements CBuild::Toolchain.

Definition at line 71 of file cross_compile.cpp.

References CBuild::exit(), CBuild::print(), and CBuild::RED.

◆ call()

void CBuild::ConfigToolchain::call ( std::vector< std::string > * args,
bool force = false,
bool debug = false,
bool dummy = false )
inlineoverridevirtual

Call tollchain to execute.

Parameters
args=> std::vector<std::string>* -> argument for call, pointer, nonull
force=> bool -> force argument, used internally
debug=> bool -> does we run in build mode
dummy=> bool -> we dont build - we run this to evalueate all things

Reimplemented from CBuild::Toolchain.

Definition at line 46 of file cross_compile.cpp.

References CBuild::exit(), CBuild::print(), and CBuild::RED.

◆ clear()

void CBuild::ConfigToolchain::clear ( )
inlineoverridevirtual

Clear all caches and builded app.

Reimplemented from CBuild::Toolchain.

Definition at line 55 of file cross_compile.cpp.

References CBuild::exit(), CBuild::print(), and CBuild::RED.

◆ clone_config()

void CBuild::ConfigToolchain::clone_config ( CBuild::Toolchain * tool)
inline

◆ compile()

void CBuild::ConfigToolchain::compile ( std::string cmd)
inlineoverridevirtual

Call compiler.

Parameters
cmd=> std::string -> Shell command

Reimplemented from CBuild::Toolchain.

Definition at line 99 of file cross_compile.cpp.

References CBuild::exit(), CBuild::print(), and CBuild::RED.

◆ debug()

void CBuild::ConfigToolchain::debug ( std::vector< std::string > * args,
std::vector< std::string > * pargs )
inlineoverridevirtual

Build program in debug mode and after run gdb on it.

Parameters
args=> std::vector<std::string>* -> arguments for build
pargs=> std::vector<std::string>* -> arguments for run

Reimplemented from CBuild::Toolchain.

Definition at line 51 of file cross_compile.cpp.

References CBuild::exit(), CBuild::print(), and CBuild::RED.

◆ get_cmds()

std::array< std::string, 3 > CBuild::ConfigToolchain::get_cmds ( )
inlineoverridevirtual

Get all three commands from class - compile, linker and packer.

Returns
std::array<std::string, 3> -> Compiler, linker, packer

Reimplemented from CBuild::Toolchain.

Definition at line 107 of file cross_compile.cpp.

References CBuild::exit(), CBuild::print(), and CBuild::RED.

◆ init()

void CBuild::ConfigToolchain::init ( )
inlineoverridevirtual

Initialize folder structure.

Reimplemented from CBuild::Toolchain.

Definition at line 59 of file cross_compile.cpp.

References CBuild::exit(), CBuild::print(), and CBuild::RED.

◆ link()

void CBuild::ConfigToolchain::link ( )
inlineoverridevirtual

Linking.

Implements CBuild::Toolchain.

Definition at line 87 of file cross_compile.cpp.

References CBuild::exit(), CBuild::print(), and CBuild::RED.

◆ link_pack()

void CBuild::ConfigToolchain::link_pack ( )
inlineoverridevirtual

Linking for static libraries.

Implements CBuild::Toolchain.

Definition at line 83 of file cross_compile.cpp.

References CBuild::exit(), CBuild::print(), and CBuild::RED.

◆ load_project_deps()

void CBuild::ConfigToolchain::load_project_deps ( std::string curr_path)
inlineoverridevirtual

Load all project dependencies.

Parameters
curr_path=> std::string -> current path

Reimplemented from CBuild::Toolchain.

Definition at line 103 of file cross_compile.cpp.

References CBuild::exit(), CBuild::print(), and CBuild::RED.

◆ post_build()

void CBuild::ConfigToolchain::post_build ( )
inlineoverridevirtual

After build.

Reimplemented from CBuild::Toolchain.

Definition at line 75 of file cross_compile.cpp.

References CBuild::exit(), CBuild::print(), and CBuild::RED.

◆ post_link()

void CBuild::ConfigToolchain::post_link ( )
inlineoverridevirtual

After linking.

Reimplemented from CBuild::Toolchain.

Definition at line 91 of file cross_compile.cpp.

References CBuild::exit(), CBuild::print(), and CBuild::RED.

◆ pre_build()

void CBuild::ConfigToolchain::pre_build ( )
inlineoverridevirtual

Before build.

Reimplemented from CBuild::Toolchain.

Definition at line 67 of file cross_compile.cpp.

References CBuild::exit(), CBuild::print(), and CBuild::RED.

◆ pre_link()

void CBuild::ConfigToolchain::pre_link ( )
inlineoverridevirtual

Before linking.

Reimplemented from CBuild::Toolchain.

Definition at line 79 of file cross_compile.cpp.

References CBuild::exit(), CBuild::print(), and CBuild::RED.

◆ run()

void CBuild::ConfigToolchain::run ( std::vector< std::string > * args)
inlineoverridevirtual

Run builded app.

Parameters
args=> std::vector<std::string>* -> program arguments

Reimplemented from CBuild::Toolchain.

Definition at line 63 of file cross_compile.cpp.

References CBuild::exit(), CBuild::print(), and CBuild::RED.

◆ set_id()

void CBuild::ConfigToolchain::set_id ( std::string id)
inlineoverridevirtual

Change id of this toolchain, if done after registering it can brake things.

Parameters
id=> std::string -> New id

Reimplemented from CBuild::Toolchain.

Definition at line 111 of file cross_compile.cpp.

References CBuild::exit(), CBuild::print(), and CBuild::RED.

◆ set_name()

void CBuild::ConfigToolchain::set_name ( std::string name)
inlineoverridevirtual

Change out file name.

Parameters
name=> std::string -> Out name

Reimplemented from CBuild::Toolchain.

Definition at line 117 of file cross_compile.cpp.

References CBuild::exit(), CBuild::print(), and CBuild::RED.

◆ set_type()

void CBuild::ConfigToolchain::set_type ( CBuild::build_type type)
inlineoverridevirtual

Set the type of build.

Parameters
typeBuild type

Reimplemented from CBuild::Toolchain.

Definition at line 127 of file cross_compile.cpp.

◆ set_version_major()

void CBuild::ConfigToolchain::set_version_major ( int version)
inlineoverridevirtual

Set major version component, used in -Wl,-soname

Parameters
version=> int -> Major version

Reimplemented from CBuild::Toolchain.

Definition at line 123 of file cross_compile.cpp.

References CBuild::version, and CBuild::Toolchain::version_major.

◆ stdargs()

void CBuild::ConfigToolchain::stdargs ( )
inlineoverridevirtual

Add standard compile and link arguments into compilation Need to be publick for some hashers to work.

Reimplemented from CBuild::Toolchain.

Definition at line 95 of file cross_compile.cpp.

References CBuild::exit(), CBuild::print(), and CBuild::RED.

Member Data Documentation

◆ type_set

bool CBuild::ConfigToolchain::type_set
protected

Definition at line 37 of file cross_compile.cpp.

Referenced by ConfigToolchain().

◆ vmajor_set

bool CBuild::ConfigToolchain::vmajor_set
protected

Definition at line 38 of file cross_compile.cpp.

Referenced by ConfigToolchain().


The documentation for this class was generated from the following file: