mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-11-12 14:57:20 +00:00
[client] build: add Windows platform composition
This commit is contained in:
@@ -21,20 +21,41 @@ include(CheckCCompilerFlag)
|
||||
include(CMakeDependentOption)
|
||||
include(FeatureSummary)
|
||||
|
||||
if(WIN32)
|
||||
set(LG_CLIENT_PLATFORM Windows)
|
||||
set(LG_CLIENT_PLATFORM_LINUX OFF)
|
||||
set(LG_CLIENT_PLATFORM_WINDOWS ON)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
set(LG_CLIENT_PLATFORM Linux)
|
||||
set(LG_CLIENT_PLATFORM_LINUX ON)
|
||||
set(LG_CLIENT_PLATFORM_WINDOWS OFF)
|
||||
else()
|
||||
message(FATAL_ERROR
|
||||
"The Looking Glass client does not support ${CMAKE_SYSTEM_NAME}")
|
||||
endif()
|
||||
|
||||
set(OPTIMIZE_FOR_NATIVE_DEFAULT ON)
|
||||
include(OptimizeForNative) # option(OPTIMIZE_FOR_NATIVE)
|
||||
include(UninstallTarget)
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(FONTCONFIG REQUIRED IMPORTED_TARGET fontconfig)
|
||||
pkg_check_modules(FUSE3 REQUIRED IMPORTED_TARGET fuse3>=3.10)
|
||||
if(LG_CLIENT_PLATFORM_LINUX)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(FONTCONFIG REQUIRED IMPORTED_TARGET fontconfig)
|
||||
pkg_check_modules(FUSE3 REQUIRED IMPORTED_TARGET fuse3>=3.10)
|
||||
endif()
|
||||
|
||||
option(ENABLE_OPENGL "Enable the OpenGL renderer" ON)
|
||||
option(ENABLE_OPENGL "Enable the OpenGL renderer"
|
||||
${LG_CLIENT_PLATFORM_LINUX})
|
||||
add_feature_info(ENABLE_OPENGL ENABLE_OPENGL "Legacy OpenGL renderer.")
|
||||
|
||||
option(ENABLE_EGL "Enable the EGL renderer" ON)
|
||||
option(ENABLE_EGL "Enable the EGL renderer" ON)
|
||||
add_feature_info(ENABLE_EGL ENABLE_EGL "EGL renderer.")
|
||||
|
||||
if(LG_CLIENT_PLATFORM_WINDOWS AND ENABLE_OPENGL)
|
||||
message(FATAL_ERROR
|
||||
"The legacy OpenGL renderer is not available on Windows; use EGL")
|
||||
endif()
|
||||
|
||||
option(ENABLE_TESTS "Build all client tests and test support" OFF)
|
||||
add_feature_info(ENABLE_TESTS ENABLE_TESTS
|
||||
"Client unit and integration tests with synthetic transport support.")
|
||||
@@ -59,8 +80,8 @@ option(ENABLE_AUDIO "Build with audio support" ON)
|
||||
cmake_dependent_option(
|
||||
ENABLE_PIPEWIRE
|
||||
"Build with PipeWire audio output support"
|
||||
ON
|
||||
"ENABLE_AUDIO"
|
||||
${LG_CLIENT_PLATFORM_LINUX}
|
||||
"ENABLE_AUDIO;LG_CLIENT_PLATFORM_LINUX"
|
||||
OFF
|
||||
)
|
||||
add_feature_info(ENABLE_PIPEWIRE ENABLE_PIPEWIRE "PipeWire audio support.")
|
||||
@@ -68,23 +89,37 @@ add_feature_info(ENABLE_PIPEWIRE ENABLE_PIPEWIRE "PipeWire audio support.")
|
||||
cmake_dependent_option(
|
||||
ENABLE_PULSEAUDIO
|
||||
"Build with PulseAudio audio output support"
|
||||
ON
|
||||
"ENABLE_AUDIO"
|
||||
${LG_CLIENT_PLATFORM_LINUX}
|
||||
"ENABLE_AUDIO;LG_CLIENT_PLATFORM_LINUX"
|
||||
OFF
|
||||
)
|
||||
add_feature_info(ENABLE_PULSEAUDIO ENABLE_PULSEAUDIO "PulseAudio audio support.")
|
||||
|
||||
if(ENABLE_AUDIO AND NOT (ENABLE_PIPEWIRE OR ENABLE_PULSEAUDIO))
|
||||
cmake_dependent_option(
|
||||
ENABLE_WASAPI
|
||||
"Build with WASAPI audio support"
|
||||
${LG_CLIENT_PLATFORM_WINDOWS}
|
||||
"ENABLE_AUDIO;LG_CLIENT_PLATFORM_WINDOWS"
|
||||
OFF
|
||||
)
|
||||
add_feature_info(ENABLE_WASAPI ENABLE_WASAPI "WASAPI audio support.")
|
||||
|
||||
if(ENABLE_AUDIO AND NOT
|
||||
(ENABLE_PIPEWIRE OR ENABLE_PULSEAUDIO OR ENABLE_WASAPI))
|
||||
message(STATUS "No audio backends enabled, disabling audio support")
|
||||
set(ENABLE_AUDIO OFF)
|
||||
endif()
|
||||
add_feature_info(ENABLE_AUDIO ENABLE_AUDIO "Audio support.")
|
||||
|
||||
option(ENABLE_SPICE "Build with SPICE transport support"
|
||||
${LG_CLIENT_PLATFORM_LINUX})
|
||||
add_feature_info(ENABLE_SPICE ENABLE_SPICE "SPICE transport support.")
|
||||
|
||||
cmake_dependent_option(
|
||||
ENABLE_USB_AUDIO
|
||||
"Build with USB audio support"
|
||||
ON
|
||||
"ENABLE_AUDIO"
|
||||
${LG_CLIENT_PLATFORM_LINUX}
|
||||
"ENABLE_AUDIO;ENABLE_SPICE;LG_CLIENT_PLATFORM_LINUX"
|
||||
OFF
|
||||
)
|
||||
|
||||
@@ -125,6 +160,12 @@ endif()
|
||||
set(EXE_FLAGS "-Wl,--gc-sections -z noexecstack")
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
|
||||
if(LG_CLIENT_PLATFORM_WINDOWS)
|
||||
set(EXE_FLAGS "-Wl,--gc-sections -Wl,--nxcompat")
|
||||
add_compile_options("-fdebug-prefix-map=${PROJECT_TOP}/=")
|
||||
add_compile_definitions(__USE_MINGW_ANSI_STDIO=0)
|
||||
endif()
|
||||
|
||||
if (ENABLE_OPENGL)
|
||||
add_definitions(-D ENABLE_OPENGL)
|
||||
endif()
|
||||
@@ -148,6 +189,7 @@ add_definitions(-D GL_GLEXT_PROTOTYPES)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/version.c
|
||||
${CMAKE_BINARY_DIR}/include/version.h
|
||||
${CMAKE_BINARY_DIR}/_version.c
|
||||
COMMAND ${CMAKE_COMMAND} -D PROJECT_TOP=${PROJECT_TOP} -P
|
||||
${PROJECT_TOP}/version.cmake
|
||||
@@ -163,10 +205,15 @@ include_directories(
|
||||
|
||||
link_libraries(
|
||||
${CMAKE_DL_LIBS}
|
||||
rt
|
||||
m
|
||||
)
|
||||
|
||||
if(LG_CLIENT_PLATFORM_LINUX)
|
||||
link_libraries(
|
||||
rt
|
||||
m
|
||||
)
|
||||
endif()
|
||||
|
||||
set(SOURCES
|
||||
${CMAKE_BINARY_DIR}/version.c
|
||||
src/main.c
|
||||
@@ -178,16 +225,12 @@ set(SOURCES
|
||||
src/font.c
|
||||
src/util.c
|
||||
src/clipboard.c
|
||||
src/clipboard_files.c
|
||||
src/kb.c
|
||||
src/kb_hid.c
|
||||
src/gl_dynprocs.c
|
||||
src/egl_dynprocs.c
|
||||
src/eglutil.c
|
||||
src/frame_scheduler.c
|
||||
src/overlay_utils.c
|
||||
src/render_queue.c
|
||||
src/evdev.c
|
||||
src/transport.c
|
||||
src/fallback.c
|
||||
src/sw_surface.c
|
||||
@@ -203,6 +246,14 @@ set(SOURCES
|
||||
src/overlay/status.c
|
||||
)
|
||||
|
||||
if(ENABLE_OPENGL)
|
||||
list(APPEND SOURCES src/gl_dynprocs.c)
|
||||
endif()
|
||||
|
||||
if(ENABLE_EGL)
|
||||
list(APPEND SOURCES src/egl_dynprocs.c)
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
|
||||
set_source_files_properties(src/overlay/graphs.c PROPERTIES
|
||||
COMPILE_FLAGS "-fno-fast-math"
|
||||
@@ -220,43 +271,63 @@ add_subdirectory("${PROJECT_TOP}/common" "${CMAKE_BINARY_DIR}/common"
|
||||
add_subdirectory("${PROJECT_TOP}/repos/LGMP/lgmp" "${CMAKE_BINARY_DIR}/LGMP" )
|
||||
add_subdirectory("${PROJECT_TOP}/repos/gui" "${CMAKE_BINARY_DIR}/gui" EXCLUDE_FROM_ALL)
|
||||
|
||||
if(LG_CLIENT_PLATFORM_WINDOWS AND ENABLE_EGL AND
|
||||
NOT LG_EGL_PROVIDER_TARGET)
|
||||
find_package(ANGLE REQUIRED)
|
||||
endif()
|
||||
|
||||
add_subdirectory(platform)
|
||||
add_subdirectory(displayservers)
|
||||
add_subdirectory(renderers)
|
||||
add_subdirectory(transports)
|
||||
add_subdirectory(audiodevs)
|
||||
|
||||
configure_file("${PROJECT_TOP}/resources/looking-glass-client.desktop.in" "${CMAKE_BINARY_DIR}/resources/looking-glass-client.desktop" @ONLY)
|
||||
add_executable(looking-glass-client ${SOURCES})
|
||||
if(LG_CLIENT_PLATFORM_WINDOWS)
|
||||
set(CLIENT_RESOURCE "platform/Windows/resource.rc")
|
||||
set_source_files_properties(${CLIENT_RESOURCE} PROPERTIES
|
||||
OBJECT_DEPENDS
|
||||
"${PROJECT_SOURCE_DIR}/platform/Windows/app.manifest;${PROJECT_TOP}/resources/icon.ico;${CMAKE_BINARY_DIR}/include/version.h"
|
||||
)
|
||||
add_executable(looking-glass-client WIN32 ${CLIENT_RESOURCE} ${SOURCES})
|
||||
else()
|
||||
configure_file(
|
||||
"${PROJECT_TOP}/resources/looking-glass-client.desktop.in"
|
||||
"${CMAKE_BINARY_DIR}/resources/looking-glass-client.desktop"
|
||||
@ONLY
|
||||
)
|
||||
add_executable(looking-glass-client ${SOURCES})
|
||||
endif()
|
||||
|
||||
target_compile_definitions(looking-glass-client PRIVATE CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1)
|
||||
|
||||
if(NOT CMAKE_OBJCOPY)
|
||||
message(FATAL_ERROR "objcopy is required to generate the client debug file")
|
||||
if(LG_CLIENT_PLATFORM_LINUX)
|
||||
if(NOT CMAKE_OBJCOPY)
|
||||
message(FATAL_ERROR "objcopy is required to generate the client debug file")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_STRIP)
|
||||
message(FATAL_ERROR "strip is required to generate the client debug file")
|
||||
endif()
|
||||
|
||||
set(CLIENT_DEBUG_FILE
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/looking-glass-client.debug")
|
||||
|
||||
add_custom_command(TARGET looking-glass-client POST_BUILD
|
||||
COMMAND "${CMAKE_OBJCOPY}" --only-keep-debug
|
||||
"$<TARGET_FILE:looking-glass-client>" "${CLIENT_DEBUG_FILE}"
|
||||
COMMAND "${CMAKE_STRIP}" --strip-debug
|
||||
"$<TARGET_FILE:looking-glass-client>"
|
||||
COMMAND "${CMAKE_OBJCOPY}" "--add-gnu-debuglink=${CLIENT_DEBUG_FILE}"
|
||||
"$<TARGET_FILE:looking-glass-client>"
|
||||
COMMENT "Extracting Looking Glass client debug information"
|
||||
VERBATIM
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_STRIP)
|
||||
message(FATAL_ERROR "strip is required to generate the client debug file")
|
||||
endif()
|
||||
|
||||
set(CLIENT_DEBUG_FILE
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/looking-glass-client.debug")
|
||||
|
||||
add_custom_command(TARGET looking-glass-client POST_BUILD
|
||||
COMMAND "${CMAKE_OBJCOPY}" --only-keep-debug
|
||||
"$<TARGET_FILE:looking-glass-client>" "${CLIENT_DEBUG_FILE}"
|
||||
COMMAND "${CMAKE_STRIP}" --strip-debug "$<TARGET_FILE:looking-glass-client>"
|
||||
COMMAND "${CMAKE_OBJCOPY}" "--add-gnu-debuglink=${CLIENT_DEBUG_FILE}"
|
||||
"$<TARGET_FILE:looking-glass-client>"
|
||||
COMMENT "Extracting Looking Glass client debug information"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
target_link_libraries(looking-glass-client
|
||||
${EXE_FLAGS}
|
||||
PkgConfig::FONTCONFIG
|
||||
PkgConfig::FUSE3
|
||||
lg_resources
|
||||
lg_common
|
||||
client_platform
|
||||
displayservers
|
||||
renderers
|
||||
transports
|
||||
@@ -264,6 +335,8 @@ target_link_libraries(looking-glass-client
|
||||
lg_gui
|
||||
)
|
||||
|
||||
set_target_properties(looking-glass-client PROPERTIES LINK_FLAGS "${EXE_FLAGS}")
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
@@ -272,9 +345,15 @@ endif()
|
||||
|
||||
if(ENABLE_AUDIO)
|
||||
target_compile_definitions(looking-glass-client PRIVATE ENABLE_AUDIO)
|
||||
pkg_check_modules(SAMPLERATE REQUIRED IMPORTED_TARGET samplerate)
|
||||
if(LG_CLIENT_PLATFORM_WINDOWS)
|
||||
find_package(SampleRate REQUIRED)
|
||||
set(SAMPLERATE_TARGET SampleRate::samplerate)
|
||||
else()
|
||||
pkg_check_modules(SAMPLERATE REQUIRED IMPORTED_TARGET samplerate)
|
||||
set(SAMPLERATE_TARGET PkgConfig::SAMPLERATE)
|
||||
endif()
|
||||
target_link_libraries(looking-glass-client
|
||||
PkgConfig::SAMPLERATE
|
||||
${SAMPLERATE_TARGET}
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -282,14 +361,16 @@ install(TARGETS looking-glass-client
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT binary)
|
||||
|
||||
install(FILES "${CLIENT_DEBUG_FILE}"
|
||||
DESTINATION "${CMAKE_INSTALL_BINDIR}/.debug"
|
||||
COMPONENT binary)
|
||||
if(LG_CLIENT_PLATFORM_LINUX)
|
||||
install(FILES "${CLIENT_DEBUG_FILE}"
|
||||
DESTINATION "${CMAKE_INSTALL_BINDIR}/.debug"
|
||||
COMPONENT binary)
|
||||
|
||||
install(FILES "${CMAKE_BINARY_DIR}/resources/looking-glass-client.desktop"
|
||||
install(FILES "${CMAKE_BINARY_DIR}/resources/looking-glass-client.desktop"
|
||||
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
|
||||
install(FILES "${PROJECT_TOP}/resources/lg-logo.svg"
|
||||
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps"
|
||||
RENAME "looking-glass.svg")
|
||||
install(FILES "${PROJECT_TOP}/resources/lg-logo.svg"
|
||||
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps"
|
||||
RENAME "looking-glass.svg")
|
||||
endif()
|
||||
|
||||
feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
|
||||
|
||||
@@ -25,6 +25,9 @@ endif()
|
||||
if(ENABLE_PULSEAUDIO)
|
||||
add_audiodev(PulseAudio)
|
||||
endif()
|
||||
if(ENABLE_WASAPI)
|
||||
add_audiodev(WASAPI)
|
||||
endif()
|
||||
|
||||
list(REMOVE_AT AUDIODEVS 0)
|
||||
list(REMOVE_AT AUDIODEVS_LINK 0)
|
||||
|
||||
70
client/cmake/FindANGLE.cmake
Normal file
70
client/cmake/FindANGLE.cmake
Normal file
@@ -0,0 +1,70 @@
|
||||
set(ANGLE_ROOT "" CACHE PATH "Root of a prebuilt ANGLE distribution")
|
||||
|
||||
if(ANGLE_ROOT)
|
||||
set(_ANGLE_HINTS HINTS "${ANGLE_ROOT}")
|
||||
set(_ANGLE_FIND_POLICY NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
|
||||
endif()
|
||||
|
||||
find_path(ANGLE_EGL_INCLUDE_DIR
|
||||
NAMES EGL/egl.h
|
||||
${_ANGLE_HINTS}
|
||||
PATH_SUFFIXES include
|
||||
${_ANGLE_FIND_POLICY}
|
||||
)
|
||||
|
||||
find_path(ANGLE_GLES_INCLUDE_DIR
|
||||
NAMES GLES3/gl32.h
|
||||
${_ANGLE_HINTS}
|
||||
PATH_SUFFIXES include
|
||||
${_ANGLE_FIND_POLICY}
|
||||
)
|
||||
|
||||
find_library(ANGLE_EGL_LIBRARY
|
||||
NAMES EGL libEGL
|
||||
${_ANGLE_HINTS}
|
||||
PATH_SUFFIXES lib lib64
|
||||
${_ANGLE_FIND_POLICY}
|
||||
)
|
||||
|
||||
find_library(ANGLE_GLESV2_LIBRARY
|
||||
NAMES GLESv2 libGLESv2
|
||||
${_ANGLE_HINTS}
|
||||
PATH_SUFFIXES lib lib64
|
||||
${_ANGLE_FIND_POLICY}
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ANGLE
|
||||
REQUIRED_VARS
|
||||
ANGLE_EGL_INCLUDE_DIR
|
||||
ANGLE_GLES_INCLUDE_DIR
|
||||
ANGLE_EGL_LIBRARY
|
||||
ANGLE_GLESV2_LIBRARY
|
||||
)
|
||||
|
||||
mark_as_advanced(
|
||||
ANGLE_EGL_INCLUDE_DIR
|
||||
ANGLE_GLES_INCLUDE_DIR
|
||||
ANGLE_EGL_LIBRARY
|
||||
ANGLE_GLESV2_LIBRARY
|
||||
)
|
||||
|
||||
if(ANGLE_FOUND AND NOT TARGET ANGLE::GLESv2)
|
||||
add_library(ANGLE::GLESv2 UNKNOWN IMPORTED)
|
||||
set_target_properties(ANGLE::GLESv2 PROPERTIES
|
||||
IMPORTED_LOCATION "${ANGLE_GLESV2_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${ANGLE_GLES_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ANGLE_FOUND AND NOT TARGET ANGLE::EGL)
|
||||
add_library(ANGLE::EGL UNKNOWN IMPORTED)
|
||||
set_target_properties(ANGLE::EGL PROPERTIES
|
||||
IMPORTED_LOCATION "${ANGLE_EGL_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${ANGLE_EGL_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES ANGLE::GLESv2
|
||||
)
|
||||
endif()
|
||||
|
||||
unset(_ANGLE_HINTS)
|
||||
unset(_ANGLE_FIND_POLICY)
|
||||
44
client/cmake/FindSampleRate.cmake
Normal file
44
client/cmake/FindSampleRate.cmake
Normal file
@@ -0,0 +1,44 @@
|
||||
set(SampleRate_ROOT "" CACHE PATH
|
||||
"Root of a prebuilt libsamplerate distribution")
|
||||
|
||||
if(SampleRate_ROOT)
|
||||
set(_SampleRate_HINTS HINTS "${SampleRate_ROOT}")
|
||||
set(_SampleRate_FIND_POLICY NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
|
||||
endif()
|
||||
|
||||
find_path(SampleRate_INCLUDE_DIR
|
||||
NAMES samplerate.h
|
||||
${_SampleRate_HINTS}
|
||||
PATH_SUFFIXES include
|
||||
${_SampleRate_FIND_POLICY}
|
||||
)
|
||||
|
||||
find_library(SampleRate_LIBRARY
|
||||
NAMES samplerate libsamplerate
|
||||
${_SampleRate_HINTS}
|
||||
PATH_SUFFIXES lib lib64
|
||||
${_SampleRate_FIND_POLICY}
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(SampleRate
|
||||
REQUIRED_VARS
|
||||
SampleRate_INCLUDE_DIR
|
||||
SampleRate_LIBRARY
|
||||
)
|
||||
|
||||
mark_as_advanced(
|
||||
SampleRate_INCLUDE_DIR
|
||||
SampleRate_LIBRARY
|
||||
)
|
||||
|
||||
if(SampleRate_FOUND AND NOT TARGET SampleRate::samplerate)
|
||||
add_library(SampleRate::samplerate UNKNOWN IMPORTED)
|
||||
set_target_properties(SampleRate::samplerate PROPERTIES
|
||||
IMPORTED_LOCATION "${SampleRate_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SampleRate_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
unset(_SampleRate_HINTS)
|
||||
unset(_SampleRate_FIND_POLICY)
|
||||
@@ -18,23 +18,27 @@ function(add_displayserver name)
|
||||
add_subdirectory(${name})
|
||||
endfunction()
|
||||
|
||||
option(ENABLE_X11 "Build with X11 support" ON)
|
||||
add_feature_info(ENABLE_X11 ENABLE_X11 "X11 support.")
|
||||
|
||||
option(ENABLE_WAYLAND "Build with Wayland support" ON)
|
||||
add_feature_info(ENABLE_WAYLAND ENABLE_WAYLAND "Wayland support.")
|
||||
|
||||
if (NOT ENABLE_X11 AND NOT ENABLE_WAYLAND)
|
||||
message(FATAL_ERROR "Either ENABLE_X11 or ENABLE_WAYLAND must be on")
|
||||
endif()
|
||||
|
||||
# Add/remove displayservers here!
|
||||
if (ENABLE_WAYLAND)
|
||||
add_displayserver(Wayland)
|
||||
endif()
|
||||
if(LG_CLIENT_PLATFORM_WINDOWS)
|
||||
add_displayserver(Windows)
|
||||
else()
|
||||
option(ENABLE_X11 "Build with X11 support" ON)
|
||||
add_feature_info(ENABLE_X11 ENABLE_X11 "X11 support.")
|
||||
|
||||
if (ENABLE_X11)
|
||||
add_displayserver(X11)
|
||||
option(ENABLE_WAYLAND "Build with Wayland support" ON)
|
||||
add_feature_info(ENABLE_WAYLAND ENABLE_WAYLAND "Wayland support.")
|
||||
|
||||
if(NOT ENABLE_X11 AND NOT ENABLE_WAYLAND)
|
||||
message(FATAL_ERROR "Either ENABLE_X11 or ENABLE_WAYLAND must be on")
|
||||
endif()
|
||||
|
||||
if(ENABLE_WAYLAND)
|
||||
add_displayserver(Wayland)
|
||||
endif()
|
||||
|
||||
if(ENABLE_X11)
|
||||
add_displayserver(X11)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(REMOVE_AT DISPLAYSERVERS 0)
|
||||
|
||||
9
client/platform/CMakeLists.txt
Normal file
9
client/platform/CMakeLists.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(client_platform LANGUAGES C)
|
||||
|
||||
add_subdirectory(${LG_CLIENT_PLATFORM})
|
||||
|
||||
add_library(client_platform INTERFACE)
|
||||
target_link_libraries(client_platform INTERFACE
|
||||
client_platform_${LG_CLIENT_PLATFORM}
|
||||
)
|
||||
27
client/platform/Linux/CMakeLists.txt
Normal file
27
client/platform/Linux/CMakeLists.txt
Normal file
@@ -0,0 +1,27 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(client_platform_Linux LANGUAGES C)
|
||||
|
||||
set(CLIENT_PLATFORM_LINUX_SOURCES
|
||||
../../src/clipboard_files.c
|
||||
../../src/evdev.c
|
||||
)
|
||||
|
||||
foreach(source IN ITEMS config.c font.c input.c process.c)
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${source}")
|
||||
list(APPEND CLIENT_PLATFORM_LINUX_SOURCES ${source})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
add_library(client_platform_Linux STATIC ${CLIENT_PLATFORM_LINUX_SOURCES})
|
||||
|
||||
target_link_libraries(client_platform_Linux
|
||||
PUBLIC
|
||||
lg_common
|
||||
PkgConfig::FONTCONFIG
|
||||
PkgConfig::FUSE3
|
||||
)
|
||||
|
||||
target_include_directories(client_platform_Linux
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../src
|
||||
)
|
||||
25
client/platform/Windows/CMakeLists.txt
Normal file
25
client/platform/Windows/CMakeLists.txt
Normal file
@@ -0,0 +1,25 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(client_platform_Windows LANGUAGES C)
|
||||
|
||||
add_library(client_platform_Windows STATIC
|
||||
clipboard_files.c
|
||||
config.c
|
||||
font.c
|
||||
input.c
|
||||
process.c
|
||||
)
|
||||
|
||||
target_link_libraries(client_platform_Windows
|
||||
PUBLIC
|
||||
lg_common
|
||||
dwrite
|
||||
ole32
|
||||
shell32
|
||||
shlwapi
|
||||
uuid
|
||||
)
|
||||
|
||||
target_include_directories(client_platform_Windows
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../src
|
||||
)
|
||||
30
client/platform/Windows/app.manifest
Normal file
30
client/platform/Windows/app.manifest
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
|
||||
xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"
|
||||
manifestVersion="1.0">
|
||||
<assemblyIdentity version="1.0.0.0"
|
||||
processorArchitecture="amd64"
|
||||
name="LookingGlass.Client"
|
||||
type="win32"/>
|
||||
<description>Looking Glass Client</description>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Windows 10 and Windows 11 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48d50a15a9a}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
|
||||
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
61
client/platform/Windows/resource.rc
Normal file
61
client/platform/Windows/resource.rc
Normal file
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2026 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., 59
|
||||
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <winuser.h>
|
||||
#include <winver.h>
|
||||
#include "version.h"
|
||||
|
||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "app.manifest"
|
||||
IDI_APPLICATION ICON "../../../resources/icon.ico"
|
||||
|
||||
#define STRINGIFY2(s) #s
|
||||
#define STRINGIFY(s) STRINGIFY2(s)
|
||||
#define COPYRIGHT_TEXT(year) \xa9 2017-year The Looking Glass Developers
|
||||
#define COPYRIGHT_STR(year) STRINGIFY(COPYRIGHT_TEXT(year))
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 0,0,0,0
|
||||
PRODUCTVERSION 0,0,0,0
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
FILEFLAGS 0
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_APP
|
||||
FILESUBTYPE VFT2_UNKNOWN
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904E4"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "The Looking Glass Developers"
|
||||
VALUE "FileDescription", "Looking Glass Client"
|
||||
VALUE "FileVersion", LG_VERSION_STR
|
||||
VALUE "InternalName", "looking-glass-client.exe"
|
||||
VALUE "LegalCopyright", COPYRIGHT_STR(LG_CURRENT_YEAR)
|
||||
VALUE "OriginalFilename", "looking-glass-client.exe"
|
||||
VALUE "ProductName", "Looking Glass Client"
|
||||
VALUE "ProductVersion", LG_VERSION_STR
|
||||
END
|
||||
END
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 0
|
||||
END
|
||||
END
|
||||
@@ -576,34 +576,36 @@ set_tests_properties(clipboard-files-mount PROPERTIES
|
||||
SKIP_RETURN_CODE 77
|
||||
)
|
||||
|
||||
add_executable(spice-clipboard-tests
|
||||
spice_clipboard_test.c
|
||||
clipboard_files_stub.c
|
||||
../src/clipboard.c
|
||||
../transports/SPICE/clipboard.c
|
||||
)
|
||||
target_compile_definitions(spice-clipboard-tests PRIVATE
|
||||
CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1
|
||||
)
|
||||
target_include_directories(spice-clipboard-tests PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../src"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../transports/SPICE"
|
||||
"${PROJECT_TOP}/repos/PureSpice/include"
|
||||
"${PROJECT_TOP}/repos/gui/cimgui"
|
||||
"${PROJECT_TOP}/repos/gui/cimgui/imgui"
|
||||
)
|
||||
target_link_libraries(spice-clipboard-tests
|
||||
${EXE_FLAGS}
|
||||
lg_common
|
||||
)
|
||||
foreach(name IN ITEMS outbound inbound)
|
||||
add_test(NAME spice-clipboard-${name}
|
||||
COMMAND spice-clipboard-tests ${name}
|
||||
if(ENABLE_SPICE)
|
||||
add_executable(spice-clipboard-tests
|
||||
spice_clipboard_test.c
|
||||
clipboard_files_stub.c
|
||||
../src/clipboard.c
|
||||
../transports/SPICE/clipboard.c
|
||||
)
|
||||
set_tests_properties(spice-clipboard-${name} PROPERTIES
|
||||
TIMEOUT 10
|
||||
target_compile_definitions(spice-clipboard-tests PRIVATE
|
||||
CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1
|
||||
)
|
||||
endforeach()
|
||||
target_include_directories(spice-clipboard-tests PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../src"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../transports/SPICE"
|
||||
"${PROJECT_TOP}/repos/PureSpice/include"
|
||||
"${PROJECT_TOP}/repos/gui/cimgui"
|
||||
"${PROJECT_TOP}/repos/gui/cimgui/imgui"
|
||||
)
|
||||
target_link_libraries(spice-clipboard-tests
|
||||
${EXE_FLAGS}
|
||||
lg_common
|
||||
)
|
||||
foreach(name IN ITEMS outbound inbound)
|
||||
add_test(NAME spice-clipboard-${name}
|
||||
COMMAND spice-clipboard-tests ${name}
|
||||
)
|
||||
set_tests_properties(spice-clipboard-${name} PROPERTIES
|
||||
TIMEOUT 10
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
add_executable(transport-fallback-tests
|
||||
transport_fallback_test.c
|
||||
@@ -648,67 +650,69 @@ foreach(name IN LISTS TRANSPORT_FALLBACK_CASES)
|
||||
)
|
||||
endforeach()
|
||||
|
||||
add_executable(spice-tests
|
||||
spice_test.c
|
||||
../transports/SPICE/session.c
|
||||
../transports/SPICE/spice.c
|
||||
../transports/SPICE/surface.c
|
||||
)
|
||||
target_compile_definitions(spice-tests PRIVATE
|
||||
ENABLE_AUDIO=0
|
||||
ENABLE_USB_AUDIO=0
|
||||
)
|
||||
target_include_directories(spice-tests PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../transports/SPICE"
|
||||
"${PROJECT_TOP}/repos/PureSpice/include"
|
||||
)
|
||||
target_link_libraries(spice-tests
|
||||
${EXE_FLAGS}
|
||||
lg_common
|
||||
)
|
||||
set(SPICE_CASES
|
||||
connect-fail
|
||||
pre-ready-drop
|
||||
cancel
|
||||
ready-drop
|
||||
session-order
|
||||
surface-active
|
||||
surface-cancel
|
||||
surface-events
|
||||
surface-detach
|
||||
)
|
||||
foreach(name IN LISTS SPICE_CASES)
|
||||
add_test(NAME spice-${name}
|
||||
COMMAND spice-tests ${name}
|
||||
if(ENABLE_SPICE)
|
||||
add_executable(spice-tests
|
||||
spice_test.c
|
||||
../transports/SPICE/session.c
|
||||
../transports/SPICE/spice.c
|
||||
../transports/SPICE/surface.c
|
||||
)
|
||||
set_tests_properties(spice-${name} PROPERTIES
|
||||
TIMEOUT 10
|
||||
target_compile_definitions(spice-tests PRIVATE
|
||||
ENABLE_AUDIO=0
|
||||
ENABLE_USB_AUDIO=0
|
||||
)
|
||||
endforeach()
|
||||
target_include_directories(spice-tests PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../transports/SPICE"
|
||||
"${PROJECT_TOP}/repos/PureSpice/include"
|
||||
)
|
||||
target_link_libraries(spice-tests
|
||||
${EXE_FLAGS}
|
||||
lg_common
|
||||
)
|
||||
set(SPICE_CASES
|
||||
connect-fail
|
||||
pre-ready-drop
|
||||
cancel
|
||||
ready-drop
|
||||
session-order
|
||||
surface-active
|
||||
surface-cancel
|
||||
surface-events
|
||||
surface-detach
|
||||
)
|
||||
foreach(name IN LISTS SPICE_CASES)
|
||||
add_test(NAME spice-${name}
|
||||
COMMAND spice-tests ${name}
|
||||
)
|
||||
set_tests_properties(spice-${name} PROPERTIES
|
||||
TIMEOUT 10
|
||||
)
|
||||
endforeach()
|
||||
|
||||
add_executable(purespice-connect-cancel-tests
|
||||
purespice_connect_cancel_test.c
|
||||
)
|
||||
target_compile_definitions(purespice PRIVATE PURESPICE_TESTING)
|
||||
target_compile_definitions(purespice-connect-cancel-tests PRIVATE
|
||||
PURESPICE_TESTING
|
||||
)
|
||||
target_include_directories(purespice-connect-cancel-tests PRIVATE
|
||||
"${PROJECT_TOP}/repos/PureSpice/include"
|
||||
"${PROJECT_TOP}/repos/PureSpice/src"
|
||||
"$<TARGET_PROPERTY:purespice,INCLUDE_DIRECTORIES>"
|
||||
)
|
||||
target_link_libraries(purespice-connect-cancel-tests
|
||||
${EXE_FLAGS}
|
||||
purespice
|
||||
pthread
|
||||
)
|
||||
add_test(NAME purespice-connect-cancel
|
||||
COMMAND purespice-connect-cancel-tests
|
||||
)
|
||||
set_tests_properties(purespice-connect-cancel PROPERTIES
|
||||
TIMEOUT 5
|
||||
)
|
||||
add_executable(purespice-connect-cancel-tests
|
||||
purespice_connect_cancel_test.c
|
||||
)
|
||||
target_compile_definitions(purespice PRIVATE PURESPICE_TESTING)
|
||||
target_compile_definitions(purespice-connect-cancel-tests PRIVATE
|
||||
PURESPICE_TESTING
|
||||
)
|
||||
target_include_directories(purespice-connect-cancel-tests PRIVATE
|
||||
"${PROJECT_TOP}/repos/PureSpice/include"
|
||||
"${PROJECT_TOP}/repos/PureSpice/src"
|
||||
"$<TARGET_PROPERTY:purespice,INCLUDE_DIRECTORIES>"
|
||||
)
|
||||
target_link_libraries(purespice-connect-cancel-tests
|
||||
${EXE_FLAGS}
|
||||
purespice
|
||||
pthread
|
||||
)
|
||||
add_test(NAME purespice-connect-cancel
|
||||
COMMAND purespice-connect-cancel-tests
|
||||
)
|
||||
set_tests_properties(purespice-connect-cancel PROPERTIES
|
||||
TIMEOUT 5
|
||||
)
|
||||
endif()
|
||||
|
||||
add_executable(frame-scheduler-tests
|
||||
frame_scheduler_test.c
|
||||
|
||||
1
client/toolchain-mingw64.cmake
Normal file
1
client/toolchain-mingw64.cmake
Normal file
@@ -0,0 +1 @@
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/../cmake/toolchains/mingw64-windows.cmake")
|
||||
@@ -20,7 +20,9 @@ endfunction()
|
||||
|
||||
# Add/remove transports here!
|
||||
add_transport(LGMP)
|
||||
add_transport(SPICE)
|
||||
if(ENABLE_SPICE)
|
||||
add_transport(SPICE)
|
||||
endif()
|
||||
if(ENABLE_TESTS)
|
||||
add_transport(Test)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user