Skip to content

Commit 1a53ae2

Browse files
committed
extract PipeWire cmake logic to FindPipeWire.cmake
1 parent ad6bf30 commit 1a53ae2

2 files changed

Lines changed: 52 additions & 15 deletions

File tree

CMakeLists.txt

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3735,22 +3735,17 @@ target_include_directories(mixxx-lib SYSTEM PUBLIC lib/portaudio)
37353735
target_link_libraries(mixxx-lib PRIVATE PortAudioRingBuffer)
37363736

37373737
# PipeWire
3738-
default_option(PIPEWIRE "Enable the PipeWire backend" "UNIX AND NOT APPLE")
3738+
default_option(PIPEWIRE "Enable the PipeWire backend" "UNIX AND NOT APPLE AND NOT ANDROID")
37393739
if(PIPEWIRE)
3740-
find_package(PkgConfig REQUIRED)
3741-
if(PKG_CONFIG_FOUND)
3742-
pkg_check_modules(PIPEWIRE REQUIRED IMPORTED_TARGET libpipewire-0.3)
3743-
if(PIPEWIRE_FOUND)
3744-
target_compile_definitions(mixxx-lib PUBLIC __PIPEWIRE__)
3745-
target_link_libraries(mixxx-lib PUBLIC PkgConfig::PIPEWIRE)
3746-
target_sources(
3747-
mixxx-lib
3748-
PRIVATE
3749-
src/soundio/pipewireenumerator.cpp
3750-
src/soundio/sounddevicepipewire.cpp
3751-
)
3752-
endif()
3753-
endif()
3740+
find_package(PipeWire REQUIRED)
3741+
target_link_libraries(mixxx-lib PUBLIC PipeWire::PipeWire)
3742+
target_compile_definitions(mixxx-lib PUBLIC __PIPEWIRE__)
3743+
target_sources(
3744+
mixxx-lib
3745+
PRIVATE
3746+
src/soundio/pipewireenumerator.cpp
3747+
src/soundio/sounddevicepipewire.cpp
3748+
)
37543749
endif()
37553750

37563751
# PortMidi

cmake/modules/FindPipeWire.cmake

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#[=======================================================================[.rst:
2+
FindPipeWire
3+
--------
4+
5+
Finds the PipeWire library.
6+
7+
Imported Targets
8+
^^^^^^^^^^^^^^^^
9+
10+
This module provides the following imported targets, if found:
11+
12+
``PipeWire::PipeWire``
13+
The PipeWire library
14+
15+
Result Variables
16+
^^^^^^^^^^^^^^^^
17+
18+
This will define the following variables:
19+
20+
``PipeWire_FOUND``
21+
True if the system has the PipeWire library.
22+
23+
#]=======================================================================]
24+
25+
find_package(PkgConfig REQUIRED)
26+
pkg_check_modules(PIPEWIRE REQUIRED IMPORTED_TARGET libpipewire-0.3)
27+
28+
include(FindPackageHandleStandardArgs)
29+
30+
find_package_handle_standard_args(
31+
PipeWire
32+
REQUIRED_VARS PIPEWIRE_FOUND
33+
VERSION_VAR PIPEWIRE_VERSION
34+
)
35+
36+
if(PipeWire_FOUND AND NOT TARGET PipeWire::PipeWire)
37+
add_library(PipeWire::PipeWire INTERFACE IMPORTED)
38+
set_target_properties(
39+
PipeWire::PipeWire
40+
PROPERTIES INTERFACE_LINK_LIBRARIES PkgConfig::PIPEWIRE
41+
)
42+
endif()

0 commit comments

Comments
 (0)