wayland: Move wayland files into common folder

This commit is contained in:
Reg Tiangha 2024-06-11 16:15:31 -06:00
parent 5f1a26237b
commit 2a2281c2e1
No known key found for this signature in database
GPG key ID: 00D437798B1C2970
25 changed files with 53 additions and 49 deletions

View file

@ -279,8 +279,7 @@ if (APPLE)
XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2" XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2"
) )
endif() endif()
elseif (WIN32)
elseif(WIN32)
# compile as a win32 gui application instead of a console application # compile as a win32 gui application instead of a console application
target_link_libraries(citra-qt PRIVATE Qt6::EntryPointImplementation) target_link_libraries(citra-qt PRIVATE Qt6::EntryPointImplementation)
if(MSVC) if(MSVC)
@ -288,35 +287,6 @@ elseif(WIN32)
elseif(MINGW) elseif(MINGW)
set_target_properties(citra-qt PROPERTIES LINK_FLAGS_RELEASE "-mwindows") set_target_properties(citra-qt PROPERTIES LINK_FLAGS_RELEASE "-mwindows")
endif() endif()
elseif(UNIX)
find_package(X11 REQUIRED)
find_package(EGL REQUIRED)
option(ENABLE_WAYLAND "Enable Wayland support" ON)
if (ENABLE_WAYLAND)
find_package(Wayland REQUIRED Client)
target_compile_definitions(citra PRIVATE WAYLAND_ENABLED)
target_sources(citra PRIVATE
externals/duckstation/gl/context_egl_wayland.cpp
)
endif()
target_sources(citra PRIVATE
externals/duckstation/gl/context.cpp
externals/duckstation/gl/context_egl.cpp
externals/duckstation/gl/context_egl_x11.cpp
externals/duckstation/gl/context_glx.cpp
externals/duckstation/gl/x11_window.cpp
)
target_link_libraries(citra PRIVATE "${X11_LIBRARIES}" "${EGL_LIBRARIES}")
target_include_directories(citra PRIVATE "${X11_INCLUDE_DIR}")
add_compile_definitions(QAPPLICATION_CLASS=QApplication)
endif() endif()
if(ENABLE_SDL2) if(ENABLE_SDL2)

View file

@ -180,6 +180,40 @@ else()
) )
endif() endif()
# For Wayland support
if(UNIX AND NOT APPLE AND NOT ANDROID)
find_package(X11 REQUIRED)
find_package(EGL REQUIRED)
if(X11_FOUND AND EGL_FOUND)
option(ENABLE_WAYLAND "Enable Wayland support" ON)
endif()
if (ENABLE_WAYLAND)
find_package(Wayland REQUIRED Client)
target_compile_definitions(citra_common PRIVATE WAYLAND_ENABLED)
target_sources(citra_common PRIVATE
wayland/context_egl_wayland.cpp
)
endif()
target_sources(citra_common PRIVATE
wayland/context.cpp
wayland/context_egl.cpp
wayland/context_egl_x11.cpp
wayland/context_glx.cpp
wayland/x11_window.cpp
)
target_link_libraries(citra_common PRIVATE "${X11_LIBRARIES}" "${EGL_LIBRARIES}")
target_include_directories(citra_common PRIVATE "${X11_INCLUDE_DIR}")
add_compile_definitions(QAPPLICATION_CLASS=QApplication)
endif()
create_target_directory_groups(citra_common) create_target_directory_groups(citra_common)
target_link_libraries(citra_common PUBLIC fmt library-headers microprofile Boost::boost Boost::serialization Boost::iostreams) target_link_libraries(citra_common PUBLIC fmt library-headers microprofile Boost::boost Boost::serialization Boost::iostreams)

View file

@ -1,9 +1,9 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <stdlib.h> #include <stdlib.h>
#include "citra_qt/wayland/log.h"
#include "context.h" #include "context.h"
#include "loader.h" #include "loader.h"
#include "log.h"
Log_SetChannel(GL::Context); Log_SetChannel(GL::Context);
#if defined(_WIN32) #if defined(_WIN32)

View file

@ -3,8 +3,8 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "citra_qt/wayland/duckstation_compat.h" #include "duckstation_compat.h"
#include "citra_qt/wayland/window_info.h" #include "window_info.h"
namespace GL { namespace GL {
using namespace citra; using namespace citra;

View file

@ -1,8 +1,8 @@
#include <dlfcn.h> #include <dlfcn.h>
#include "citra_qt/wayland/duckstation_compat.h"
#include "citra_qt/wayland/log.h"
#include "context_agl.h" #include "context_agl.h"
#include "duckstation_compat.h"
#include "loader.h" #include "loader.h"
#include "log.h"
Log_SetChannel(GL::ContextAGL); Log_SetChannel(GL::ContextAGL);
namespace GL { namespace GL {

View file

@ -1,9 +1,9 @@
#include <cstring> #include <cstring>
#include <optional> #include <optional>
#include <vector> #include <vector>
#include "citra_qt/wayland/duckstation_compat.h"
#include "citra_qt/wayland/log.h"
#include "context_egl.h" #include "context_egl.h"
#include "duckstation_compat.h"
#include "log.h"
Log_SetChannel(GL::ContextEGL); Log_SetChannel(GL::ContextEGL);
namespace GL { namespace GL {

View file

@ -1,6 +1,6 @@
#include <dlfcn.h> #include <dlfcn.h>
#include "citra_qt/wayland/log.h"
#include "context_egl_wayland.h" #include "context_egl_wayland.h"
#include "log.h"
Log_SetChannel(ContextEGLWayland); Log_SetChannel(ContextEGLWayland);
namespace GL { namespace GL {

View file

@ -1,5 +1,5 @@
#include "citra_qt/wayland/log.h"
#include "context_egl_x11.h" #include "context_egl_x11.h"
#include "log.h"
Log_SetChannel(GL::ContextEGLX11); Log_SetChannel(GL::ContextEGLX11);
namespace GL { namespace GL {

View file

@ -1,7 +1,7 @@
#include <dlfcn.h> #include <dlfcn.h>
#include "citra_qt/wayland/duckstation_compat.h"
#include "citra_qt/wayland/log.h"
#include "context_glx.h" #include "context_glx.h"
#include "duckstation_compat.h"
#include "log.h"
Log_SetChannel(GL::ContextGLX); Log_SetChannel(GL::ContextGLX);
namespace GL { namespace GL {

View file

@ -1,8 +1,8 @@
#include "citra_qt/wayland/duckstation_compat.h"
#include "citra_qt/wayland/log.h"
#include "citra_qt/wayland/scoped_guard.h"
#include "context_wgl.h" #include "context_wgl.h"
#include "duckstation_compat.h"
#include "loader.h" #include "loader.h"
#include "log.h"
#include "scoped_guard.h"
using namespace melonDS; using namespace melonDS;
Log_SetChannel(GL::ContextWGL); Log_SetChannel(GL::ContextWGL);

View file

@ -2,7 +2,7 @@
// Fix glad.h including windows.h // Fix glad.h including windows.h
#ifdef _WIN32 #ifdef _WIN32
#include "citra_qt/wayland/windows_headers.h" #include "windows_headers.h"
#endif #endif
#include <glad/glad.h> #include <glad/glad.h>

View file

@ -1,6 +1,6 @@
#include <cstdio> #include <cstdio>
#include "citra_qt/wayland/duckstation_compat.h" #include "duckstation_compat.h"
#include "citra_qt/wayland/log.h" #include "log.h"
#include "x11_window.h" #include "x11_window.h"
Log_SetChannel(X11Window); Log_SetChannel(X11Window);

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include "citra_qt/wayland/duckstation_compat.h" #include "duckstation_compat.h"
namespace GL { namespace GL {
using namespace citra; using namespace citra;