diff --git a/build/GNUbasemsvc.mk b/build/GNUbasemsvc.mk new file mode 100644 index 00000000..e8ceb912 --- /dev/null +++ b/build/GNUbasemsvc.mk @@ -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 $@ diff --git a/build/GNUmakefile.libui b/build/GNUmakefile.libui index e833b566..936fc2b6 100644 --- a/build/GNUmakefile.libui +++ b/build/GNUmakefile.libui @@ -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 diff --git a/oldbuild/GNUmakefile.msvc b/oldbuild/GNUmakefile.msvc deleted file mode 100644 index e1840e8d..00000000 --- a/oldbuild/GNUmakefile.msvc +++ /dev/null @@ -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 $@ diff --git a/oldbuild/windows/GNUmakeinc.mk b/windows/GNUfiles.mk similarity index 70% rename from oldbuild/windows/GNUmakeinc.mk rename to windows/GNUfiles.mk index 2831728d..1854b718 100644 --- a/oldbuild/windows/GNUmakeinc.mk +++ b/windows/GNUfiles.mk @@ -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 diff --git a/oldbuild/windows/GNUosspecific.mk b/windows/GNUosspecific.mk similarity index 80% rename from oldbuild/windows/GNUosspecific.mk rename to windows/GNUosspecific.mk index 0896fc42..ae31a330 100644 --- a/oldbuild/windows/GNUosspecific.mk +++ b/windows/GNUosspecific.mk @@ -3,3 +3,4 @@ EXESUFFIX = .exe LIBSUFFIX = .dll OSHSUFFIX = .h +TOOLCHAIN = msvc diff --git a/windows/area.c b/windows/area.c index f1084d04..de401586 100644 --- a/windows/area.c +++ b/windows/area.c @@ -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;