21#ifndef CBUILD_MINGW_GCCMT_TOOLCHAIN
22#define CBUILD_MINGW_GCCMT_TOOLCHAIN
34template <CBuild::HashImpl hash = CBuild::CBuildHashV2>
48 this->
linker =
"x86_64-w64-mingw32-gcc";
49 this->
compiler =
"x86_64-w64-mingw32-gcc";
50 this->
packer =
"x86_64-w64-mingw32-ar cr";
64 this->
linker =
"x86_64-w64-mingw32-gcc";
65 this->
compiler =
"x86_64-w64-mingw32-gcc";
66 this->
packer =
"x86_64-w64-mingw32-ar cr";
83 std::atomic_int64_t read_ptr;
84 read_ptr.store(files.size() - 1);
86 unsigned int num_threads = std::thread::hardware_concurrency();
88 std::thread threads[num_threads];
89 for (
unsigned int i = 0; i < num_threads; i++) {
90 threads[i] = std::thread([&files,
this, &
args, &read_ptr](
void) ->
void {
93 int64_t i = read_ptr.fetch_sub(1);
99 cmd += files.at(i).key;
103 cmd += files.at(i).data;
105 std::this_thread::get_id();
111 for (
unsigned int i = 0; i < num_threads; i++) {
126 for (
unsigned int i = 0; i < files.size(); i++) {
127 flist += files.at(i).data;
130 if (files.size() > 0) {
152 for (
unsigned int i = 0; i < files.size(); i++) {
153 flist += files.at(i).data;
156 if (files.size() > 0) {
167 for (std::string
id : this->
depends) {
169 if (target != NULL) {
170 auto out_path = target->gen_out_name(
".exe",
".dll");
171 unsigned int end_slash = out_path.find_last_of(
'/');
173 "/" + out_path.substr(end_slash + 1);
180 std::string
gen_out_name(std::string executable =
".exe", std::string dyn_lib =
".dll",
181 std::string stat_lib =
".a")
override {
183 if (this->
name != std::string(
"")) {
295 void debug(std::vector<std::string>*
args, std::vector<std::string>* pargs)
override {
#define CBUILD_BUILD_OUT_DIR
Build out in build/toolchain.
#define CBUILD_BUILD_DIR
Build directory of CBuild.
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 build() override
Build.
void link_pack() override
Linking for static libraries.
MINGW_GCCMT(std::string id, std::string name)
Construct a new MINGW_GCCMT object.
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 link() override
Linking.
void post_link() override
After linking.
MINGW_GCCMT(std::string id)
Construct a new MINGW_GCCMT object.
CBuild::Toolchain * GetToolchain(std::string name, bool force=false)
Get the registered toolchain.
bool copy(std::string start, std::string end)
Copy files or directories.
Filebuffer for CBuild ecosystem.
uint64_t hash(std::string str)
FNV-1a hashing function for std::string.
void print(std::string msg, color fg=CBuild::WHITE)
Print colored text to STDOUT.
Custom print that support color codes.
Command for compile_commands.json.