From 36b84e2ee732e60fcb76ad5009ac168940515281 Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Fri, 10 Oct 2025 10:17:30 +0000 Subject: [PATCH] watcom git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@249 b9cfdab3-6d41-4d17-bbe4-086880011989 --- GNUmakefile | 3 ++- examples/glclock.c | 2 -- include/Mw/Core.h | 2 +- include/Mw/Widget/OpenGL.h | 11 +++++++++++ src/widget/opengl.c | 7 ------- tools/watcom.pl | 35 +++++++++++++++++++++++++++++++++++ 6 files changed, 49 insertions(+), 11 deletions(-) create mode 100755 tools/watcom.pl diff --git a/GNUmakefile b/GNUmakefile index 097692f..6a7704b 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -106,6 +106,7 @@ endif ifeq ($(WINDOWS),1) L_CFLAGS += -DUSE_GDI L_LDFLAGS += -Wl,--out-implib,src/libMw.a -static-libgcc +OOL_LDFLAGS += -Wl,--out-implib,oosrc/libMwOO.a -static-libgcc L_OBJS += src/backend/gdi.o L_LIBS += -lgdi32 @@ -183,4 +184,4 @@ examples/%.o: examples/%.c $(CC) $(E_CFLAGS) -c -o $@ $< clean: - rm -f */*.dll */*.so */*.a */*.o */*/*.o external/*/src/*.o examples/*.exe $(EXAMPLES) examples/opengl examples/vulkan + rm -f */*.dll */*.so */*.lib */*.a */*.o */*/*.o external/*/src/*.o examples/*.exe $(EXAMPLES) examples/opengl examples/vulkan diff --git a/examples/glclock.c b/examples/glclock.c index 4b56f32..6c27d86 100644 --- a/examples/glclock.c +++ b/examples/glclock.c @@ -4,8 +4,6 @@ #include -#include - MwWidget window, opengl, ldate, ltime; time_t last = 0; struct tm* tm; diff --git a/include/Mw/Core.h b/include/Mw/Core.h index 9768951..0b07c78 100644 --- a/include/Mw/Core.h +++ b/include/Mw/Core.h @@ -36,7 +36,7 @@ * %param name Property name */ #define MwDispatch3(x, y, name) \ - ((x->widget_class != NULL && x->widget_class->y != NULL) ? x->widget_class->y(x, name) : 0) + if(x->widget_class != NULL && x->widget_class->y != NULL) x->widget_class->y(x, name) #define MwWaitMS 5 diff --git a/include/Mw/Widget/OpenGL.h b/include/Mw/Widget/OpenGL.h index f22a43c..ee892f8 100644 --- a/include/Mw/Widget/OpenGL.h +++ b/include/Mw/Widget/OpenGL.h @@ -9,6 +9,17 @@ #include #include +#ifdef _WIN32 +#include +#else +#include +#endif +#include + +#ifndef GLAPIENTRY +#define GLAPIENTRY APIENTRY +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/src/widget/opengl.c b/src/widget/opengl.c index fccb46e..5a18ff5 100644 --- a/src/widget/opengl.c +++ b/src/widget/opengl.c @@ -2,13 +2,6 @@ #include #include -#ifdef _WIN32 -/* nothing */ -#else -#include -#endif -#include - typedef void(GLAPIENTRY* MWglColor3f)(GLfloat red, GLfloat green, GLfloat blue); #ifdef _WIN32 typedef HGLRC(WINAPI* MWwglCreateContext)(HDC); diff --git a/tools/watcom.pl b/tools/watcom.pl new file mode 100755 index 0000000..fc226f6 --- /dev/null +++ b/tools/watcom.pl @@ -0,0 +1,35 @@ +#!/usr/bin/env perl +# $Id$ + +my $target = "nt"; +my @cmd = (); +push(@cmd, "-I$ENV{WATCOM}/h"); +push(@cmd, "-I$ENV{WATCOM}/h/nt"); +push(@cmd, "-DSTBI_NO_SIMD"); +foreach my $f (@ARGV){ + if($f eq "-static-libgcc"){ + next; + }elsif($f =~ /^-Wl,--out-implib,(.+)$/){ + push(@cmd, "-Wl,option implib=$1"); + next; + }elsif($f =~ /^-W.+$/){ + next; + }elsif($f =~ /^-L(.+)$/){ + push(@cmd, "-Wl,libpath $1"); + next; + }elsif($f eq "-lMw"){ + push(@cmd, "-lMw"); + next; + }elsif($f =~ /^-l(.+)$/){ + push(@cmd, "$1.lib"); + next; + }elsif($f =~ /^(?:oo)?src\//){ + $target = "nt_dll"; + } + push(@cmd, $f); +} + +unshift(@cmd, "-b$target"); + +print("Running: owcc " . join(" ", @cmd) . "\n"); +exec("owcc", @cmd);