relink only if recompile went good

This commit is contained in:
Nikola Petrov 2024-04-18 06:05:04 +02:00
parent 8f586169c1
commit 288186e515
2 changed files with 14 additions and 6 deletions

2
.vscode/launch.json vendored
View File

@ -8,7 +8,7 @@
"name": "Debug",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/main",
"program": "${workspaceFolder}/treender",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",

View File

@ -80,7 +80,7 @@ void compile_raylib_dir()
}
}
bool compile_src_dir()
int compile_src_dir()
{
nob_directory src_dir = get_all_files_in_dir(SRC_DIR);
nob_directory obj_dir;
@ -114,7 +114,8 @@ bool compile_src_dir()
command.push_back("-std=c++23");
command.push_back("-Wall");
command.push_back("-Werror");
bool build = false;
int build = 0;
for (size_t i = 0; i < src_dir.files.size(); i++)
{
if (check_if_rebuild(src_dir.files[i], obj_dir.files[i]))
@ -122,9 +123,9 @@ bool compile_src_dir()
command[2] = src_dir.files[i];
command[4] = obj_dir.files[i];
if (!nob_cmd_run_sync(command))
return false;
return -1;
build = true;
build = 1;
}
}
return build;
@ -234,8 +235,15 @@ int main(int argc, char const *argv[])
compile_raylib_dir();
if (compile_src_dir())
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();