diff --git a/README.md b/README.md index f8bf6838..aab21e47 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ This README is being written.
*Note that today's entry may be updated later today.* * **29 May 2016** - * Thanks to @pcwalton, we can now statically link libui! Simply do `make STATIC=1` instead of just `make`. + * Thanks to @pcwalton, we can now statically link libui! Simply do `make STATIC=1` instead of just `make`. Right now it only works on GTK+ and OS X. * **28 May 2016** * As promised, **the minimum system requirements are now OS X 10.8 and GTK+ 3.10 for OS X and Unix, respectively**. diff --git a/build/GNUbasemsvc.mk b/build/GNUbasemsvc.mk index 46703b87..0fc5daba 100644 --- a/build/GNUbasemsvc.mk +++ b/build/GNUbasemsvc.mk @@ -97,7 +97,7 @@ endif # note: don't run cvtres directly; the linker does that for us $(OBJDIR)/%.rc.o: $$(subst _,/,%).rc $(HFILES) | $(OBJDIR) - @rc -nologo -v -fo $@ $< + @rc -nologo -v -fo $@ $(RCFLAGS) $< @echo ====== Compiled $< $(OBJDIR) $(OUTDIR): diff --git a/build/GNUmakefile.example b/build/GNUmakefile.example index 2b9d4cbd..e4d14272 100644 --- a/build/GNUmakefile.example +++ b/build/GNUmakefile.example @@ -45,8 +45,12 @@ ifeq ($(TOOLCHAIN),gcc) LDFLAGS += -pthread endif else - # TODO is there an equivalent to -L? - LDFLAGS += $(OUTDIR)/libui.lib + ifeq (,$(STATIC)) + # TODO is there an equivalent to -L? + LDFLAGS += $(OUTDIR)/libui.lib + else + LDFLAGS += $(OUTDIR)/libui.lib $(NATIVE_UI_LDFLAGS) + endif endif # executables are not shared libraries diff --git a/windows/GNUfiles.mk b/windows/GNUfiles.mk index d9e992d2..0c3b50fa 100644 --- a/windows/GNUfiles.mk +++ b/windows/GNUfiles.mk @@ -67,10 +67,7 @@ RCFILES += \ # LONGTERM split into a separate file or put in GNUmakefile.libui somehow? # flags for the Windows API -# notice that usp10.lib comes before gdi32.lib -# TODO prune this list -LDFLAGS += \ - user32.lib kernel32.lib usp10.lib gdi32.lib comctl32.lib uxtheme.lib msimg32.lib comdlg32.lib d2d1.lib dwrite.lib ole32.lib oleaut32.lib oleacc.lib uuid.lib +LDFLAGS += $(NATIVE_UI_LDFLAGS) # flags for building a shared library ifeq (,$(STATIC)) @@ -83,3 +80,9 @@ endif # no need for a soname # TODO .def file + +ifneq (,$(STATIC)) +CFLAGS += -D_UI_STATIC +CXXFLAGS += -D_UI_STATIC +RCFLAGS += -D _UI_STATIC +endif diff --git a/windows/GNUosspecific.mk b/windows/GNUosspecific.mk index c8335d66..b074e06a 100644 --- a/windows/GNUosspecific.mk +++ b/windows/GNUosspecific.mk @@ -7,3 +7,8 @@ STATICLIBSUFFIX = .lib TOOLCHAIN = msvc USESSONAME = 0 + +# notice that usp10.lib comes before gdi32.lib +# TODO prune this list +NATIVE_UI_LDFLAGS = \ + user32.lib kernel32.lib usp10.lib gdi32.lib comctl32.lib uxtheme.lib msimg32.lib comdlg32.lib d2d1.lib dwrite.lib ole32.lib oleaut32.lib oleacc.lib uuid.lib diff --git a/windows/resources.rc b/windows/resources.rc index a0acfcbd..dc60b5e0 100644 --- a/windows/resources.rc +++ b/windows/resources.rc @@ -7,7 +7,9 @@ // this is the Common Controls 6 manifest // TODO set up the string values here +#ifndef _UI_STATIC ISOLATIONAWARE_MANIFEST_RESOURCE_ID RT_MANIFEST "libui.manifest" +#endif // this is the dialog template used by tab pages; see windows/tabpage.c for details rcTabPageDialog DIALOGEX 0, 0, 100, 100 diff --git a/windows/winapi.hpp b/windows/winapi.hpp index 246760da..86aba5d7 100644 --- a/windows/winapi.hpp +++ b/windows/winapi.hpp @@ -9,7 +9,9 @@ #define INITGUID // for the manifest +#ifndef _UI_STATIC #define ISOLATION_AWARE_ENABLED 1 +#endif // get Windows version right; right now Windows Vista // unless otherwise stated, all values from Microsoft's sdkddkver.h