]> granicus.if.org Git - nethack/commitdiff
some Qt6 Makefile tinkering
authornhmall <nhmall@nethack.org>
Sun, 12 Jun 2022 15:59:34 +0000 (11:59 -0400)
committernhmall <nhmall@nethack.org>
Sun, 12 Jun 2022 15:59:34 +0000 (11:59 -0400)
Adjust for a package available on ubuntu jammy jellyfish 22.04 LTS,
but one that doesn't seem to follow the norm.

sys/unix/hints/include/compiler.370
sys/unix/hints/linux.370

index 36bf438ccf98538451783a5c28faef90f2a2cb61..4f091b53696cc2ef2b5788b3712afc34e7787ebb 100755 (executable)
@@ -80,6 +80,7 @@ CCXXFLAGS+= -Wno-deprecated-copy
 endif  # WANT_WIN_QT
 # get the version of gcc
 GCCGTEQ9 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 9)
+GCCGTEQ12 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 12)
 ifeq "$(GCCGTEQ9)" "1"
 # flags present in gcc version greater than or equal to 9 can go here
 CFLAGS+=-Wformat-overflow
@@ -87,6 +88,7 @@ endif  #gcc version greater than or equal to 9
 #still in gcc-specific section here
 # get the version of g++
 GPPGTEQ9 := $(shell expr `$(CXX) -dumpversion | cut -f1 -d.` \>= 9)
+GPPGTEQ12 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 12)
 ifeq "$(GPPGTEQ9)" "1"
 CCXXFLAGS+=-Wformat-overflow
 ifdef WANT_WIN_QT
@@ -94,6 +96,11 @@ CCXXFLAGS+=-Wno-deprecated-copy
 CCXXFLAGS+=-Wno-deprecated-declarations
 endif  # WANT_WIN_QT
 endif  # g++ version greater than or equal to 9
+ifeq "$(GPPGTEQ12)" "1"
+ifdef WANT_WIN_QT6
+CXX=g++ -std=c++20
+endif
+endif  # g++ version greater than or equal to 12
 # end of gcc-specific
 
 else   # clang-specific follows
index 913945cd55aaf1f962a77645ab6b6ca28f166852..fe81cc7c0ff50f02897e84044800f2cd7b5f242c 100755 (executable)
@@ -197,21 +197,38 @@ LINK = $(CXX)
 ifdef WANT_WIN_QT5
 QTCXXFLAGS += $(sort $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags))
 WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs)
-endif   # WANT_WIN_QT5
+endif    # WANT_WIN_QT5
 ifdef WANT_WIN_QT6
-# As of January 2022 there was no Qt6 package 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 "$(HOSTTYPE)" ""
+QTHOST=$(HOSTTYPE)
+else
+QTHOST=x86_64
+endif
+QTTOP=/usr/include/$(HOSTTYPE)-linux-gnu/qt6
+ifneq ($(wildcard $(QTTOP)/*),)
+#we don't set QTLOCATED=1 for this
+QTINCDIR=/usr/include/$(QTHOST)-linux-gnu/qt6
+QTLIBDIR=/usr/lib/$(QTHOST)-linux.gnu
+QTCXXFLAGS += -DQT_WIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB
+QTCXXFLAGS += -I$(QTINCDIR)/QtWidgets -I$(QTINCDIR) -I$(QTINCDIR)/QtMultimedia
+QTCXXFLAGS += -I$(QTINCDIR)/QtNetwork -I$(QTINCDIR)/QtGui -I$(QTINCDIR)/QtCore
+WINLIB += -L$(QTLIBDIR) -lQt6Widgets -lQt6Multimedia -lQt6Network -lQt6Gui -lQt6Core
+MOCPATH = /usr/lib/qt6/libexec/moc
+#/usr/lib/x86_64-linux-gnu/libQt6EglFSDeviceIntegration.so
+endif
+ifndef QTINCDIR
 ifneq ($(wildcard /usr/local/Qt6/*),)
 QTDIR=/usr/local/Qt6
 QTLOCATED=1
-endif
+endif    # wildcard /usr/local/Qt6
 ifneq ($(wildcard /usr/local/qt6/*),)
 QTDIR=/usr/local/qt6
 QTLOCATED=1
-endif
+endif    # wildcard /usr/local/qt6
+endif    # !QTINCDIR
 ifdef QTLOCATED
 QTCXXFLAGS += -I$(QTDIR)/include/QtCore
 QTCXXFLAGS += -I$(QTDIR)/include/QtGui
@@ -219,13 +236,8 @@ QTCXXFLAGS += -I$(QTDIR)/include/QtMultimedia
 QTCXXFLAGS += -I$(QTDIR)/include/QtWidgets
 MOCPATH = $(QTDIR)/libexec/moc
 WINLIB += -L$(QTDIR)/lib -lQt6Widgets -lQt6Multimedia -lQt6Network -lQt6Gui -lQt6Core
-endif
-else   # QT_PACKAGE_AVAILABLE
-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
-endif   # QT_PACKAGE_AVAILABLE
+endif   # QTLOCATED
+endif   # !QTINCDIR
 ifndef QTDIR
 $(error QTDIR not defined in the environment or Makefile)
 endif  # QTDIR
@@ -235,7 +247,7 @@ QTCXXFLAGS += -fPIC
 POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; \
                ( cd $(INSTDIR); mkfontdir -x .lev );
 VARDATND0 += nhtiles.bmp rip.xpm nhsplash.xpm
-else
+else    # WANT_WIN_QT
 LINK = $(CC)
 endif  # !WANT_WIN_QT