ogl_beamforming

Ultrasound Beamforming Implemented with OpenGL
git clone anongit@rnpnr.xyz:ogl_beamforming.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

Commit: 80435e20e4456aeb287bf322c10bd5a2e2d5004b
Parent: 371a04e929cc6f8cd609cc22cbcc7e346dbc68b3
Author: Randy Palamar
Date:   Mon, 26 May 2025 11:48:44 -0600

build: use cmd_base with empty options for rebuilding self

Diffstat:
Mbuild.c | 66+++++++++++++++++++++++++++++++++---------------------------------
1 file changed, 33 insertions(+), 33 deletions(-)

diff --git a/build.c b/build.c @@ -319,6 +319,37 @@ run_synchronous(Arena a, CommandList *command) return os_wait_close_process(os_spawn_process(command, sb)); } +function CommandList +cmd_base(Arena *a, Options *o) +{ + CommandList result = {0}; + cmd_append(a, &result, COMPILER); + + /* TODO(rnp): support cross compiling with clang */ + if (!o->generic) cmd_append(a, &result, "-march=native"); + else if (is_amd64) cmd_append(a, &result, "-march=x86-64-v3"); + else if (is_aarch64) cmd_append(a, &result, "-march=armv8"); + + cmd_append(a, &result, COMMON_FLAGS); + + if (o->debug) cmd_append(a, &result, "-O0", "-D_DEBUG", "-Wno-unused-function"); + else cmd_append(a, &result, "-O3"); + + if (is_w32 && is_clang) cmd_append(a, &result, "-fms-extensions"); + + if (o->debug && is_unix) cmd_append(a, &result, "-ggdb"); + + if (o->sanitize) cmd_append(a, &result, "-fsanitize=address,undefined"); + + if (o->report) { + if (is_clang) cmd_append(a, &result, "-fproc-stat-report"); + else printf("warning: timing not supported with this compiler\n"); + /* TODO(rnp): basic timing */ + } + + return result; +} + function void check_rebuild_self(Arena arena, i32 argc, char *argv[]) { @@ -331,8 +362,8 @@ check_rebuild_self(Arena arena, i32 argc, char *argv[]) if (!os_rename_file(binary, old_name)) die("failed to move: %s -> %s\n", binary, old_name); - CommandList c = {0}; - cmd_append(&arena, &c, COMPILER, "-march=native", "-O3", COMMON_FLAGS); + Options options = {0}; + CommandList c = cmd_base(&arena, &options); cmd_append(&arena, &c, "-Wno-unused-function", __FILE__, "-o", binary, (void *)0); if (!run_synchronous(arena, &c)) { os_rename_file(old_name, binary); @@ -396,37 +427,6 @@ parse_options(i32 argc, char *argv[]) return result; } -function CommandList -cmd_base(Arena *a, Options *o) -{ - CommandList result = {0}; - cmd_append(a, &result, COMPILER); - - /* TODO(rnp): support cross compiling with clang */ - if (!o->generic) cmd_append(a, &result, "-march=native"); - else if (is_amd64) cmd_append(a, &result, "-march=x86-64-v3"); - else if (is_aarch64) cmd_append(a, &result, "-march=armv8"); - - cmd_append(a, &result, COMMON_FLAGS); - - if (o->debug) cmd_append(a, &result, "-O0", "-D_DEBUG", "-Wno-unused-function"); - else cmd_append(a, &result, "-O3"); - - if (is_w32 && is_clang) cmd_append(a, &result, "-fms-extensions"); - - if (o->debug && is_unix) cmd_append(a, &result, "-ggdb"); - - if (o->sanitize) cmd_append(a, &result, "-fsanitize=address,undefined"); - - if (o->report) { - if (is_clang) cmd_append(a, &result, "-fproc-stat-report"); - else printf("warning: timing not supported with this compiler\n"); - /* TODO(rnp): basic timing */ - } - - return result; -} - /* NOTE(rnp): produce pdbs on w32 */ function void cmd_pdb(Arena *a, CommandList *cmd)