ogl_beamforming

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

Commit: 360ffed25c216cc3beab6ddc67a25782bf8140e8
Parent: 0598a1525477862827cf97f6f1a708d34dfa6574
Author: Randy Palamar
Date:   Tue, 30 Dec 2025 15:40:51 -0700

add some code to allow building w32 application on linux

Since we define our own windows prototypes/structures we don't
actually need to windows headers to build the application. With
some help the application can be compiled on linux to make sure
any refactoring doesn't break the build. With these changes the
application can be built but will fail to link.

Note: '-fms-extensions' can be used on linux as well, and some of
the extensions are actually useful (Linux kernel is now using
them), so there is no harm on having it enabled by default.

Diffstat:
Mbuild.c | 2+-
Mmain_w32.c | 12++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/build.c b/build.c @@ -531,7 +531,7 @@ cmd_base(Arena *a, Options *o) /* NOTE: ancient gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80454 */ if (is_gcc) cmd_append(a, &result, "-Wno-missing-braces"); - if (is_w32 && is_clang) cmd_append(a, &result, "-fms-extensions"); + if (!is_msvc) cmd_append(a, &result, "-fms-extensions"); if (o->debug && is_unix) cmd_append(a, &result, "-gdwarf-4"); diff --git a/main_w32.c b/main_w32.c @@ -1,6 +1,18 @@ /* See LICENSE for license details. */ #include "compiler.h" +// NOTE(rnp): for test compilations on linux (we don't use headers from windows) */ +#if OS_LINUX + #undef OS_WINDOWS + #undef OS_LINUX + #undef __declspec + #undef __stdcall + #define OS_WINDOWS 1 + #define OS_LINUX 0 + #define __declspec(x) + #define __stdcall +#endif + #if !OS_WINDOWS #error This file is only meant to be compiled for Win32 #endif