diff --git a/.vscode/launch.json b/.vscode/launch.json index bba8801..383421d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,7 +8,7 @@ "name": "Debug", "type": "cppdbg", "request": "launch", - "program": "${workspaceFolder}/main", + "program": "${workspaceFolder}/treender", "args": [], "stopAtEntry": false, "cwd": "${fileDirname}", diff --git a/build.cpp b/build.cpp index 13e655a..05f4bc2 100644 --- a/build.cpp +++ b/build.cpp @@ -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();