Reestablished the Windows build. Also fixed a small bug in windows/area.c. Now to re-establish the test!

This commit is contained in:
Pietro Gagliardi 2015-12-11 19:49:14 -05:00
parent 327abd04b0
commit e390730e6f
6 changed files with 101 additions and 129 deletions

82
build/GNUbasemsvc.mk Normal file
View File

@ -0,0 +1,82 @@
# 16 october 2015
# TODO subsystem version
# TODO silence compiler non-diagnostics (/nologo is not enough)
# Global flags.
# TODO /Wall does too much
# TODO -Wno-switch equivalent
# TODO /sdl turns C4996 into an ERROR
# TODO loads of warnings in the system header files
# TODO /analyze requires us to write annotations everywhere
# TODO undecided flags from qo?
CFLAGS += \
/W4 \
/wd4100 \
/TC \
/bigobj /nologo \
/RTC1 /RTCc /RTCs /RTCu
CXXFLAGS += \
/W4 \
/wd4100 \
/TP \
/bigobj /nologo \
/RTC1 /RTCc /RTCs /RTCu
# TODO warnings on undefined symbols
LDFLAGS += \
/largeaddressaware /nologo /incremental:no
ifneq ($(NODEBUG),1)
CFLAGS += /Zi
CXXFLAGS += /Zi
LDFLAGS += /debug
endif
# Build rules.
OFILES = \
$(subst /,_,$(CFILES)) \
$(subst /,_,$(CXXFILES)) \
$(subst /,_,$(MFILES)) \
$(subst /,_,$(RCFILES))
OFILES := $(OFILES:%=$(OBJDIR)/%.o)
OUT = $(OUTDIR)/$(NAME)$(SUFFIX)
# TODO use $(CC), $(CXX), $(LD), $(RC), and $(CVTRES)
$(OUT): $(OFILES) | $(OUTDIR)
@link /out:$(OUT) $(OFILES) $(LDFLAGS)
@echo ====== Linked $(OUT)
.SECONDEXPANSION:
# TODO can we put /Fd$@.pdb in a variable?
$(OBJDIR)/%.c.o: $$(subst _,/,%).c $(HFILES) | $(OBJDIR)
ifeq ($(NODEBUG),1)
@cl /Fo:$@ /c $< $(CFLAGS)
else
@cl /Fo:$@ /c $< $(CFLAGS) /Fd$@.pdb
endif
@echo ====== Compiled $<
$(OBJDIR)/%.cpp.o: $$(subst _,/,%).c $(HFILES) | $(OBJDIR)
ifeq ($(NODEBUG),1)
@cl /Fo:$@ /c $< $(CXXFLAGS)
else
@cl /Fo:$@ /c $< $(CXXFLAGS) /Fd$@.pdb
endif
@echo ====== Compiled $<
$(OBJDIR)/%.rc.o: $$(subst _,/,%).rc $(HFILES) | $(OBJDIR)
@rc /nologo /v /fo $@.res $<
@cvtres /nologo /out:$@ $@.res
@echo ====== Compiled $<
$(OBJDIR) $(OUTDIR):
@mkdir $@

View File

@ -30,7 +30,12 @@ ifeq ($(TOOLCHAIN),gcc)
LDFLAGS += \
-fvisibility=hidden
else
# TODO
# make every symbol hidden by default except _UI_EXTERN ones
# TODO autogenerate a .def file?
CFLAGS += \
/D "_UI_EXTERN=__declspec(dllexport) extern"
CXXFLAGS += \
/D "_UI_EXTERN=__declspec(dllexport) extern"
endif
include build/GNUbase$(TOOLCHAIN).mk

View File

