build with Qt6 support on Linux

This commit is contained in:
nhmall
2022-01-13 14:09:41 -05:00
parent 6fda779979
commit 53f3016b43
2 changed files with 48 additions and 7 deletions

View File

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

View File

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