NoGUI: Build fix

This commit is contained in:
Stenzek
2023-10-02 21:33:54 +10:00
parent 6fd7eda68f
commit fb659d817e
5 changed files with 30 additions and 92 deletions

View File

@ -22,6 +22,21 @@ if(WIN32)
DEBUG_POSTFIX "-debug")
endif()
if(APPLE)
message(STATUS "Building Cocoa NoGUI Platform.")
set(COCOA_SOURCES PRIVATE
cocoa_key_names.h
cocoa_nogui_platform.mm
cocoa_nogui_platform.h
)
target_sources(duckstation-nogui PRIVATE ${COCOA_SOURCES})
find_library(QUARTZCORE_LIBRARY QuartzCore)
find_library(COCOA_LIBRARY Cocoa)
target_link_libraries(duckstation-nogui PRIVATE ${QUARTZCORE_LIBRARY} ${COCOA_LIBRARY})
set_source_files_properties(${COCOA_SOURCES} PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE)
endif()
if(ENABLE_X11)
message(STATUS "Building X11 NoGUI Platform.")
target_compile_definitions(duckstation-nogui PRIVATE "NOGUI_PLATFORM_X11=1")
@ -37,11 +52,13 @@ if(ENABLE_WAYLAND)
message(STATUS "Building Wayland NoGUI Platform.")
find_package(ECM REQUIRED NO_MODULE)
list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}")
find_package(Wayland REQUIRED Client)
find_package(WaylandScanner REQUIRED)
find_package(WaylandProtocols 1.15 REQUIRED)
find_package(XKBCommon REQUIRED)
find_package(X11 REQUIRED)
if (NOT X11_xkbcommon_FOUND)
message(FATAL_ERROR "XKBCommon is required.")
endif()
target_compile_definitions(duckstation-nogui PRIVATE "NOGUI_PLATFORM_WAYLAND=1")
target_sources(duckstation-nogui PRIVATE
@ -49,31 +66,21 @@ if(ENABLE_WAYLAND)
wayland_nogui_platform.h
)
# 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"
# Required protocols.
ecm_add_wayland_client_protocol(WAYLAND_PROTOCOL_SRCS
PROTOCOL "${WaylandProtocols_DATADIR}/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"
ecm_add_wayland_client_protocol(WAYLAND_PROTOCOL_SRCS
PROTOCOL "${WaylandProtocols_DATADIR}/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_sources(duckstation-nogui PRIVATE ${WAYLAND_PROTOCOL_SRCS})
target_include_directories(duckstation-nogui PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
# Disable PCH for protocol files, because they're C, and our PCH above is C++.
set_source_files_properties(${WAYLAND_PROTOCOL_SRCS} PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE)
target_link_libraries(duckstation-nogui PRIVATE
duckstation-nogui-wayland-protocols
Wayland::Client
XKBCommon::XKBCommon
X11::xkbcommon
)
endif()
if(APPLE)
message(STATUS "Building Cocoa NoGUI Platform.")
target_sources(duckstation-nogui PRIVATE
cocoa_key_names.h
cocoa_nogui_platform.mm
cocoa_nogui_platform.h
)
endif()

View File

@ -7,7 +7,6 @@
#include "common/string_util.h"
#include "common/threading.h"
#include "core/host.h"
#include "core/host_settings.h"
#include "nogui_host.h"
#include "nogui_platform.h"

View File

@ -12,7 +12,6 @@
#include "common/string_util.h"
#include "common/threading.h"
#include "core/host.h"
#include "core/host_settings.h"
#include "nogui_host.h"
#include "nogui_platform.h"