@ -1,120 +0,0 @@
# 16 october 2015
# TODO merge into the main makefile
# TODO subsystem version
# TODO silence compiler non-diagnostics (/nologo is not enough)
OBJDIR = .obj
OUTDIR = out
NAME = libui
SUFFIX = .dll
HFILES += \
ui.h \
ui_windows.h
CFILES += \
common/areaevents.c \
common/control.c \
common/matrix.c \
common/menu.c \
common/ptrarray.c \
common/shouldquit.c \
common/types.c
HFILES += \
common/uipriv.h
CFILES += \
windows/alloc.c \
windows/area.c \
windows/box.c \
windows/button.c \
windows/checkbox.c \
windows/child.c \
windows/combobox.c \
windows/container.c \
windows/control.c \
windows/datetimepicker.c \
windows/debug.c \
windows/draw.c \
windows/entry.c \
windows/events.c \
windows/group.c \
windows/init.c \
windows/label.c \
windows/main.c \
windows/menu.c \
windows/multilineentry.c \
windows/parent.c \
windows/progressbar.c \
windows/radiobuttons.c \
windows/resize.c \
windows/separator.c \
windows/slider.c \
windows/spinbox.c \
windows/stddialogs.c \
windows/tab.c \
windows/tabpage.c \
windows/text.c \
windows/util.c \
windows/utilwin.c \
windows/window.c
HFILES += \
windows/compilerver.h \
windows/resources.h \
windows/uipriv_windows.h \
windows/winapi.h
RCFILES += \
windows/resources.rc
OFILES = \
$(subst /,_,$(CFILES)) \
$(subst /,_,$(RCFILES))
OFILES := $(OFILES:%=$(OBJDIR)/%.o)
# TODO /Wall does too much
# TODO -Wno-switch equivalent
# TODO /sdl turns C4996 into an ERROR
# TODO loads of warnings in the system header files
# TODO /analyze requires us to write annotations everywhere
CFLAGS += \
/Zi \
/W4 \
/wd4100 \
/TC \
/bigobj /nologo \
/RTC1 /RTCc /RTCs /RTCu \
/D "_UI_EXTERN=__declspec(dllexport) extern"
# TODO warnings on undefined symbols
LDFLAGS += \
/dll \
/debug \
/largeaddressaware /nologo /incremental:no \
user32.lib kernel32.lib gdi32.lib comctl32.lib uxtheme.lib msimg32.lib comdlg32.lib d2d1.lib ole32.lib oleaut32.lib oleacc.lib uuid.lib
OUT = $(OUTDIR)/$(NAME)$(SUFFIX)
$(OUT): $(OFILES) | $(OUTDIR)
@link /out:$(OUT) $(OFILES) $(LDFLAGS)
@echo ====== Linked $(OUT)
.SECONDEXPANSION:
$(OBJDIR)/%.c.o: $$(subst _,/,%).c $(HFILES) | $(OBJDIR)
@cl /Fo:$@ /c $< $(CFLAGS) /Fd$@.pdb
@echo ====== Compiled $<
$(OBJDIR)/%.rc.o: $$(subst _,/,%).rc $(HFILES) | $(OBJDIR)
@rc /nologo /v /fo $@.res $<
@cvtres /nologo /out:$@ $@.res
@echo ====== Compiled $<
$(OBJDIR) $(OUTDIR):
@mkdir $@

View File

@ -45,14 +45,18 @@ HFILES += \
RCFILES += \
windows/resources.rc
# thanks ebassi in irc.gimp.net/#gtk+
CFLAGS += \
-D_UI_EXTERN='__declspec(dllexport) extern'
# TODO split into a separate file or put in GNUmakefile.libui somehow?
# flags for the Windows API
LDFLAGS += \
-static-libgcc \
-luser32 -lkernel32 -lgdi32 -lcomctl32 -luxtheme -lmsimg32 -lcomdlg32 -ld2d1 -lole32 -loleaut32 -loleacc -luuid
user32.lib kernel32.lib gdi32.lib comctl32.lib uxtheme.lib msimg32.lib comdlg32.lib d2d1.lib ole32.lib oleaut32.lib oleacc.lib uuid.lib
# warnings on undefined symbols
# flags for building a shared library
LDFLAGS += \
-Wl,--no-undefined -Wl,--no-allow-shlib-undefined
/dll
# TODO flags for warning on undefined symbols
# no need for a soname
# TODO .def file

View File

@ -3,3 +3,4 @@
EXESUFFIX = .exe
LIBSUFFIX = .dll
OSHSUFFIX = .h
TOOLCHAIN = msvc

View File

@ -317,7 +317,7 @@ static void areaMouseEvent(uiArea *a, uintmax_t down, uintmax_t up, WPARAM wPar
me.X = (xpix * 96) / dpix;
me.Y = (ypix * 96) / dpiy;
rtGetSize((ID2D1RenderTarget *) (a->rt), &size);
size = ID2D1HwndRenderTarget_GetSize(a->rt);
me.ClientWidth = size.width;
me.ClientHeight = size.height;
me.HScrollPos = a->hscrollpos;