diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 84d775af4..8a6a2cd46 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -279,8 +279,7 @@ if (APPLE) XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2" ) endif() - -elseif(WIN32) +elseif (WIN32) # compile as a win32 gui application instead of a console application target_link_libraries(citra-qt PRIVATE Qt6::EntryPointImplementation) if(MSVC) @@ -288,35 +287,6 @@ elseif(WIN32) elseif(MINGW) set_target_properties(citra-qt PROPERTIES LINK_FLAGS_RELEASE "-mwindows") 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() if(ENABLE_SDL2) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 567831249..ff6031c6d 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -180,6 +180,40 @@ else() ) 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) target_link_libraries(citra_common PUBLIC fmt library-headers microprofile Boost::boost Boost::serialization Boost::iostreams) diff --git a/src/citra_qt/externals/duckstation/gl/context.cpp b/src/common/wayland/context.cpp similarity index 99% rename from src/citra_qt/externals/duckstation/gl/context.cpp rename to src/common/wayland/context.cpp index f7578064f..945eddb26 100644 --- a/src/citra_qt/externals/duckstation/gl/context.cpp +++ b/src/common/wayland/context.cpp @@ -1,9 +1,9 @@ #include #include #include -#include "citra_qt/wayland/log.h" #include "context.h" #include "loader.h" +#include "log.h" Log_SetChannel(GL::Context); #if defined(_WIN32) diff --git a/src/citra_qt/externals/duckstation/gl/context.h b/src/common/wayland/context.h similarity index 96% rename from src/citra_qt/externals/duckstation/gl/context.h rename to src/common/wayland/context.h index e7d2bc571..7526ac9f4 100644 --- a/src/citra_qt/externals/duckstation/gl/context.h +++ b/src/common/wayland/context.h @@ -3,8 +3,8 @@ #include #include -#include "citra_qt/wayland/duckstation_compat.h" -#include "citra_qt/wayland/window_info.h" +#include "duckstation_compat.h" +#include "window_info.h" namespace GL { using namespace citra; diff --git a/src/citra_qt/externals/duckstation/gl/context_agl.h b/src/common/wayland/context_agl.h similarity index 100% rename from src/citra_qt/externals/duckstation/gl/context_agl.h rename to src/common/wayland/context_agl.h diff --git a/src/citra_qt/externals/duckstation/gl/context_agl.mm b/src/common/wayland/context_agl.mm similarity index 98% rename from src/citra_qt/externals/duckstation/gl/context_agl.mm rename to src/common/wayland/context_agl.mm index a0fa4cbde..c1d996549 100644 --- a/src/citra_qt/externals/duckstation/gl/context_agl.mm +++ b/src/common/wayland/context_agl.mm @@ -1,8 +1,8 @@ #include -#include "citra_qt/wayland/duckstation_compat.h" -#include "citra_qt/wayland/log.h" #include "context_agl.h" +#include "duckstation_compat.h" #include "loader.h" +#include "log.h" Log_SetChannel(GL::ContextAGL); namespace GL { diff --git a/src/citra_qt/externals/duckstation/gl/context_egl.cpp b/src/common/wayland/context_egl.cpp similarity index 99% rename from src/citra_qt/externals/duckstation/gl/context_egl.cpp rename to src/common/wayland/context_egl.cpp index d8aaf6f2e..96d8d4422 100644 --- a/src/citra_qt/externals/duckstation/gl/context_egl.cpp +++ b/src/common/wayland/context_egl.cpp @@ -1,9 +1,9 @@ #include #include #include -#include "citra_qt/wayland/duckstation_compat.h" -#include "citra_qt/wayland/log.h" #include "context_egl.h" +#include "duckstation_compat.h" +#include "log.h" Log_SetChannel(GL::ContextEGL); namespace GL { diff --git a/src/citra_qt/externals/duckstation/gl/context_egl.h b/src/common/wayland/context_egl.h similarity index 100% rename from src/citra_qt/externals/duckstation/gl/context_egl.h rename to src/common/wayland/context_egl.h diff --git a/src/citra_qt/externals/duckstation/gl/context_egl_wayland.cpp b/src/common/wayland/context_egl_wayland.cpp similarity index 98% rename from src/citra_qt/externals/duckstation/gl/context_egl_wayland.cpp rename to src/common/wayland/context_egl_wayland.cpp index ac320fe89..d52580ff7 100644 --- a/src/citra_qt/externals/duckstation/gl/context_egl_wayland.cpp +++ b/src/common/wayland/context_egl_wayland.cpp @@ -1,6 +1,6 @@ #include -#include "citra_qt/wayland/log.h" #include "context_egl_wayland.h" +#include "log.h" Log_SetChannel(ContextEGLWayland); namespace GL { diff --git a/src/citra_qt/externals/duckstation/gl/context_egl_wayland.h b/src/common/wayland/context_egl_wayland.h similarity index 100% rename from src/citra_qt/externals/duckstation/gl/context_egl_wayland.h rename to src/common/wayland/context_egl_wayland.h diff --git a/src/citra_qt/externals/duckstation/gl/context_egl_x11.cpp b/src/common/wayland/context_egl_x11.cpp similarity index 98% rename from src/citra_qt/externals/duckstation/gl/context_egl_x11.cpp rename to src/common/wayland/context_egl_x11.cpp index 3ed3187e7..e2ca9613b 100644 --- a/src/citra_qt/externals/duckstation/gl/context_egl_x11.cpp +++ b/src/common/wayland/context_egl_x11.cpp @@ -1,5 +1,5 @@ -#include "citra_qt/wayland/log.h" #include "context_egl_x11.h" +#include "log.h" Log_SetChannel(GL::ContextEGLX11); namespace GL { diff --git a/src/citra_qt/externals/duckstation/gl/context_egl_x11.h b/src/common/wayland/context_egl_x11.h similarity index 100% rename from src/citra_qt/externals/duckstation/gl/context_egl_x11.h rename to src/common/wayland/context_egl_x11.h diff --git a/src/citra_qt/externals/duckstation/gl/context_glx.cpp b/src/common/wayland/context_glx.cpp similarity index 99% rename from src/citra_qt/externals/duckstation/gl/context_glx.cpp rename to src/common/wayland/context_glx.cpp index b818425a0..133f24c95 100644 --- a/src/citra_qt/externals/duckstation/gl/context_glx.cpp +++ b/src/common/wayland/context_glx.cpp @@ -1,7 +1,7 @@ #include -#include "citra_qt/wayland/duckstation_compat.h" -#include "citra_qt/wayland/log.h" #include "context_glx.h" +#include "duckstation_compat.h" +#include "log.h" Log_SetChannel(GL::ContextGLX); namespace GL { diff --git a/src/citra_qt/externals/duckstation/gl/context_glx.h b/src/common/wayland/context_glx.h similarity index 100% rename from src/citra_qt/externals/duckstation/gl/context_glx.h rename to src/common/wayland/context_glx.h diff --git a/src/citra_qt/externals/duckstation/gl/context_wgl.cpp b/src/common/wayland/context_wgl.cpp similarity index 98% rename from src/citra_qt/externals/duckstation/gl/context_wgl.cpp rename to src/common/wayland/context_wgl.cpp index 7db4dac31..58c0e451d 100644 --- a/src/citra_qt/externals/duckstation/gl/context_wgl.cpp +++ b/src/common/wayland/context_wgl.cpp @@ -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 "duckstation_compat.h" #include "loader.h" +#include "log.h" +#include "scoped_guard.h" using namespace melonDS; Log_SetChannel(GL::ContextWGL); diff --git a/src/citra_qt/externals/duckstation/gl/context_wgl.h b/src/common/wayland/context_wgl.h similarity index 100% rename from src/citra_qt/externals/duckstation/gl/context_wgl.h rename to src/common/wayland/context_wgl.h diff --git a/src/citra_qt/wayland/duckstation_compat.h b/src/common/wayland/duckstation_compat.h similarity index 100% rename from src/citra_qt/wayland/duckstation_compat.h rename to src/common/wayland/duckstation_compat.h diff --git a/src/citra_qt/externals/duckstation/gl/loader.h b/src/common/wayland/loader.h similarity index 66% rename from src/citra_qt/externals/duckstation/gl/loader.h rename to src/common/wayland/loader.h index 7e457a6b9..bf949f435 100644 --- a/src/citra_qt/externals/duckstation/gl/loader.h +++ b/src/common/wayland/loader.h @@ -2,7 +2,7 @@ // Fix glad.h including windows.h #ifdef _WIN32 -#include "citra_qt/wayland/windows_headers.h" +#include "windows_headers.h" #endif #include diff --git a/src/citra_qt/wayland/log.h b/src/common/wayland/log.h similarity index 100% rename from src/citra_qt/wayland/log.h rename to src/common/wayland/log.h diff --git a/src/citra_qt/wayland/scoped_guard.h b/src/common/wayland/scoped_guard.h similarity index 100% rename from src/citra_qt/wayland/scoped_guard.h rename to src/common/wayland/scoped_guard.h diff --git a/src/citra_qt/wayland/window_info.cpp b/src/common/wayland/window_info.cpp similarity index 100% rename from src/citra_qt/wayland/window_info.cpp rename to src/common/wayland/window_info.cpp diff --git a/src/citra_qt/wayland/window_info.h b/src/common/wayland/window_info.h similarity index 100% rename from src/citra_qt/wayland/window_info.h rename to src/common/wayland/window_info.h diff --git a/src/citra_qt/wayland/windows_headers.h b/src/common/wayland/windows_headers.h similarity index 100% rename from src/citra_qt/wayland/windows_headers.h rename to src/common/wayland/windows_headers.h diff --git a/src/citra_qt/externals/duckstation/gl/x11_window.cpp b/src/common/wayland/x11_window.cpp similarity index 96% rename from src/citra_qt/externals/duckstation/gl/x11_window.cpp rename to src/common/wayland/x11_window.cpp index c71dd1780..e075e6252 100644 --- a/src/citra_qt/externals/duckstation/gl/x11_window.cpp +++ b/src/common/wayland/x11_window.cpp @@ -1,6 +1,6 @@ #include -#include "citra_qt/wayland/duckstation_compat.h" -#include "citra_qt/wayland/log.h" +#include "duckstation_compat.h" +#include "log.h" #include "x11_window.h" Log_SetChannel(X11Window); diff --git a/src/citra_qt/externals/duckstation/gl/x11_window.h b/src/common/wayland/x11_window.h similarity index 95% rename from src/citra_qt/externals/duckstation/gl/x11_window.h rename to src/common/wayland/x11_window.h index 9d2e529d8..fd58c9fa3 100644 --- a/src/citra_qt/externals/duckstation/gl/x11_window.h +++ b/src/common/wayland/x11_window.h @@ -1,7 +1,7 @@ #pragma once #include #include -#include "citra_qt/wayland/duckstation_compat.h" +#include "duckstation_compat.h" namespace GL { using namespace citra;