UI: Fix Qt platform override in CMake 3

This override is still needed until Qt minimum version requirement is
increased to at least 6.3.0.

ui-config.h.in and CMake 2 are modified to avoid USE_XDG redefinition in
CMake 3.
This commit is contained in:
tytan652 2024-05-24 10:05:26 +02:00 committed by Ryan Foster
parent 1d8c377240
commit 116107bc86
4 changed files with 17 additions and 12 deletions

View file

@ -504,16 +504,22 @@ elseif(OS_POSIX)
target_compile_options(obs PRIVATE -Wno-unqualified-std-cast-call)
endif()
if(OS_LINUX AND ENABLE_WHATSNEW)
find_package(MbedTLS)
find_package(nlohmann_json REQUIRED)
if(NOT MBEDTLS_FOUND)
obs_status(FATAL_ERROR "mbedTLS not found, but required for WhatsNew support on Linux")
if(OS_LINUX)
if(USE_XDG)
target_compile_definitions(obs PRIVATE USE_XDG)
endif()
target_sources(obs PRIVATE update/crypto-helpers.hpp update/crypto-helpers-mbedtls.cpp update/shared-update.cpp
update/shared-update.hpp update/update-helpers.cpp update/update-helpers.hpp)
target_link_libraries(obs PRIVATE Mbedtls::Mbedtls nlohmann_json::nlohmann_json OBS::blake2)
if(ENABLE_WHATSNEW)
find_package(MbedTLS)
find_package(nlohmann_json REQUIRED)
if(NOT MBEDTLS_FOUND)
obs_status(FATAL_ERROR "mbedTLS not found, but required for WhatsNew support on Linux")
endif()
target_sources(obs PRIVATE update/crypto-helpers.hpp update/crypto-helpers-mbedtls.cpp update/shared-update.cpp
update/shared-update.hpp update/update-helpers.cpp update/update-helpers.hpp)
target_link_libraries(obs PRIVATE Mbedtls::Mbedtls nlohmann_json::nlohmann_json OBS::blake2)
endif()
endif()
endif()

View file

@ -1,5 +1,5 @@
target_sources(obs-studio PRIVATE platform-x11.cpp)
target_compile_definitions(obs-studio PRIVATE OBS_INSTALL_PREFIX="${OBS_INSTALL_PREFIX}")
target_compile_definitions(obs-studio PRIVATE USE_XDG OBS_INSTALL_PREFIX="${OBS_INSTALL_PREFIX}")
target_link_libraries(obs-studio PRIVATE Qt::GuiPrivate Qt::DBus)
target_sources(obs-studio PRIVATE system-info-posix.cpp)

View file

@ -1996,7 +1996,8 @@ static int run_program(fstream &logFile, int argc, char *argv[])
if (platform_theme && strcmp(platform_theme, "qt5ct") == 0)
unsetenv("QT_QPA_PLATFORMTHEME");
#if defined(ENABLE_WAYLAND) && defined(USE_XDG)
#if defined(ENABLE_WAYLAND) && defined(USE_XDG) && \
QT_VERSION < QT_VERSION_CHECK(6, 3, 0)
/* NOTE: Qt doesn't use the Wayland platform on GNOME, so we have to
* force it using the QT_QPA_PLATFORM env var. It's still possible to
* use other QPA platforms using this env var, or the -platform command

View file

@ -1,7 +1,5 @@
#pragma once
#cmakedefine USE_XDG
#define OAUTH_BASE_URL "@OAUTH_BASE_URL@"
#define TWITCH_CLIENTID "@TWITCH_CLIENTID@"