From dcf5d7d68ec0dbd8516e164b606206f01c99745d Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 31 Jul 2020 14:30:55 -0700 Subject: [PATCH] Qt+X11 on OSX Using hints/macosx10.10-qt, | make QTDIR={path} WANT_WIN_X11=1 USE_XPM=1 now builds a combined tty+Qt+X11 binary. Linking the X11 code works a lot better when the Makefile tells the linker where the X11 libraries are.... This reconciles some of the differences between macosx10.10 and macosx10.10-qt but there are still lots more (including lack of WANT_WIN_CURSES in the latter). And now 10.10 has differences with the half dozen or so other macosx10.* hints. --- sys/unix/hints/macosx10.10 | 25 +++++++++++++++++++------ sys/unix/hints/macosx10.10-qt | 13 ++++++++++++- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/sys/unix/hints/macosx10.10 b/sys/unix/hints/macosx10.10 index 279a15ec3..f4c2989f0 100644 --- a/sys/unix/hints/macosx10.10 +++ b/sys/unix/hints/macosx10.10 @@ -1,5 +1,5 @@ # -# NetHack 3.6 macosx10.11 $NHDT-Date: 1566346603 2019/08/21 00:16:43 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.53 $ +# NetHack 3.6 macosx10.11 $NHDT-Date: 1596231041 2020/07/31 21:30:41 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.57 $ # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. # NetHack may be freely redistributed. See license for details. # @@ -59,6 +59,7 @@ GAMEGRP = games #WANT_SOURCE_INSTALL=1 CC=gcc +CXX=g++ # At the moment this is just for debugging, but in the future it could be # useful for other things. Requires SYSCF and an ANSI compiler. @@ -68,8 +69,23 @@ CC=gcc # You shouldn't need to change anything below here. # +ifdef WANT_WIN_QT +LINK = $(CXX) +else +LINK = $(CC) +endif + #CFLAGS+=-W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN -CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings -DGCC_WARN -ansi -pedantic -Wno-long-long +CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings -DGCC_WARN +ifndef WANT_WIN_QT +# these are normally used when compiling nethack's core +CFLAGS+=-ansi -pedantic -Wno-long-long +# but -ansi -pendantic forces C90 sematics and win/Qt/qt_*.cpp trigger +#In file included from .../qt5/include/QtCore/qglobal.h:105: +#.../qt5/include/QtCore/qcompilerdetection.h:561:6: +# error Qt requires a C++11 compiler and yours does not seem to be that. +# so we suppress them when the build includes Qt +endif # As of LLVM build 2336.1.00, this gives dozens of spurious messages, so # leave it out by default. #CFLAGS+=-Wunreachable-code @@ -110,9 +126,9 @@ WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11 VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm # -x: if built without dlb, some versions of mkfontdir think *.lev are fonts POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; ( cd $(HACKDIR); mkfontdir -x .lev ); +CFLAGS += -DX11_GRAPHICS # separate from CFLAGS so that we don't pass it to every file X11CFLAGS = -I/opt/X11/include -CFLAGS += -DX11_GRAPHICS # avoid repeated complaints about _X_NONNULL(args...) in X11CFLAGS += -Wno-variadic-macros ifdef USE_XPM @@ -129,7 +145,6 @@ endif # WANT_WIN_X11 ifdef WANT_WIN_QT CFLAGS += -DQT_GRAPHICS -DNOUSER_SOUNDS CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -LINK=g++ WINSRC += $(WINQTSRC) WINLIB += $(WINQTLIB) $(LIBXPM) WINLIB += -framework Carbon -framework QuickTime -lz -framework OpenGL @@ -149,8 +164,6 @@ ifndef QTDIR $(error QTDIR not defined in the environment or Makefile) endif # QTDIR # XXX make sure QTDIR points to something reasonable -else # !WANT_WIN_QT -LINK=$(CC) endif # !WANT_WIN_QT ifdef WANT_SHARE_INSTALL diff --git a/sys/unix/hints/macosx10.10-qt b/sys/unix/hints/macosx10.10-qt index c5cafa09a..25466cf4c 100644 --- a/sys/unix/hints/macosx10.10-qt +++ b/sys/unix/hints/macosx10.10-qt @@ -1,5 +1,5 @@ # -# NetHack 3.6 macosx10.10-qt $NHDT-Date: 1596115204 2020/07/30 13:20:04 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.60 $ +# NetHack 3.6 macosx10.10-qt $NHDT-Date: 1596231050 2020/07/31 21:30:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.61 $ # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. # NetHack may be freely redistributed. See license for details. # @@ -75,6 +75,15 @@ endif #CFLAGS+=-W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings -DGCC_WARN +ifndef WANT_WIN_QT +# these are normally used when compiling nethack's core +CFLAGS+=-ansi -pedantic -Wno-long-long +# but -ansi -pendantic forces C90 sematics and win/Qt/qt_*.cpp trigger +#In file included from .../qt5/include/QtCore/qglobal.h:105: +#.../qt5/include/QtCore/qcompilerdetection.h:561:6: +# error Qt requires a C++11 compiler and yours does not seem to be that. +# so we suppress them when the build includes Qt +endif # As of LLVM build 2336.1.00, this gives dozens of spurious messages, so # leave it out by default. #CFLAGS+=-Wunreachable-code @@ -109,7 +118,9 @@ CFLAGS += -DNOTTYGRAPHICS endif # !WANT_WIN_TTY ifdef WANT_WIN_X11 +WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11 VARDATND0 = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm +# -x: if built without dlb, some versions of mkfontdir think *.lev are fonts POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; ( cd $(HACKDIR); mkfontdir -x .lev ); CFLAGS += -DX11_GRAPHICS # separate from CFLAGS so that we don't pass it to every file