up build
This commit is contained in:
49
build.cpp
49
build.cpp
@@ -15,7 +15,6 @@ int main(int argc, char const *argv[])
|
||||
{
|
||||
if (!std::strcmp(argv[i], "opt"))
|
||||
{
|
||||
opt_flags = "-O3";
|
||||
opt = true;
|
||||
}
|
||||
if (!std::strcmp(argv[i], "build"))
|
||||
@@ -24,13 +23,18 @@ int main(int argc, char const *argv[])
|
||||
if (!std::strcmp(argv[i], "run"))
|
||||
run = true;
|
||||
|
||||
if (!std::strcmp(argv[i], "cla"))
|
||||
if (!std::strcmp(argv[i], "clear"))
|
||||
{
|
||||
clear_all_build();
|
||||
clear = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (clear)
|
||||
{
|
||||
clear_all_build();
|
||||
}
|
||||
|
||||
// clean recompile of code
|
||||
if (clear && !build)
|
||||
{
|
||||
return 0;
|
||||
@@ -38,32 +42,35 @@ int main(int argc, char const *argv[])
|
||||
|
||||
std::filesystem::create_directory(OBJ_DIR);
|
||||
|
||||
if (!opt)
|
||||
if (opt)
|
||||
{
|
||||
|
||||
int res = compile_src_dir();
|
||||
|
||||
switch (res)
|
||||
{
|
||||
case 1:
|
||||
compile_obj_dir();
|
||||
break;
|
||||
case -1:
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!std::filesystem::exists(BUILD_FILE))
|
||||
compile_obj_dir();
|
||||
opt_flags = "-O3";
|
||||
build_as_one();
|
||||
}
|
||||
else
|
||||
{
|
||||
build_as_one();
|
||||
int res = compile_src_dir();
|
||||
switch (res)
|
||||
{
|
||||
// correcty recompile
|
||||
case 1:
|
||||
compile_obj_dir();
|
||||
break;
|
||||
// failed recompile
|
||||
case -1:
|
||||
return 0;
|
||||
// no need for recompile
|
||||
case 0:
|
||||
break;
|
||||
}
|
||||
// files dont need to recompile but exe is mising
|
||||
if (!std::filesystem::exists(BUILD_FILE))
|
||||
compile_obj_dir();
|
||||
}
|
||||
|
||||
if (run)
|
||||
{
|
||||
command = {"./" + BUILD_FILE.string(), "Pot", "20", "1080"};
|
||||
nob_cmd_run_sync(command);
|
||||
run_main();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user