cmake: add FORCE_XCB option

This commit is contained in:
Rosalie Wanders
2023-02-17 21:21:24 +01:00
parent f649053e00
commit edde08849f
3 changed files with 15 additions and 0 deletions
+6
View File
@@ -8,6 +8,7 @@ option(NO_GIT_CLONE "Disables git clone usage for 3rdParty dependencies" OFF
option(UPDATER "Enables updater" ${PORTABLE_INSTALL})
option(DISCORD_RPC "Enables Discord Rich Presence" ON)
option(USE_CCACHE "Enables usage of ccache when ccache has been found" ON)
option(FORCE_XCB "Forces Qt to use the xcb platform on linux" LINUX)
project(RMG)
@@ -39,6 +40,11 @@ if (NOT PORTABLE_INSTALL AND UPDATER)
set(UPDATER OFF)
endif()
if (FORCE_XCB AND (WIN32 OR MSYS))
message(WARNING "XCB Qt platform not supported on windows, disabling FORCE_XCB!")
set(FORCE_XCB OFF)
endif()
if (PORTABLE_INSTALL)
set(CMAKE_INSTALL_PREFIX "")
set(INSTALL_PATH "Bin/${CMAKE_BUILD_TYPE}")
+4
View File
@@ -20,6 +20,10 @@ if (DISCORD_RPC)
add_definitions(-DDISCORD_RPC)
endif(DISCORD_RPC)
if (FORCE_XCB)
add_definitions(-DFORCE_XCB)
endif(FORCE_XCB)
find_package(PkgConfig REQUIRED)
pkg_check_modules(SDL2 REQUIRED sdl2)
+5
View File
@@ -16,6 +16,7 @@
#include <RMG-Core/Core.hpp>
#include <iostream>
#include <cstdlib>
//
// Local Functions
@@ -74,6 +75,10 @@ int main(int argc, char **argv)
// install message handler
qInstallMessageHandler(message_handler);
#ifdef FORCE_XCB
setenv("QT_QPA_PLATFORM", "xcb", 1);
#endif // FORCE_XCB
QApplication app(argc, argv);
UserInterface::MainWindow window;