Compile SDL with wayland support
This commit is contained in:
parent
40fcc634ef
commit
ad7add9bec
7 changed files with 36 additions and 29 deletions
|
|
@ -25,6 +25,7 @@ option(USE_MEMORYSAN "Enable Memory Sanitizer" OFF)
|
||||||
option(NO_CONAN_BUILD "Not using conan to get packages" OFF)
|
option(NO_CONAN_BUILD "Not using conan to get packages" OFF)
|
||||||
option(CONFIG_NEXT_TO_EXECUTABLE "Place configuration folder next to executable (portable executable)" OFF)
|
option(CONFIG_NEXT_TO_EXECUTABLE "Place configuration folder next to executable (portable executable)" OFF)
|
||||||
option(MACOS_MAKE_BUNDLE "Package the application as a bundle" ON)
|
option(MACOS_MAKE_BUNDLE "Package the application as a bundle" ON)
|
||||||
|
option(ADD_PREFER_X11_OPTION "Adds an internal Prefer X11 option" OFF)
|
||||||
|
|
||||||
# Setting sources
|
# Setting sources
|
||||||
set(sources "src/main.cpp"
|
set(sources "src/main.cpp"
|
||||||
|
|
@ -213,7 +214,7 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT EMSCRIPTEN)
|
if(NOT EMSCRIPTEN)
|
||||||
if(NOT ANDROID)
|
if((NOT ANDROID) AND (NOT LINUX))
|
||||||
find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3-shared)
|
find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3-shared)
|
||||||
endif()
|
endif()
|
||||||
find_package(LibDataChannel REQUIRED)
|
find_package(LibDataChannel REQUIRED)
|
||||||
|
|
@ -337,6 +338,10 @@ if(WIN32)
|
||||||
target_compile_definitions(main PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
|
target_compile_definitions(main PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(ADD_PREFER_X11_OPTION)
|
||||||
|
target_compile_definitions(main PRIVATE ADD_PREFER_X11_OPTION)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CONFIG_NEXT_TO_EXECUTABLE)
|
if(CONFIG_NEXT_TO_EXECUTABLE)
|
||||||
target_compile_definitions(main PRIVATE CONFIG_NEXT_TO_EXECUTABLE)
|
target_compile_definitions(main PRIVATE CONFIG_NEXT_TO_EXECUTABLE)
|
||||||
message("Place config next to executable")
|
message("Place config next to executable")
|
||||||
|
|
@ -389,6 +394,15 @@ endif()
|
||||||
|
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
add_subdirectory(deps/SDL EXCLUDE_FROM_ALL)
|
add_subdirectory(deps/SDL EXCLUDE_FROM_ALL)
|
||||||
|
elseif(LINUX)
|
||||||
|
set(SDL_TEST_LIBRARY OFF CACHE BOOL "Compile SDL test library")
|
||||||
|
set(SDL_TESTS OFF CACHE BOOL "Compile SDL tests")
|
||||||
|
set(SDL_INSTALL_DOCS OFF CACHE BOOL "Install docs")
|
||||||
|
set(SDL_INSTALL_TESTS OFF CACHE BOOL "Install tests")
|
||||||
|
set(SDL_WAYLAND ON CACHE BOOL "Compile SDL for Wayland")
|
||||||
|
set(SDL_X11 ON CACHE BOOL "Compile SDL for X11")
|
||||||
|
set(SDL_AUDIO OFF CACHE BOOL "Compile SDL Audio")
|
||||||
|
add_subdirectory(deps/SDL EXCLUDE_FROM_ALL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NO_CONAN_BUILD)
|
if(NO_CONAN_BUILD)
|
||||||
|
|
@ -397,7 +411,7 @@ if(NO_CONAN_BUILD)
|
||||||
target_link_libraries(main SDL3::SDL3 ICU::uc Fontconfig::Fontconfig Freetype::Freetype PNG::PNG ZLIB::ZLIB)
|
target_link_libraries(main SDL3::SDL3 ICU::uc Fontconfig::Fontconfig Freetype::Freetype PNG::PNG ZLIB::ZLIB)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(main skia-infinipaint::skia-infinipaint)
|
target_link_libraries(main skia-infinipaint::skia-infinipaint)
|
||||||
if(ANDROID)
|
if(ANDROID OR LINUX)
|
||||||
target_link_libraries(main SDL3::SDL3)
|
target_link_libraries(main SDL3::SDL3)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(main sdl-infinipaint::sdl-infinipaint)
|
target_link_libraries(main sdl-infinipaint::sdl-infinipaint)
|
||||||
|
|
|
||||||
|
|
@ -92,15 +92,6 @@ class CompressorRecipe(ConanFile):
|
||||||
if self.settings.os == "Linux":
|
if self.settings.os == "Linux":
|
||||||
self.requires("fontconfig/2.17.1")
|
self.requires("fontconfig/2.17.1")
|
||||||
self.requires("egl/system")
|
self.requires("egl/system")
|
||||||
self.requires("sdl-infinipaint/3.4.8", options = {
|
|
||||||
"wayland": False,
|
|
||||||
"x11": True,
|
|
||||||
"pulseaudio": False,
|
|
||||||
"alsa": False,
|
|
||||||
"sndio": False,
|
|
||||||
"vulkan": False,
|
|
||||||
"opengles": False
|
|
||||||
})
|
|
||||||
elif self.settings.os == "Emscripten":
|
elif self.settings.os == "Emscripten":
|
||||||
self.requires("sdl-infinipaint/3.4.8", options = {
|
self.requires("sdl-infinipaint/3.4.8", options = {
|
||||||
"emscriptenPersistentPath": "/infinipaint"
|
"emscriptenPersistentPath": "/infinipaint"
|
||||||
|
|
|
||||||
|
|
@ -46,23 +46,6 @@ modules:
|
||||||
tag: v2022.0.0
|
tag: v2022.0.0
|
||||||
commit: 0c0ff192a2304e114bc9e6557582dfba101360ff
|
commit: 0c0ff192a2304e114bc9e6557582dfba101360ff
|
||||||
url: https://github.com/uxlfoundation/oneTBB.git
|
url: https://github.com/uxlfoundation/oneTBB.git
|
||||||
- name: SDL3
|
|
||||||
buildsystem: cmake-ninja
|
|
||||||
config-opts:
|
|
||||||
- -DCMAKE_BUILD_TYPE=Release
|
|
||||||
- -DSDL_SHARED=ON
|
|
||||||
- -DSDL_STATIC=OFF
|
|
||||||
- -DSDL_TEST_LIBRARY=OFF
|
|
||||||
- -DSDL_TESTS=OFF
|
|
||||||
- -DSDL_DISABLE_INSTALL_DOCS=OFF
|
|
||||||
- -DSDL_INSTALL_TESTS=OFF
|
|
||||||
- -DSDL_WAYLAND=OFF
|
|
||||||
- -DSDL_X11=ON
|
|
||||||
sources:
|
|
||||||
- type: git
|
|
||||||
tag: release-3.4.8
|
|
||||||
commit: d9d5536704d585616d4db3c8ba3c4ff6fc2757e1
|
|
||||||
url: https://github.com/libsdl-org/SDL.git
|
|
||||||
- name: Skia
|
- name: Skia
|
||||||
buildsystem: simple
|
buildsystem: simple
|
||||||
build-commands:
|
build-commands:
|
||||||
|
|
@ -149,7 +132,8 @@ cleanup:
|
||||||
|
|
||||||
finish-args:
|
finish-args:
|
||||||
- --share=ipc
|
- --share=ipc
|
||||||
- --socket=x11
|
- --socket=wayland
|
||||||
|
- --socket=fallback-x11
|
||||||
- --device=all
|
- --device=all
|
||||||
- --share=network
|
- --share=network
|
||||||
- --filesystem=home
|
- --filesystem=home
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,9 @@ nlohmann::json GlobalConfig::get_config_json(const InputManager& input) const {
|
||||||
toRet["dragZoomSpeed"] = dragZoomSpeed;
|
toRet["dragZoomSpeed"] = dragZoomSpeed;
|
||||||
toRet["scrollZoomSpeed"] = scrollZoomSpeed;
|
toRet["scrollZoomSpeed"] = scrollZoomSpeed;
|
||||||
toRet["vsync"] = vsyncValue;
|
toRet["vsync"] = vsyncValue;
|
||||||
|
#ifdef ADD_PREFER_X11_OPTION
|
||||||
|
toRet["preferX11"] = preferX11;
|
||||||
|
#endif
|
||||||
#ifndef __EMSCRIPTEN__
|
#ifndef __EMSCRIPTEN__
|
||||||
toRet["applyDisplayScale"] = applyDisplayScale;
|
toRet["applyDisplayScale"] = applyDisplayScale;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -126,6 +129,9 @@ void GlobalConfig::set_config_json(InputManager& input, const nlohmann::json& j,
|
||||||
try{j.at("mainCallbackRateBackground").get_to(mainCallbackRateBackground);} catch(...) {}
|
try{j.at("mainCallbackRateBackground").get_to(mainCallbackRateBackground);} catch(...) {}
|
||||||
if(version >= VersionNumber(0, 6, 0))
|
if(version >= VersionNumber(0, 6, 0))
|
||||||
try{j.at("vsync").get_to(vsyncValue);} catch(...) {}
|
try{j.at("vsync").get_to(vsyncValue);} catch(...) {}
|
||||||
|
#ifdef ADD_PREFER_X11_OPTION
|
||||||
|
try{j.at("preferX11").get_to(preferX11);} catch(...) {}
|
||||||
|
#endif
|
||||||
#ifndef __EMSCRIPTEN__
|
#ifndef __EMSCRIPTEN__
|
||||||
try{j.at("applyDisplayScale").get_to(applyDisplayScale);} catch(...) {}
|
try{j.at("applyDisplayScale").get_to(applyDisplayScale);} catch(...) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,11 @@ class GlobalConfig {
|
||||||
#ifndef __EMSCRIPTEN__
|
#ifndef __EMSCRIPTEN__
|
||||||
bool applyDisplayScale = true;
|
bool applyDisplayScale = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ADD_PREFER_X11_OPTION
|
||||||
|
bool preferX11 = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void load_default_palette();
|
void load_default_palette();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1529,6 +1529,9 @@ void Toolbar::general_settings_inner_gui() {
|
||||||
|
|
||||||
checkbox_boolean_field(gui, "real time eraser", "Eraser works in real time", &main.conf.realTimeEraser);
|
checkbox_boolean_field(gui, "real time eraser", "Eraser works in real time", &main.conf.realTimeEraser);
|
||||||
checkbox_boolean_field(gui, "force extension on path", "Force extension on path when saving files", &main.conf.forceExtensionOnPath);
|
checkbox_boolean_field(gui, "force extension on path", "Force extension on path when saving files", &main.conf.forceExtensionOnPath);
|
||||||
|
#ifdef ADD_PREFER_X11_OPTION
|
||||||
|
checkbox_boolean_field(gui, "prefer x11", "Prefer X11 over Wayland (Requires restart)", &main.conf.preferX11);
|
||||||
|
#endif
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -227,6 +227,10 @@ void initialize_sdl(MainStruct& mS) {
|
||||||
SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
|
SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
|
||||||
SDL_SetHint(SDL_HINT_ANDROID_TRAP_BACK_BUTTON, "1");
|
SDL_SetHint(SDL_HINT_ANDROID_TRAP_BACK_BUTTON, "1");
|
||||||
SDL_SetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT, "#canvas"); // Ensures that SDL only grabs input when browser is focused on canvas
|
SDL_SetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT, "#canvas"); // Ensures that SDL only grabs input when browser is focused on canvas
|
||||||
|
#ifdef ADD_PREFER_X11_OPTION
|
||||||
|
if(mS.m->conf.preferX11)
|
||||||
|
SDL_SetHint(SDL_HINT_VIDEO_DRIVER, "x11,wayland");
|
||||||
|
#endif
|
||||||
|
|
||||||
if(!SDL_Init(SDL_INIT_VIDEO))
|
if(!SDL_Init(SDL_INIT_VIDEO))
|
||||||
throw std::runtime_error("[SDL_Init] " + std::string(SDL_GetError()));
|
throw std::runtime_error("[SDL_Init] " + std::string(SDL_GetError()));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue