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

Public Member Functions

 MetaToolchain (CBuild::CrossCompiler *parent)
 
void build () override
 Build.
 
void link () override
 Linking.
 
void link_pack () override
 Linking for static libraries.
 
void load_project_deps (std::string curr_path) override
 Load all project dependencies.
 
void run (std::vector< std::string > *args) override
 Run builded app.
 
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.
 
std::array< std::string, 3 > get_cmds () override
 Get all three commands from class - compile, linker and packer.
 
void set_default_tool (std::string arch)
 
- 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)
 
virtual void stdargs ()
 Add standard compile and link arguments into compilation Need to be publick for some hashers to work.
 
 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 set_type (CBuild::build_type type)
 Set the type of build.
 
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 void set_version_major (int version)
 Set major version component, used in -Wl,-soname
 
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 compile (std::string cmd)
 Call compiler.
 
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.
 
virtual void set_name (std::string name)
 Change out file name.
 
virtual void set_id (std::string id)
 Change id of this toolchain, if done after registering it can brake things.
 
void add_external_dependency (CBuild::Dependency *dep)
 Add external dependency to this toolchain.
 

Private Attributes

CBuild::CrossCompilerparent
 
std::string default_tool
 
bool default_tool_set
 

Additional Inherited Members

- Protected Member Functions inherited from CBuild::Toolchain
virtual void pre_build ()
 Before build.
 
virtual void post_build ()
 After build.
 
virtual void pre_link ()
 Before linking.
 
virtual void post_link ()
 After linking.
 
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 "\ ".
 
virtual void init ()
 Initialize folder structure.
 
- 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.
 

Detailed Description

Definition at line 171 of file cross_compile.cpp.

Constructor & Destructor Documentation

◆ MetaToolchain()

CBuild::MetaToolchain::MetaToolchain ( CBuild::CrossCompiler * parent)
inline

Definition at line 178 of file cross_compile.cpp.

References parent.

Member Function Documentation

◆ build()

void CBuild::MetaToolchain::build ( )
inlineoverridevirtual

Build.

Implements CBuild::Toolchain.

Definition at line 183 of file cross_compile.cpp.

◆ call()

void CBuild::MetaToolchain::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 216 of file cross_compile.cpp.

References CBuild::arg, CBuild::Toolchain::args, CBuild::Toolchain::call(), debug(), CBuild::Toolchain::dummy, CBuild::Toolchain::force, CBuild::CrossCompiler::get_arch_tool(), CBuild::CrossCompiler::get_toolchain_list(), CBuild::MAGENTA, CBuild::print(), CBuild::printf(), CBuild::RED, and CBuild::WHITE.

◆ clear()

void CBuild::MetaToolchain::clear ( )
inlineoverridevirtual

◆ debug()

void CBuild::MetaToolchain::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 251 of file cross_compile.cpp.

References CBuild::arg, CBuild::Toolchain::args, CBuild::Toolchain::debug(), CBuild::CrossCompiler::get_arch_tool(), CBuild::CrossCompiler::get_toolchain_list(), CBuild::MAGENTA, CBuild::print(), CBuild::printf(), CBuild::RED, and CBuild::WHITE.

Referenced by call().

◆ get_cmds()

std::array< std::string, 3 > CBuild::MetaToolchain::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 298 of file cross_compile.cpp.

◆ link()

void CBuild::MetaToolchain::link ( )
inlineoverridevirtual

Linking.

Implements CBuild::Toolchain.

Definition at line 184 of file cross_compile.cpp.

◆ link_pack()

void CBuild::MetaToolchain::link_pack ( )
inlineoverridevirtual

Linking for static libraries.

Implements CBuild::Toolchain.

Definition at line 185 of file cross_compile.cpp.

◆ load_project_deps()

void CBuild::MetaToolchain::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 186 of file cross_compile.cpp.

References CBuild::CrossCompiler::get_arch_tool(), CBuild::CrossCompiler::get_toolchain_list(), CBuild::Toolchain::load_project_deps(), CBuild::MAGENTA, CBuild::print(), CBuild::printf(), CBuild::RED, and CBuild::WHITE.

◆ run()

void CBuild::MetaToolchain::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 201 of file cross_compile.cpp.

References CBuild::Toolchain::args, CBuild::CrossCompiler::get_arch_tool(), CBuild::CrossCompiler::get_toolchain_list(), CBuild::MAGENTA, CBuild::print(), CBuild::printf(), CBuild::RED, CBuild::Toolchain::run(), and CBuild::WHITE.

◆ set_default_tool()

void CBuild::MetaToolchain::set_default_tool ( std::string arch)
inline

Definition at line 301 of file cross_compile.cpp.

Member Data Documentation

◆ default_tool

std::string CBuild::MetaToolchain::default_tool
private

Definition at line 174 of file cross_compile.cpp.

◆ default_tool_set

bool CBuild::MetaToolchain::default_tool_set
private

Definition at line 175 of file cross_compile.cpp.

◆ parent

CBuild::CrossCompiler* CBuild::MetaToolchain::parent
private

Definition at line 173 of file cross_compile.cpp.

Referenced by MetaToolchain().


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