Tried to set up Windows static linking.

This commit is contained in:
Pietro Gagliardi 2016-05-29 12:00:55 -04:00
parent 52917c7e71
commit e114502605
7 changed files with 24 additions and 8 deletions

View File

@ -23,7 +23,7 @@ This README is being written.<br>
*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**.

View File

@ -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):

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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