forked from stenzek/duckstation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NoGUI: Migrate to new host abstraction
- Loading branch information
Showing
30 changed files
with
3,471 additions
and
1,927 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# from https://github.com/glfw/glfw/blob/master/CMake/modules/FindWaylandProtocols.cmake | ||
|
||
find_package(PkgConfig) | ||
|
||
pkg_check_modules(WaylandProtocols QUIET wayland-protocols>=${WaylandProtocols_FIND_VERSION}) | ||
|
||
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols | ||
OUTPUT_VARIABLE WaylandProtocols_PKGDATADIR | ||
RESULT_VARIABLE _pkgconfig_failed) | ||
if (_pkgconfig_failed) | ||
message(FATAL_ERROR "Missing wayland-protocols pkgdatadir") | ||
endif() | ||
|
||
string(REGEX REPLACE "[\r\n]" "" WaylandProtocols_PKGDATADIR "${WaylandProtocols_PKGDATADIR}") | ||
|
||
find_package_handle_standard_args(WaylandProtocols | ||
FOUND_VAR | ||
WaylandProtocols_FOUND | ||
REQUIRED_VARS | ||
WaylandProtocols_PKGDATADIR | ||
VERSION_VAR | ||
WaylandProtocols_VERSION | ||
HANDLE_COMPONENTS | ||
) | ||
|
||
set(WAYLAND_PROTOCOLS_FOUND ${WaylandProtocols_FOUND}) | ||
set(WAYLAND_PROTOCOLS_PKGDATADIR ${WaylandProtocols_PKGDATADIR}) | ||
set(WAYLAND_PROTOCOLS_VERSION ${WaylandProtocols_VERSION}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# - Try to find XKBCommon | ||
# Once done, this will define | ||
# | ||
# XKBCOMMON_FOUND - System has XKBCommon | ||
# XKBCOMMON_INCLUDE_DIRS - The XKBCommon include directories | ||
# XKBCOMMON_LIBRARIES - The libraries needed to use XKBCommon | ||
# XKBCOMMON_DEFINITIONS - Compiler switches required for using XKBCommon | ||
|
||
find_package(PkgConfig) | ||
pkg_check_modules(PC_XKBCOMMON QUIET xkbcommon) | ||
set(XKBCOMMON_DEFINITIONS ${PC_XKBCOMMON_CFLAGS_OTHER}) | ||
|
||
find_path(XKBCOMMON_INCLUDE_DIR | ||
NAMES xkbcommon/xkbcommon.h | ||
HINTS ${PC_XKBCOMMON_INCLUDE_DIR} ${PC_XKBCOMMON_INCLUDE_DIRS} | ||
) | ||
|
||
find_library(XKBCOMMON_LIBRARY | ||
NAMES xkbcommon | ||
HINTS ${PC_XKBCOMMON_LIBRARY} ${PC_XKBCOMMON_LIBRARY_DIRS} | ||
) | ||
|
||
set(XKBCOMMON_LIBRARIES ${XKBCOMMON_LIBRARY}) | ||
set(XKBCOMMON_LIBRARY_DIRS ${XKBCOMMON_LIBRARY_DIRS}) | ||
set(XKBCOMMON_INCLUDE_DIRS ${XKBCOMMON_INCLUDE_DIR}) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(XKBCommon DEFAULT_MSG | ||
XKBCOMMON_LIBRARY | ||
XKBCOMMON_INCLUDE_DIR | ||
) | ||
|
||
mark_as_advanced(XKBCOMMON_LIBRARY XKBCOMMON_INCLUDE_DIR) | ||
|
||
if (XKBCOMMON_INCLUDE_DIR AND XKBCOMMON_LIBRARY AND NOT TARGET XKBCommon::XKBCommon) | ||
add_library(XKBCommon::XKBCommon UNKNOWN IMPORTED) | ||
set_target_properties(XKBCommon::XKBCommon PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${XKBCOMMON_INCLUDE_DIR}" IMPORTED_LOCATION "${XKBCOMMON_LIBRARY}") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,77 @@ | ||
add_executable(duckstation-nogui | ||
main.cpp | ||
nogui_host_interface.cpp | ||
nogui_host_interface.h | ||
nogui_host.cpp | ||
nogui_host.h | ||
nogui_platform.h | ||
) | ||
|
||
target_link_libraries(duckstation-nogui PRIVATE core common imgui glad frontend-common scmversion) | ||
target_link_libraries(duckstation-nogui PRIVATE core util common imgui glad frontend-common scmversion) | ||
|
||
if(USE_SDL2) | ||
target_sources(duckstation-nogui PRIVATE | ||
sdl_host_interface.cpp | ||
sdl_host_interface.h | ||
sdl_key_names.h | ||
if(WIN32) | ||
message(STATUS "Building Win32 NoGUI Platform.") | ||
target_sources(duckstation-nogui PRIVATE | ||
duckstation-nogui.manifest | ||
resource.h | ||
win32_nogui_platform.cpp | ||
win32_nogui_platform.h | ||
) | ||
target_include_directories(duckstation-nogui PRIVATE ${SDL2_INCLUDE_DIRS}) | ||
target_link_libraries(duckstation-nogui PRIVATE ${SDL2_LIBRARIES}) | ||
|
||
# We want a Windows subsystem application not console. | ||
set_target_properties(duckstation-nogui PROPERTIES | ||
WIN32_EXECUTABLE TRUE | ||
DEBUG_POSTFIX "-debug") | ||
endif() | ||
|
||
if(USE_EVDEV) | ||
target_sources(duckstation-nogui PRIVATE | ||
vty_host_interface.cpp | ||
vty_host_interface.h | ||
if(USE_X11) | ||
message(STATUS "Building X11 NoGUI Platform.") | ||
target_compile_definitions(duckstation-nogui PRIVATE "NOGUI_PLATFORM_X11=1") | ||
target_sources(duckstation-nogui PRIVATE | ||
x11_nogui_platform.cpp | ||
x11_nogui_platform.h | ||
) | ||
target_compile_definitions(duckstation-nogui PRIVATE "-DWITH_VTY=1") | ||
target_compile_definitions(duckstation-nogui PRIVATE "-DUSE_LIBEVDEV=1") | ||
target_include_directories(duckstation-nogui PRIVATE ${LIBEVDEV_INCLUDE_DIRS}) | ||
target_link_libraries(duckstation-nogui PRIVATE ${LIBEVDEV_LIBRARIES}) | ||
target_include_directories(duckstation-nogui PRIVATE "${X11_INCLUDE_DIR}" "${X11_Xrandr_INCLUDE_PATH}") | ||
target_link_libraries(duckstation-nogui PRIVATE "${X11_LIBRARIES}" "${X11_Xrandr_LIB}") | ||
endif() | ||
|
||
if(USE_DRMKMS) | ||
target_compile_definitions(duckstation-nogui PRIVATE "-DWITH_DRMKMS=1") | ||
endif() | ||
if(USE_WAYLAND) | ||
message(STATUS "Building Wayland NoGUI Platform.") | ||
find_package(Wayland REQUIRED Client) | ||
find_package(WaylandScanner REQUIRED) | ||
find_package(WaylandProtocols 1.15 REQUIRED) | ||
find_package(XKBCommon REQUIRED) | ||
|
||
if(WIN32) | ||
target_compile_definitions(duckstation-nogui PRIVATE "NOGUI_PLATFORM_WAYLAND=1") | ||
target_sources(duckstation-nogui PRIVATE | ||
duckstation-nogui.manifest | ||
wayland_nogui_platform.cpp | ||
wayland_nogui_platform.h | ||
) | ||
|
||
# We want a Windows subsystem application not console. | ||
set_target_properties(duckstation-nogui PROPERTIES | ||
WIN32_EXECUTABLE TRUE | ||
DEBUG_POSTFIX "-debug") | ||
# Generate the xdg-shell and xdg-decoration protocols at build-time. | ||
# Because these are C, not C++, we have to put them in their own library, otherwise | ||
# cmake tries to generate a C PCH as well as the C++ one... | ||
ecm_add_wayland_client_protocol(WAYLAND_PLATFORM_SRCS | ||
PROTOCOL "${WAYLAND_PROTOCOLS_PKGDATADIR}/stable/xdg-shell/xdg-shell.xml" | ||
BASENAME xdg-shell) | ||
ecm_add_wayland_client_protocol(WAYLAND_PLATFORM_SRCS | ||
PROTOCOL "${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml" | ||
BASENAME xdg-decoration) | ||
add_library(duckstation-nogui-wayland-protocols STATIC ${WAYLAND_PLATFORM_SRCS}) | ||
target_include_directories(duckstation-nogui-wayland-protocols PUBLIC "${CMAKE_CURRENT_BINARY_DIR}") | ||
|
||
target_link_libraries(duckstation-nogui PRIVATE | ||
duckstation-nogui-wayland-protocols | ||
Wayland::Client | ||
XKBCommon::XKBCommon | ||
) | ||
endif() | ||
|
||
if(USE_DRMKMS AND USE_EVDEV) | ||
message(STATUS "Building VTY/DRM/KMS/EVDev NoGUI Platform.") | ||
target_compile_definitions(duckstation-nogui PRIVATE "NOGUI_PLATFORM_VTY=1" "WITH_DRMKMS=1") | ||
target_sources(duckstation-nogui PRIVATE | ||
vty_key_names.h | ||
vty_nogui_platform.cpp | ||
vty_nogui_platform.h | ||
) | ||
target_include_directories(duckstation-nogui PRIVATE ${LIBEVDEV_INCLUDE_DIRS}) | ||
target_link_libraries(duckstation-nogui PRIVATE ${LIBEVDEV_LIBRARIES}) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.