]> granicus.if.org Git - nethack/commitdiff
build with Qt6 support on Linux
authornhmall <nhmall@nethack.org>
Thu, 13 Jan 2022 19:09:41 +0000 (14:09 -0500)
committernhmall <nhmall@nethack.org>
Thu, 13 Jan 2022 19:09:41 +0000 (14:09 -0500)
sys/unix/hints/include/compiler.370
sys/unix/hints/linux.370

index 533fd521099301fb27747d4266c241071b9fd5d5..719bb7a94ca1ec2a529b2f3ad895d0db54cb81ad 100755 (executable)
@@ -26,10 +26,18 @@ CCFLAGS = -g
 #detection
 CCISCLANG := $(shell echo `$(CC) --version` | grep clang)
 ifeq "$(CCISCLANG)" ""
+ifdef WANT_WIN_QT6
+CXX=g++ -std=c++17
+else
 CXX=g++ -std=gnu++11
+endif
+else
+ifdef WANT_WIN_QT6
+CXX=clang++ -std=c++17
 else
 CXX=clang++ -std=gnu++11
 endif
+endif   # clang
 
 # If you want to override the compiler detection just carried out
 # uncomment one of the following pairs. Note, however, that
index 233ca6dff9472dcb5fd20e1157459d5da1eb2212..5990a3d89240d720807835c87fe59e1ded7410ff 100755 (executable)
@@ -49,9 +49,10 @@ endif   # not WANT_WIN_QT5
 ifdef WANT_WIN_QT5
 QTDIR=/usr
 endif  # WANT_WIN_QT5
-#ifdef WANT_WIN_QT6
-#QTDIR=/usr
-#endif   # WANT_WIN_QT6
+ifdef WANT_WIN_QT6
+#if your Qt6 is elsewhere, change this to match
+QTDIR=/usr/local/qt6
+endif   # WANT_WIN_QT6
 endif  # WANT_WIN_QT
 
 ifndef LIBXPM
@@ -139,19 +140,51 @@ LFLAGS=-L/opt/X11/lib
 endif  # WANT_WIN_X11
 
 ifdef WANT_WIN_QT
-# Qt5 requires C++11
+# Qt requires C++11
+ifdef WANT_WIN_QT5
 LINK = $(CXX)
 QTCXXFLAGS += $(sort $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags))
-QTCXXFLAGS += -fPIC
 WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs)
-VARDATND0 += nhtiles.bmp rip.xpm nhsplash.xpm
-# XXX if /Developer/qt exists and QTDIR not set, use that
+endif   # WANT_WIN_QT5
+ifdef WANT_WIN_QT6
+# As of January 2022 there was no Qt6 package was available.
+ifndef QT_PACKAGE_AVAILABLE
+# Try some likely spots for a self-built Qt6.
+# You'll have to change these manually before using the hints file
+# if they don't match the installed location on your system.
+ifneq ($(wildcard /usr/local/Qt6/*),)
+QTDIR=/usr/local/Qt6
+QTLOCATED=1
+endif
+ifneq ($(wildcard /usr/local/qt6/*),)
+QTDIR=/usr/local/qt6
+QTLOCATED=1
+endif
+ifdef QTLOCATED
+QTCXXFLAGS += -I$(QTDIR)/include/QtCore
+QTCXXFLAGS += -I$(QTDIR)/include/QtGui
+QTCXXFLAGS += -I$(QTDIR)/include/QtMultimedia
+QTCXXFLAGS += -I$(QTDIR)/include/QtWidgets
+MOCPATH = $(QTDIR)/libexec/moc
+endif
+else   # QT_PACKAGE_AVAILABLE
+$(error error is inside package)
+LINK = $(CXX)
+QTCXXFLAGS += $(sort $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt6Gui Qt6Widgets Qt6Multimedia --cflags))
+WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt6Gui Qt6Widgets Qt6Multimedia --libs)
+endif   # WANT_WIN_QT6
+else    # QT_PACKAGE_AVAILABLE
+$(error error QT_PACKAGE_AVAILABLE)
+endif   # QT_PACKAGE_AVAILABLE
 ifndef QTDIR
 $(error QTDIR not defined in the environment or Makefile)
 endif  # QTDIR
+# XXX if /Developer/qt exists and QTDIR not set, use that
 # XXX make sure QTDIR points to something reasonable
+QTCXXFLAGS += -fPIC
 POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; \
                ( cd $(INSTDIR); mkfontdir -x .lev );
+VARDATND0 += nhtiles.bmp rip.xpm nhsplash.xpm
 else
 LINK = $(CC)
 endif  # !WANT_WIN_QT