mirror of
https://github.com/Rosalie241/RMG.git
synced 2026-07-11 09:34:00 +02:00
cmake: add FORCE_XCB option
This commit is contained in:
@@ -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}")
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user