From acbeb86c7ff70a69f159273a63b607802b9599e2 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 4 Jun 2016 18:52:40 -0400 Subject: [PATCH] Pruned out and merged in th erest of the migrate_build files. --- CMakeLists.txt | 18 ++++++- migrate_build/build/GNUbasegcc.mk | 53 --------------------- migrate_build/build/GNUmakefile.example | 62 ------------------------ migrate_build/build/GNUmakefile.libui | 50 -------------------- migrate_build/build/GNUmakefile.test | 49 ------------------- migrate_build/darwin/GNUfiles.mk | 4 -- migrate_build/unix/GNUfiles.mk | 63 ------------------------- 7 files changed, 16 insertions(+), 283 deletions(-) delete mode 100644 migrate_build/build/GNUbasegcc.mk delete mode 100644 migrate_build/build/GNUmakefile.example delete mode 100644 migrate_build/build/GNUmakefile.libui delete mode 100644 migrate_build/build/GNUmakefile.test delete mode 100644 migrate_build/darwin/GNUfiles.mk delete mode 100644 migrate_build/unix/GNUfiles.mk diff --git a/CMakeLists.txt b/CMakeLists.txt index e1d4171e..4ad81045 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,15 +138,29 @@ if(BUILD_SHARED_LIBS) endif() if(NOT BUILD_SHARED_LIBS) _handle_static() - # TODO this really should be PRIVATE but I haven't fully figured this out + # TODO figure out a way to tell libui that it's static target_compile_definitions(${_LIBUINAME} - PUBLIC _UI_STATIC) + PUBLIC _UI_STATIC) endif() if(NOT MSVC) # on non-MSVC compilers cmake adds an extra lib- # note that we apply this to libui, not to any intermediates set_target_properties(libui PROPERTIES OUTPUT_NAME ui) + + # flags for warning on undefined symbols + # TODO figure out why FreeBSD follows linked libraries here + # TODO figure out MSVC equivalents + if(BUILD_SHARED_LIBS) + if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD)) + # on OS X we don't need to do this; Apple's linker warns about undefined symbols in -shared builds! + if(NOT APPLE) + target_link_libraries(libui + PRIVATE -Wl,--no-undefined -Wl,--no-allow-shlib-undefined + ) + endif() + endif() + endif() endif() if(BUILD_SHARED_LIBS) if(_HASVERSION) diff --git a/migrate_build/build/GNUbasegcc.mk b/migrate_build/build/GNUbasegcc.mk deleted file mode 100644 index 6e834d15..00000000 --- a/migrate_build/build/GNUbasegcc.mk +++ /dev/null @@ -1,53 +0,0 @@ -# 16 october 2015 - -# Global flags. - -CFLAGS += \ - --std=c99 - -CXXFLAGS += \ - --std=c++11 - -# Build rules. - -OFILES = \ - $(subst /,_,$(CFILES)) \ - $(subst /,_,$(CXXFILES)) \ - $(subst /,_,$(MFILES)) \ - $(subst /,_,$(RCFILES)) - -OFILES := $(OFILES:%=$(OBJDIR)/%.o) - -OUT = $(OUTDIR)/$(NAME)$(SUFFIX) -OUTNOSONAME = $(OUTDIR)/$(NAME)$(LIBSUFFIX) - -# TODO allow using LD -# LD is defined by default so we need a way to override the default define without blocking a user define -ifeq ($(CXXFILES),) - reallinker = $(CC) -else - reallinker = $(CXX) -endif - -include $(OS)/GNUosspecificlink.mk - -.SECONDEXPANSION: - -$(OBJDIR)/%.c.o: $$(subst _,/,%).c $(HFILES) | $(OBJDIR) - @$(CC) -o $@ -c $< $(CFLAGS) - @echo ====== Compiled $< - -$(OBJDIR)/%.cpp.o: $$(subst _,/,%).cpp $(HFILES) | $(OBJDIR) - @$(CXX) -o $@ -c $< $(CXXFLAGS) - @echo ====== Compiled $< - -$(OBJDIR)/%.m.o: $$(subst _,/,%).m $(HFILES) | $(OBJDIR) - @$(CC) -o $@ -c $< $(CFLAGS) - @echo ====== Compiled $< - -$(OBJDIR)/%.rc.o: $$(subst _,/,%).rc $(HFILES) | $(OBJDIR) - @$(RC) $(RCFLAGS) $< $@ - @echo ====== Compiled $< - -$(OBJDIR) $(OUTDIR): - @mkdir -p $@ diff --git a/migrate_build/build/GNUmakefile.example b/migrate_build/build/GNUmakefile.example deleted file mode 100644 index 83932910..00000000 --- a/migrate_build/build/GNUmakefile.example +++ /dev/null @@ -1,62 +0,0 @@ -# 16 october 2015 - -ifndef inlibuibuild -$(error Do not run these makefiles directly.) -endif -ifndef EXAMPLE -$(error You must specify an example to build by adding EXAMPLE=name to the command line.) -endif - -include $(OS)/GNUosspecific.mk - -ifneq ($(findstring cpp-,$(EXAMPLE)),) -CXXFILES += \ - examples/$(EXAMPLE)/main.cpp -else -CFILES += \ - examples/$(EXAMPLE)/main.c -endif - -HFILES += \ - ui.h - -ifeq ($(OS),windows) -RCFILES += \ - examples/resources.rc -ifneq (,$(STATIC)) -RCFLAGS += -D _UI_STATIC -endif -endif - -NAME = $(EXAMPLE) -SUFFIX = $(EXESUFFIX) - -# TODO merge with the one in build/GNUmakefile.test -ifeq ($(TOOLCHAIN),gcc) - ifeq (,$(STATIC)) - LDFLAGS += -L$(OUTDIR) -lui - else - LDFLAGS += -L$(OUTDIR) -lui $(NATIVE_UI_LDFLAGS) - endif - # see build/GNUmakefile.test - ifeq ($(OS),darwin) - LDFLAGS += -Wl,-rpath,@executable_path/ - else - LDFLAGS += -Wl,-rpath,'$$ORIGIN' - endif - ifneq ($(findstring cpp-,$(EXAMPLE)),) - LDFLAGS += -pthread - endif -else - ifeq (,$(STATIC)) - # TODO is there an equivalent to -L? - LDFLAGS += $(OUTDIR)/libui.lib - else - LDFLAGS += $(OUTDIR)/libui.lib $(OUTDIR)/libui.res $(OUTDIR)/$(NAME).res $(NATIVE_UI_LDFLAGS) - endif -endif - -# executables are not shared libraries -USESSONAME = 0 - -include build/GNUbase$(TOOLCHAIN).mk diff --git a/migrate_build/build/GNUmakefile.libui b/migrate_build/build/GNUmakefile.libui deleted file mode 100644 index c4ac54d3..00000000 --- a/migrate_build/build/GNUmakefile.libui +++ /dev/null @@ -1,50 +0,0 @@ -# 16 october 2015 - -ifndef inlibuibuild -$(error Do not run these makefiles directly.) -endif - -# for GCC -SOVERSION0 = 0 -SOVERSIONA = A - -include $(OS)/GNUosspecific.mk -include common/GNUfiles.mk -include $(OS)/GNUfiles.mk - -HFILES += \ - ui.h \ - ui_$(OS)$(OSHSUFFIX) - -NAME = libui -ifeq (,$(STATIC)) -SUFFIX = $(LIBSUFFIX) -ifeq ($(USESSONAME),1) - SUFFIX = $(SONAMEEXT) -endif -else -SUFFIX = $(STATICLIBSUFFIX) -endif - -ifeq ($(TOOLCHAIN),gcc) - - LDFLAGS += \ - -fvisibility=hidden -else - # TODO autogenerate a .def file? -endif - -ifeq ($(RELEASE),1) - CFLAGS += -D_UI_RELEASE - CXXFLAGS += -D_UI_RELEASE -endif - -ifeq ($(USESSONAME),1) - LDFLAGS += $(SONAMEFLAG)$(NAME)$(SUFFIX) -endif - -include build/GNUbase$(TOOLCHAIN).mk - -# install rule is OS specific -# TODO probably better off making it a toolchain-wide rule -include $(OS)/GNUinstall.mk diff --git a/migrate_build/build/GNUmakefile.test b/migrate_build/build/GNUmakefile.test deleted file mode 100644 index 9e123977..00000000 --- a/migrate_build/build/GNUmakefile.test +++ /dev/null @@ -1,49 +0,0 @@ -# 16 october 2015 - -ifndef inlibuibuild -$(error Do not run these makefiles directly.) -endif - -include $(OS)/GNUosspecific.mk -include test/GNUfiles.mk - -HFILES += \ - ui.h - -NAME = test -SUFFIX = $(EXESUFFIX) - -ifeq ($(OS),windows) -ifneq (,$(STATIC)) -RCFLAGS += -D _UI_STATIC -endif -endif - -ifeq ($(TOOLCHAIN),gcc) - ifeq (,$(STATIC)) - LDFLAGS += -L$(OUTDIR) -lui - else - LDFLAGS += -L$(OUTDIR) -lui $(NATIVE_UI_LDFLAGS) - endif - # tell the dynamic loader to search in the executable path for shared objects - # note: OS X's linker complains if we say -rpath= instead of -rpath, - # also note that OS X doesn't use $ORIGIN - see http://jorgen.tjer.no/post/2014/05/20/dt-rpath-ld-and-at-rpath-dyld/ - # the extra slash is needed on OS X 10.7; have it around just to be correct - ifeq ($(OS),darwin) - LDFLAGS += -Wl,-rpath,@executable_path/ - else - LDFLAGS += -Wl,-rpath,'$$ORIGIN' - endif -else - ifeq (,$(STATIC)) - # TODO is there an equivalent to -L? - LDFLAGS += $(OUTDIR)/libui.lib - else - LDFLAGS += $(OUTDIR)/libui.lib $(OUTDIR)/libui.res $(OUTDIR)/$(NAME).res $(NATIVE_UI_LDFLAGS) - endif -endif - -# executables are not shared libraries -USESSONAME = 0 - -include build/GNUbase$(TOOLCHAIN).mk diff --git a/migrate_build/darwin/GNUfiles.mk b/migrate_build/darwin/GNUfiles.mk deleted file mode 100644 index 48c19c7e..00000000 --- a/migrate_build/darwin/GNUfiles.mk +++ /dev/null @@ -1,4 +0,0 @@ - -# on warning about undefined symbols: -# the gcc flags don't work with Apple's linker -# fortunately, we don't need any; Apple's linker warns about undefined symbols in -shared builds! diff --git a/migrate_build/unix/GNUfiles.mk b/migrate_build/unix/GNUfiles.mk deleted file mode 100644 index adc345ec..00000000 --- a/migrate_build/unix/GNUfiles.mk +++ /dev/null @@ -1,63 +0,0 @@ -# 22 april 2015 - -CFILES += \ - unix/alloc.c \ - unix/area.c \ - unix/box.c \ - unix/button.c \ - unix/checkbox.c \ - unix/child.c \ - unix/colorbutton.c \ - unix/combobox.c \ - unix/control.c \ - unix/datetimepicker.c \ - unix/debug.c \ - unix/draw.c \ - unix/drawmatrix.c \ - unix/drawpath.c \ - unix/drawtext.c \ - unix/editablecombo.c \ - unix/entry.c \ - unix/fontbutton.c \ - unix/graphemes.c \ - unix/group.c \ - unix/label.c \ - unix/main.c \ - unix/menu.c \ - unix/multilineentry.c \ - unix/progressbar.c \ - unix/radiobuttons.c \ - unix/separator.c \ - unix/slider.c \ - unix/spinbox.c \ - unix/stddialogs.c \ - unix/tab.c \ - unix/text.c \ - unix/util.c \ - unix/window.c - -HFILES += \ - unix/draw.h \ - unix/uipriv_unix.h - -# LONGTERM split into a separate file or put in GNUmakefile.libui somehow? - -# flags for GTK+ -CFLAGS += $(NATIVE_UI_CFLAGS) -CXXFLAGS += $(NATIVE_UI_CXXFLAGS) -LDFLAGS += $(NATIVE_UI_LDFLAGS) - -# flags for building a shared library -# OS X does support -shared but it has a preferred name for this so let's use that there instead; hence this is not gcc-global -ifeq (,$(STATIC)) -LDFLAGS += \ - -shared -endif - -# flags for warning on undefined symbols -# this is not gcc-global because OS X doesn't support these flags -# TODO figure out why FreeBSD follows linked libraries here -ifneq ($(shell uname -s),FreeBSD) -LDFLAGS += \ - -Wl,--no-undefined -Wl,--no-allow-shlib-undefined -endif