mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-02 05:12:02 +00:00
[client] audio: enable building without audio support
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled
build / render-tests (push) Has been cancelled
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled
build / render-tests (push) Has been cancelled
Fixes #1183
This commit is contained in:
@@ -18,6 +18,7 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_TOP}/cmake/" "${PROJECT_SOURCE_DIR}/cma
|
||||
include(CheckSubmodule)
|
||||
include(GNUInstallDirs)
|
||||
include(CheckCCompilerFlag)
|
||||
include(CMakeDependentOption)
|
||||
include(FeatureSummary)
|
||||
|
||||
set(OPTIMIZE_FOR_NATIVE_DEFAULT ON)
|
||||
@@ -59,12 +60,32 @@ add_feature_info(ENABLE_ASAN ENABLE_ASAN "AddressSanitizer support.")
|
||||
option(ENABLE_UBSAN "Build with UndefinedBehaviorSanitizer" OFF)
|
||||
add_feature_info(ENABLE_UBSAN ENABLE_UBSAN "UndefinedBehaviorSanitizer support.")
|
||||
|
||||
option(ENABLE_PIPEWIRE "Build with PipeWire audio output support" ON)
|
||||
option(ENABLE_AUDIO "Build with audio support" ON)
|
||||
|
||||
cmake_dependent_option(
|
||||
ENABLE_PIPEWIRE
|
||||
"Build with PipeWire audio output support"
|
||||
ON
|
||||
"ENABLE_AUDIO"
|
||||
OFF
|
||||
)
|
||||
add_feature_info(ENABLE_PIPEWIRE ENABLE_PIPEWIRE "PipeWire audio support.")
|
||||
|
||||
option(ENABLE_PULSEAUDIO "Build with PulseAudio audio output support" ON)
|
||||
cmake_dependent_option(
|
||||
ENABLE_PULSEAUDIO
|
||||
"Build with PulseAudio audio output support"
|
||||
ON
|
||||
"ENABLE_AUDIO"
|
||||
OFF
|
||||
)
|
||||
add_feature_info(ENABLE_PULSEAUDIO ENABLE_PULSEAUDIO "PulseAudio audio support.")
|
||||
|
||||
if(ENABLE_AUDIO AND NOT (ENABLE_PIPEWIRE OR ENABLE_PULSEAUDIO))
|
||||
message(STATUS "No audio backends enabled, disabling audio support")
|
||||
set(ENABLE_AUDIO OFF)
|
||||
endif()
|
||||
add_feature_info(ENABLE_AUDIO ENABLE_AUDIO "Audio support.")
|
||||
|
||||
add_compile_options(
|
||||
"-Wall"
|
||||
"-Wextra"
|
||||
@@ -139,7 +160,6 @@ set(SOURCES
|
||||
src/core.c
|
||||
src/app.c
|
||||
src/message.c
|
||||
src/audio.c
|
||||
src/config.c
|
||||
src/keybind.c
|
||||
src/util.c
|
||||
@@ -163,6 +183,10 @@ set(SOURCES
|
||||
src/overlay/status.c
|
||||
)
|
||||
|
||||
if(ENABLE_AUDIO)
|
||||
list(APPEND SOURCES src/audio.c)
|
||||
endif()
|
||||
|
||||
# Force cimgui to build as a static library.
|
||||
set(IMGUI_STATIC "yes" CACHE STRING "Build as a static library")
|
||||
# Support Unicode codepoints outside the basic multilingual plane.
|
||||
@@ -179,6 +203,7 @@ add_subdirectory("${PROJECT_TOP}/repos/cimgui" "${CMAKE_BINARY_DIR}/cimgui" E
|
||||
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})
|
||||
@@ -215,6 +240,7 @@ target_link_libraries(looking-glass-client
|
||||
purespice
|
||||
renderers
|
||||
transports
|
||||
audiodevs
|
||||
cimgui
|
||||
)
|
||||
|
||||
@@ -224,13 +250,11 @@ if(ENABLE_RENDER_TESTS)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
if (ENABLE_PIPEWIRE OR ENABLE_PULSEAUDIO)
|
||||
add_definitions(-D ENABLE_AUDIO)
|
||||
add_subdirectory(audiodevs)
|
||||
if(ENABLE_AUDIO)
|
||||
target_compile_definitions(looking-glass-client PRIVATE ENABLE_AUDIO)
|
||||
pkg_check_modules(SAMPLERATE REQUIRED IMPORTED_TARGET samplerate)
|
||||
target_link_libraries(looking-glass-client
|
||||
PkgConfig::SAMPLERATE
|
||||
audiodevs
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ foreach(audiodev ${AUDIODEVS})
|
||||
file(APPEND ${AUDIODEV_C} "extern struct LG_AudioDevOps LGAD_${audiodev};\n")
|
||||
endforeach()
|
||||
|
||||
file(APPEND ${AUDIODEV_C} "\nconst struct LG_AudioDevOps * LG_AudioDevs[] =\n{\n")
|
||||
file(APPEND ${AUDIODEV_C} "\nstruct LG_AudioDevOps * LG_AudioDevs[] =\n{\n")
|
||||
foreach(audiodev ${AUDIODEVS})
|
||||
file(APPEND ${AUDIODEV_C} " &LGAD_${audiodev},\n")
|
||||
endforeach()
|
||||
|
||||
@@ -1809,7 +1809,7 @@ int main(int argc, char * argv[])
|
||||
for(unsigned int i = 0; i < LG_DISPLAYSERVER_COUNT; ++i)
|
||||
LG_DisplayServers[i]->setup();
|
||||
|
||||
for(unsigned int i = 0; i < LG_AUDIODEV_COUNT; ++i)
|
||||
for(unsigned int i = 0; LG_AudioDevs[i]; ++i)
|
||||
if (LG_AudioDevs[i]->earlyInit)
|
||||
LG_AudioDevs[i]->earlyInit();
|
||||
|
||||
|
||||
@@ -108,15 +108,21 @@ feature is disabled when running :ref:`cmake <client_building>`.
|
||||
- ``libwayland-bin``
|
||||
- ``libwayland-dev``
|
||||
|
||||
- Disable all audio support with ``cmake -DENABLE_AUDIO=no ..``
|
||||
|
||||
- ``libpipewire-0.3-dev``
|
||||
- ``libpulse-dev``
|
||||
- ``libsamplerate0-dev``
|
||||
|
||||
- Disable with ``cmake -DENABLE_PIPEWIRE=no ..``
|
||||
|
||||
- ``libpipewire-0.3-dev``
|
||||
- ``libsamplerate0-dev``
|
||||
|
||||
- Disable with ``cmake -DENABLE_PULSEAUDIO=no ..``
|
||||
|
||||
- ``libpulse-dev``
|
||||
- ``libsamplerate0-dev``
|
||||
|
||||
``libsamplerate0-dev`` is required whenever audio support remains enabled.
|
||||
|
||||
.. _client_deps_recommended:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user