CBuild
C++ build system with scripts written in c++
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CBuild::MINGW_GCC< hash > Class Template Reference

#include <mingw-gcc.hpp>

Inheritance diagram for CBuild::MINGW_GCC< hash >:
CBuild::Toolchain

Public Member Functions

 MINGW_GCC (std::string id)
 Construct a new MINGW_GCC object.
 
 MINGW_GCC (std::string id, std::string name)
 Construct a new MINGW_GCC object.
 
std::string gen_out_name (std::string executable=".exe", std::string dyn_lib=".dll", std::string stat_lib=".a") override
 Generate output file name (after linking)
 
void debug (std::vector< std::string > *args, std::vector< std::string > *pargs) override
 Build program in debug mode and after run gdb on it.
 
- Public Member Functions inherited from CBuild::Toolchain
virtual void load_project_deps (std::string curr_path)
 Load all project dependencies.
 
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 call (std::vector< std::string > *args, bool force=false, bool debug=false, bool dummy=false)
 Call tollchain to execute.
 
virtual void run (std::vector< std::string > *args)
 Run builded app.
 
virtual void clear ()
 Clear all caches and builded app.
 
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 std::array< std::string, 3 > get_cmds ()
 Get all three commands from class - compile, linker and packer.
 
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.
 

Protected Member Functions

void build () override
 Build.
 
void link () override
 Linking.
 
void link_pack () override
 Linking for static libraries.
 
void post_link () override
 After linking.
 
- 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 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

std::string wine
 
- 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

template<CBuild::HashImpl hash = CBuild::CBuildHashV2>
class CBuild::MINGW_GCC< hash >

Definition at line 32 of file mingw-gcc.hpp.

Constructor & Destructor Documentation

◆ MINGW_GCC() [1/2]

template<CBuild::HashImpl hash = CBuild::CBuildHashV2>
CBuild::MINGW_GCC< hash >::MINGW_GCC ( std::string id)
inline

◆ MINGW_GCC() [2/2]

template<CBuild::HashImpl hash = CBuild::CBuildHashV2>
CBuild::MINGW_GCC< hash >::MINGW_GCC ( std::string id,
std::string name )
inline

Member Function Documentation

◆ build()

template<CBuild::HashImpl hash = CBuild::CBuildHashV2>
void CBuild::MINGW_GCC< hash >::build ( )
inlineoverrideprotectedvirtual

◆ debug()

template<CBuild::HashImpl hash = CBuild::CBuildHashV2>
void CBuild::MINGW_GCC< hash >::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 272 of file mingw-gcc.hpp.

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

◆ gen_out_name()

template<CBuild::HashImpl hash = CBuild::CBuildHashV2>
std::string CBuild::MINGW_GCC< hash >::gen_out_name ( std::string executable = ".exe",
std::string dyn_lib = ".dll",
std::string stat_lib = ".a" )
inlineoverridevirtual

Generate output file name (after linking)

Returns
std::string -> File name

Reimplemented from CBuild::Toolchain.

Definition at line 157 of file mingw-gcc.hpp.

References CBUILD_BUILD_DIR, CBUILD_BUILD_OUT_DIR, CBuild::Toolchain::cmd_str(), CBuild::DYNAMIC_LIBRARY, CBuild::EXECUTABLE, CBuild::Toolchain::id, and CBuild::Toolchain::name.

Referenced by CBuild::MINGW_GCC< hash >::link(), and CBuild::MINGW_GCC< hash >::link_pack().

◆ link()

template<CBuild::HashImpl hash = CBuild::CBuildHashV2>
void CBuild::MINGW_GCC< hash >::link ( )
inlineoverrideprotectedvirtual

◆ link_pack()

template<CBuild::HashImpl hash = CBuild::CBuildHashV2>
void CBuild::MINGW_GCC< hash >::link_pack ( )
inlineoverrideprotectedvirtual

◆ post_link()

template<CBuild::HashImpl hash = CBuild::CBuildHashV2>
void CBuild::MINGW_GCC< hash >::post_link ( )
inlineoverrideprotectedvirtual

Member Data Documentation

◆ wine

template<CBuild::HashImpl hash = CBuild::CBuildHashV2>
std::string CBuild::MINGW_GCC< hash >::wine
protected

Definition at line 34 of file mingw-gcc.hpp.


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