mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 02:00:41 +00:00
qb: Check for a Qt5 moc. (#8029)
This commit is contained in:
parent
dc6b148b17
commit
2860d6af08
2
.gitignore
vendored
2
.gitignore
vendored
@ -11,6 +11,8 @@
|
||||
.tmp
|
||||
.tmp.c
|
||||
.tmp.cxx
|
||||
.moc.h
|
||||
.moc.cpp
|
||||
config.log
|
||||
/.project
|
||||
/.externalToolBuilders/
|
||||
|
@ -277,7 +277,7 @@ check_val '' SDL2 -lSDL2 SDL2
|
||||
|
||||
check_enabled QT 'Qt companion'
|
||||
|
||||
if [ "$HAVE_QT" != 'no' ] && [ "$MOC_PATH" != 'none' ]; then
|
||||
if [ "$HAVE_QT" != 'no' ] && [ "$HAVE_MOC" = 'yes' ]; then
|
||||
check_pkgconf QT5CORE Qt5Core 5.2
|
||||
check_pkgconf QT5GUI Qt5Gui 5.2
|
||||
check_pkgconf QT5WIDGETS Qt5Widgets 5.2
|
||||
@ -286,13 +286,7 @@ if [ "$HAVE_QT" != 'no' ] && [ "$MOC_PATH" != 'none' ]; then
|
||||
#check_pkgconf QT5WEBENGINE Qt5WebEngine 5.4
|
||||
check_pkgconf OPENSSL openssl 1.0.0
|
||||
|
||||
check_val '' QT5CORE -lQt5Core QT5CORE
|
||||
check_val '' QT5GUI -lQt5Gui QT5GUI
|
||||
check_val '' QT5WIDGETS -lQt5Widgets QT5WIDGETS
|
||||
check_val '' QT5CONCURRENT -lQt5Concurrent QT5CONCURRENT
|
||||
check_val '' QT5NETWORK -lQt5Network QT5NETWORK
|
||||
#check_val '' QT5WEBENGINE -lQt5WebEngine QT5WEBENGINE
|
||||
check_val '' OPENSSL -lssl OPENSSL
|
||||
# pkg-config is needed to reliably find Qt5 libraries.
|
||||
|
||||
if [ "$HAVE_QT5CORE" = "no" ] || [ "$HAVE_QT5GUI" = "no" ] || [ "$HAVE_QT5WIDGETS" = "no" ] || [ "$HAVE_QT5CONCURRENT" = "no" ] || [ "$HAVE_QT5NETWORK" = "no" ]; then
|
||||
die : 'Notice: Not building Qt support, required libraries were not found.'
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
TEMP_C=.tmp.c
|
||||
TEMP_CXX=.tmp.cxx
|
||||
TEMP_MOC=.moc.h
|
||||
TEMP_CPP=.moc.cpp
|
||||
TEMP_EXE=.tmp
|
||||
|
||||
# Checking for working C compiler
|
||||
@ -87,26 +89,6 @@ if [ "$OS" = "Win32" ]; then
|
||||
echo "$echobuf ... $WINDRES"
|
||||
fi
|
||||
|
||||
if [ "$HAVE_QT" != "no" ]; then
|
||||
echobuf="Checking for moc"
|
||||
if [ -z "$MOC" ]; then
|
||||
MOC_PATH="none"
|
||||
for moc in moc-qt5 moc; do
|
||||
MOC="$(exists "$moc")" || MOC=""
|
||||
[ "${MOC}" ] && {
|
||||
MOC_PATH="$MOC"
|
||||
break
|
||||
}
|
||||
done
|
||||
fi
|
||||
|
||||
echo "$echobuf ... $MOC_PATH"
|
||||
|
||||
if [ "$MOC_PATH" = "none" ]; then
|
||||
die : 'Warning: moc not found, Qt companion support will be disabled.'
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$PKG_CONF_PATH" ]; then
|
||||
PKG_CONF_PATH="none"
|
||||
for pkgconf in pkgconf pkg-config; do
|
||||
@ -123,3 +105,58 @@ echo "Checking for pkg-config ... $PKG_CONF_PATH"
|
||||
if [ "$PKG_CONF_PATH" = "none" ]; then
|
||||
die : 'Warning: pkg-config not found, package checks will fail.'
|
||||
fi
|
||||
|
||||
# Checking for working moc
|
||||
cat << EOF > "$TEMP_MOC"
|
||||
#include <QTimeZone>
|
||||
class Test : public QObject
|
||||
{
|
||||
public:
|
||||
Q_OBJECT
|
||||
QTimeZone tz;
|
||||
};
|
||||
EOF
|
||||
|
||||
HAVE_MOC=no
|
||||
if [ "$HAVE_QT" != "no" ] && [ "$HAVE_CXX" != "no" ] && [ "$PKG_CONF_PATH" != "none" ]; then
|
||||
moc_works=0
|
||||
if "$PKGCONF" --exists Qt5Core; then
|
||||
if [ "$MOC" ]; then
|
||||
"$MOC" -o "$TEMP_CPP" "$TEMP_MOC" >/dev/null 2>&1 &&
|
||||
"$CXX" -o "$TEMP_EXE" $("$PKGCONF" --cflags --libs Qt5Core) -fPIC \
|
||||
-c "$TEMP_CPP" >/dev/null 2>&1 &&
|
||||
moc_works=1
|
||||
else
|
||||
for moc in moc-qt5 moc; do
|
||||
MOC="$(exists "$moc")" || MOC=""
|
||||
if [ "$MOC" ]; then
|
||||
"$MOC" -o "$TEMP_CPP" "$TEMP_MOC" >/dev/null 2>&1 ||
|
||||
continue
|
||||
"$CXX" -o "$TEMP_EXE" $("$PKGCONF" --cflags --libs Qt5Core) \
|
||||
-fPIC -c "$TEMP_CPP" >/dev/null 2>&1 && {
|
||||
moc_works=1
|
||||
break
|
||||
}
|
||||
fi
|
||||
done
|
||||
fi
|
||||
else
|
||||
MOC=""
|
||||
fi
|
||||
|
||||
moc_status='does not work'
|
||||
if [ "$moc_works" = '1' ]; then
|
||||
moc_status='works'
|
||||
HAVE_MOC='yes'
|
||||
elif [ -z "$MOC" ]; then
|
||||
moc_status='not found'
|
||||
fi
|
||||
|
||||
echo "Checking for moc ... $MOC $moc_status"
|
||||
|
||||
if [ "$HAVE_MOC" != 'yes' ]; then
|
||||
die : 'Warning: moc not found, Qt companion support will be disabled.'
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f -- "$TEMP_CPP" "$TEMP_EXE" "$TEMP_MOC"
|
||||
|
Loading…
Reference in New Issue
Block a user