mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-24 14:45:41 +00:00
NoGUI: Build fix
This commit is contained in:
parent
6fd7eda68f
commit
fb659d817e
|
@ -1,29 +0,0 @@
|
||||||
# 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})
|
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
# - 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()
|
|
|
@ -22,6 +22,21 @@ if(WIN32)
|
||||||
DEBUG_POSTFIX "-debug")
|
DEBUG_POSTFIX "-debug")
|
||||||
endif()
|
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)
|
if(ENABLE_X11)
|
||||||
message(STATUS "Building X11 NoGUI Platform.")
|
message(STATUS "Building X11 NoGUI Platform.")
|
||||||
target_compile_definitions(duckstation-nogui PRIVATE "NOGUI_PLATFORM_X11=1")
|
target_compile_definitions(duckstation-nogui PRIVATE "NOGUI_PLATFORM_X11=1")
|
||||||
|
@ -37,11 +52,13 @@ if(ENABLE_WAYLAND)
|
||||||
message(STATUS "Building Wayland NoGUI Platform.")
|
message(STATUS "Building Wayland NoGUI Platform.")
|
||||||
find_package(ECM REQUIRED NO_MODULE)
|
find_package(ECM REQUIRED NO_MODULE)
|
||||||
list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}")
|
list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}")
|
||||||
|
|
||||||
find_package(Wayland REQUIRED Client)
|
find_package(Wayland REQUIRED Client)
|
||||||
find_package(WaylandScanner REQUIRED)
|
find_package(WaylandScanner REQUIRED)
|
||||||
find_package(WaylandProtocols 1.15 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_compile_definitions(duckstation-nogui PRIVATE "NOGUI_PLATFORM_WAYLAND=1")
|
||||||
target_sources(duckstation-nogui PRIVATE
|
target_sources(duckstation-nogui PRIVATE
|
||||||
|
@ -49,31 +66,21 @@ if(ENABLE_WAYLAND)
|
||||||
wayland_nogui_platform.h
|
wayland_nogui_platform.h
|
||||||
)
|
)
|
||||||
|
|
||||||
# Generate the xdg-shell and xdg-decoration protocols at build-time.
|
# Required protocols.
|
||||||
# Because these are C, not C++, we have to put them in their own library, otherwise
|
ecm_add_wayland_client_protocol(WAYLAND_PROTOCOL_SRCS
|
||||||
# cmake tries to generate a C PCH as well as the C++ one...
|
PROTOCOL "${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml"
|
||||||
ecm_add_wayland_client_protocol(WAYLAND_PLATFORM_SRCS
|
|
||||||
PROTOCOL "${WAYLAND_PROTOCOLS_PKGDATADIR}/stable/xdg-shell/xdg-shell.xml"
|
|
||||||
BASENAME xdg-shell)
|
BASENAME xdg-shell)
|
||||||
ecm_add_wayland_client_protocol(WAYLAND_PLATFORM_SRCS
|
ecm_add_wayland_client_protocol(WAYLAND_PROTOCOL_SRCS
|
||||||
PROTOCOL "${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml"
|
PROTOCOL "${WaylandProtocols_DATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml"
|
||||||
BASENAME xdg-decoration)
|
BASENAME xdg-decoration)
|
||||||
add_library(duckstation-nogui-wayland-protocols STATIC ${WAYLAND_PLATFORM_SRCS})
|
target_sources(duckstation-nogui PRIVATE ${WAYLAND_PROTOCOL_SRCS})
|
||||||
target_include_directories(duckstation-nogui-wayland-protocols PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
|
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
|
target_link_libraries(duckstation-nogui PRIVATE
|
||||||
duckstation-nogui-wayland-protocols
|
|
||||||
Wayland::Client
|
Wayland::Client
|
||||||
XKBCommon::XKBCommon
|
X11::xkbcommon
|
||||||
)
|
)
|
||||||
endif()
|
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()
|
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "common/threading.h"
|
#include "common/threading.h"
|
||||||
#include "core/host.h"
|
#include "core/host.h"
|
||||||
#include "core/host_settings.h"
|
|
||||||
#include "nogui_host.h"
|
#include "nogui_host.h"
|
||||||
#include "nogui_platform.h"
|
#include "nogui_platform.h"
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "common/threading.h"
|
#include "common/threading.h"
|
||||||
#include "core/host.h"
|
#include "core/host.h"
|
||||||
#include "core/host_settings.h"
|
|
||||||
#include "nogui_host.h"
|
#include "nogui_host.h"
|
||||||
#include "nogui_platform.h"
|
#include "nogui_platform.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue