ogl_beamforming

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

Commit: 7cee2865b1033e93af547c278275f08c0df4981c
Parent: 78b9855928845209786f285a0da7ef20a9ee0144
Author: Randy Palamar
Date:   Thu,  4 Dec 2025 12:06:02 -0700

build: move GNU_SOURCE crap into os_linux.c

it only matters in this part of the code and its annoying
specifying on the command line (for build.c)

this also avoids the redefinition warning from GLFW

Diffstat:
M.github/workflows/build.yml | 2+-
Mbuild.c | 11++++-------
Mutil.h | 12++++++++++--
3 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: sudo apt install libxkbcommon-dev xorg-dev - name: Build run: | - ${{matrix.cc}} -march=native -O3 -D_GNU_SOURCE build.c -Iexternal/include -o build && \ + ${{matrix.cc}} -march=native -O3 build.c -Iexternal/include -o build && \ ./build --tests && \ ./build --debug diff --git a/build.c b/build.c @@ -8,12 +8,12 @@ * [ ]: msvc build doesn't detect out of date files correctly * [ ]: seperate dwarf debug info */ +#include "util.h" + #include <stdarg.h> #include <setjmp.h> #include <stdio.h> -#include "util.h" - #define BeamformerShaderKind_ComputeCount (1) #include "beamformer_parameters.h" @@ -528,9 +528,6 @@ cmd_base(Arena *a, Options *o) if (o->debug) cmd_append(a, &result, DEBUG_FLAGS); else cmd_append(a, &result, OPTIMIZED_FLAGS); - /* NOTE: glibc devs are actually buffoons who never write any real code */ - if (is_unix) cmd_append(a, &result, "-D_GNU_SOURCE"); - /* NOTE: ancient gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80454 */ if (is_gcc) cmd_append(a, &result, "-Wno-missing-braces"); @@ -2876,8 +2873,6 @@ read_only global s8 c_file_header = s8_comp("" function b32 metagen_emit_c_code(MetaContext *ctx, Arena arena) { - b32 result = 1; - os_make_directory("generated"); char *out_meta = "generated" OS_PATH_SEPARATOR "beamformer.meta.c"; char *out_shaders = "generated" OS_PATH_SEPARATOR "beamformer_shaders.c"; @@ -2888,6 +2883,8 @@ metagen_emit_c_code(MetaContext *ctx, Arena arena) build_fatal("Failed to generate C Code"); } + b32 result = 1; + //////////////////////////// // NOTE(rnp): shader baking { diff --git a/util.h b/util.h @@ -2,11 +2,19 @@ #ifndef _UTIL_H_ #define _UTIL_H_ +#include "compiler.h" + +/* NOTE: glibc devs are actually buffoons who never write any real code + * the following headers include a bunch of other headers which need this crap defined first */ +#if OS_LINUX + #ifndef _GNU_SOURCE + #define _GNU_SOURCE + #endif +#endif + #include <stddef.h> #include <stdint.h> -#include "compiler.h" - #ifndef asm #define asm __asm__ #endif