qt version selection during configure

qt6port
John Tsiombikas 2024-01-01 01:26:03 +02:00
rodzic 1850554b75
commit 0d8a0289a7
2 zmienionych plików z 33 dodań i 3 usunięć

Wyświetl plik

@ -17,10 +17,9 @@ incpath = -I. -I$(PREFIX)/include
libpath = -L$(PREFIX)/lib
CFLAGS = $(warn) $(dbg) $(opt) $(incpath) -fPIC $(add_cflags) -MMD
CXXFLAGS = -std=c++11 $(warn) $(dbg) $(opt) $(incpath) -fPIC `pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets` \
CXXFLAGS = $(cxxstd) $(warn) $(dbg) $(opt) $(incpath) -fPIC $(qt_cflags) \
$(add_cflags) -MMD
LDFLAGS = $(libpath) `pkg-config --libs Qt5Core Qt5Gui Qt5Widgets` -lspnav -lX11 \
$(add_ldflags)
LDFLAGS = $(libpath) $(qt_libs) -lspnav -lX11 $(add_ldflags)
$(bin): $(obj)
$(CXX) -o $@ $(obj) $(LDFLAGS)

31
configure vendored
Wyświetl plik

@ -38,6 +38,33 @@ for arg; do
esac
done
detect_qt()
{
qt6libs='Qt6Core Qt6Gui Qt6Widgets'
qt5libs='Qt5Core Qt5Gui Qt5Widgets'
printf 'Detecting Qt libraries ... '
if pkg-config --cflags $qt6libs >/dev/null 2>&1; then
echo 'found Qt6'
qt_cflags=`pkg-config --cflags $qt6libs`
qt_libs=`pkg-config --libs $qt6libs`
cxxstd='-std=c++17'
elif pkg-config --cflags $qt5libs >/dev/null 2>&1; then
echo 'found Qt5'
qt_cflags=`pkg-config --cflags $qt5libs`
qt_libs=`pkg-config --libs $qt5libs`
cxxstd='-std=c++11'
else
echo 'failed to find Qt5 or Qt6' >&2
exit 1
fi
}
detect_qt
echo
echo " prefix: $PREFIX"
echo " optimize for speed: $OPT"
echo " include debugging symbols: $DBG"
@ -55,6 +82,10 @@ if [ "$OPT" = 'yes' ]; then
echo 'opt = -O3' >>Makefile
fi
echo "qt_cflags = $qt_cflags" >>Makefile
echo "qt_libs = $qt_libs" >>Makefile
echo "cxxstd = $cxxstd" >>Makefile
if [ -n "$CFLAGS" ]; then
echo "add_cflags = $CFLAGS" >>Makefile
fi