Allow forced disabling of features instead of relying on pkg-config

So-called "automagic" behaviour is considered unhelpful by
distributions. A user may unintentionally build Moonlight with VDPAU
support simply because they had that library installed, only for the
whole application to break when they uninstall the library later. This
could happen on any distribution, but it should especially be avoided on
source-based distributions, where the user would not expect the package
manager to encounter such issues.

This commit is best viewed without whitespace changes.
This commit is contained in:
James Le Cuirot 2023-06-03 17:51:00 +01:00 committed by Cameron Gutman
parent 7a719aa886
commit 8b6df34d8b

View file

@ -65,52 +65,74 @@ unix:!macx {
CONFIG += link_pkgconfig CONFIG += link_pkgconfig
PKGCONFIG += openssl sdl2 SDL2_ttf opus PKGCONFIG += openssl sdl2 SDL2_ttf opus
!disable-ffmpeg {
packagesExist(libavcodec) { packagesExist(libavcodec) {
PKGCONFIG += libavcodec libavutil PKGCONFIG += libavcodec libavutil
CONFIG += ffmpeg CONFIG += ffmpeg
!disable-libva {
packagesExist(libva) { packagesExist(libva) {
!disable-x11 {
packagesExist(libva-x11) { packagesExist(libva-x11) {
CONFIG += libva-x11 CONFIG += libva-x11
} }
}
!disable-wayland {
packagesExist(libva-wayland) { packagesExist(libva-wayland) {
CONFIG += libva-wayland CONFIG += libva-wayland
} }
}
!disable-libdrm {
packagesExist(libva-drm) { packagesExist(libva-drm) {
CONFIG += libva-drm CONFIG += libva-drm
} }
}
CONFIG += libva CONFIG += libva
} }
}
!disable-libvdpau {
packagesExist(vdpau) { packagesExist(vdpau) {
CONFIG += libvdpau CONFIG += libvdpau
} }
}
!disable-mmal {
packagesExist(mmal) { packagesExist(mmal) {
PKGCONFIG += mmal PKGCONFIG += mmal
CONFIG += mmal CONFIG += mmal
} }
}
!disable-libdrm {
packagesExist(libdrm) { packagesExist(libdrm) {
PKGCONFIG += libdrm PKGCONFIG += libdrm
CONFIG += libdrm CONFIG += libdrm
} }
}
!disable-cuda {
packagesExist(ffnvcodec) { packagesExist(ffnvcodec) {
PKGCONFIG += ffnvcodec PKGCONFIG += ffnvcodec
CONFIG += cuda CONFIG += cuda
} }
} }
}
!disable-wayland {
packagesExist(wayland-client) { packagesExist(wayland-client) {
CONFIG += wayland CONFIG += wayland
PKGCONFIG += wayland-client PKGCONFIG += wayland-client
} }
}
!disable-x11 {
packagesExist(x11) { packagesExist(x11) {
DEFINES += HAS_X11 DEFINES += HAS_X11
PKGCONFIG += x11 PKGCONFIG += x11
} }
}
}
} }
win32 { win32 {
LIBS += -llibssl -llibcrypto -lSDL2 -lSDL2_ttf -lavcodec -lavutil -lopus -ldxgi -ld3d11 LIBS += -llibssl -llibcrypto -lSDL2 -lSDL2_ttf -lavcodec -lavutil -lopus -ldxgi -ld3d11