nob 实现最后一步编译框架 移动测试用例 准备for的新语法
This commit is contained in:
1 parent
c4d1bbae92
commit
bb8761d392
92 files changed
+803
-27
No files matched your search
@@ -1,5 +1,5 @@
|
||||
|
||||
#define COMMON_CFLAGS "-Wall", "-Wextra", "-D_CRT_SECURE_NO_WARNINGS"
|
||||
#define COMMON_CFLAGS "-Wall", "-Wextra", "-D_CRT_SECURE_NO_WARNINGS", "-D_CRT_NONSTDC_NO_DEPRECATE"
|
||||
#define SPL_CFLAGS COMMON_CFLAGS, "-O0", "-g"
|
||||
#define SPL_OPTIMIZATION_FLAG COMMON_CFLAGS, "-O2"
|
||||
#define nob_cc_flags(cmd) nob_cmd_append(cmd, SPL_CFLAGS)
|
||||
@@ -288,6 +288,7 @@ defer:
|
||||
const char *build_target(const char *name) {
|
||||
if (!prepare_build())
|
||||
return NULL;
|
||||
const char *splc_libs = "./src/libs";
|
||||
for (size_t i = 0; i < NOB_ARRAY_LEN(targets); ++i) {
|
||||
if (name != NULL && strcmp(targets[i].name, name) != 0) {
|
||||
continue;
|
||||
@@ -298,6 +299,7 @@ const char *build_target(const char *name) {
|
||||
case BUILD_EXE: {
|
||||
return build_exe(target);
|
||||
}
|
||||
case BUILD_SPLC_SIR:
|
||||
case BUILD_SIR: {
|
||||
const char *target_sir = sir_path(name);
|
||||
// 编译器先建好:它的产物也要算进依赖,编译器变了就得重编 .sir。
|
||||
@@ -321,6 +323,9 @@ const char *build_target(const char *name) {
|
||||
return target_sir;
|
||||
|
||||
Nob_Cmd cmd = {0};
|
||||
if (target->kind == BUILD_SPLC_SIR) {
|
||||
nob_cmd_append(&cmd, "-I", splc_libs);
|
||||
}
|
||||
nob_cmd_append(&cmd, target->sir.src, target_sir);
|
||||
if (!run_target(target->sir.compiler, &cmd)) {
|
||||
nob_log(NOB_ERROR, "failed to build `%s`", name);
|
||||
@@ -330,6 +335,7 @@ const char *build_target(const char *name) {
|
||||
nob_cmd_free(cmd);
|
||||
return target_sir;
|
||||
}
|
||||
case BUILD_SPLC_NATIVE:
|
||||
case BUILD_NATIVE: {
|
||||
Nob_Cmd cmd = {0};
|
||||
const char *target_exe = exe_path(name);
|
||||
@@ -353,6 +359,9 @@ const char *build_target(const char *name) {
|
||||
return NULL;
|
||||
}
|
||||
if (needs != 0) {
|
||||
if (target->kind == BUILD_SPLC_NATIVE) {
|
||||
nob_cmd_append(&cmd, "-I", splc_libs);
|
||||
}
|
||||
nob_cmd_append(&cmd, "--dump", "c", target->native.src, target_c);
|
||||
if (!run_target(target->native.compiler, &cmd)) {
|
||||
nob_log(NOB_ERROR, "failed to build `%s`", name);
|
||||
@@ -1057,10 +1066,12 @@ static int cli_list(void) {
|
||||
count_files(t->exe.srcs, t->exe.srcs_count),
|
||||
count_files(t->exe.headers, t->exe.headers_count));
|
||||
break;
|
||||
case BUILD_SPLC_SIR:
|
||||
case BUILD_SIR:
|
||||
printf(" %-12s %-9s %s <- %s deps=%zu\n", t->name, kind, t->sir.src, t->sir.compiler,
|
||||
count_files(t->sir.deps, t->sir.deps_count));
|
||||
break;
|
||||
case BUILD_SPLC_NATIVE:
|
||||
case BUILD_NATIVE:
|
||||
printf(" %-12s %-9s %s <- %s deps=%zu crt=%zu\n", t->name, kind, t->native.src,
|
||||
t->native.compiler, count_files(t->native.deps, t->native.deps_count),
|
||||
|
||||
Reference in new issue
Block a user