Changeset View
Changeset View
Standalone View
Standalone View
cmake/modules/FindPipeWire.cmake
- This file was added.
1 | #.rst: | ||||
---|---|---|---|---|---|
2 | # FindPipeWire | ||||
3 | # ------- | ||||
4 | # | ||||
5 | # Try to find PipeWire on a Unix system. | ||||
6 | # | ||||
7 | # This will define the following variables: | ||||
8 | # | ||||
9 | # ``PipeWire_FOUND`` | ||||
10 | # True if (the requested version of) PipeWire is available | ||||
11 | # ``PipeWire_VERSION`` | ||||
12 | # The version of PipeWire | ||||
13 | # ``PipeWire_LIBRARIES`` | ||||
14 | # This can be passed to target_link_libraries() instead of the ``PipeWire::PipeWire`` | ||||
15 | # target | ||||
16 | # ``PipeWire_INCLUDE_DIRS`` | ||||
17 | # This should be passed to target_include_directories() if the target is not | ||||
18 | # used for linking | ||||
19 | # ``PipeWire_DEFINITIONS`` | ||||
20 | # This should be passed to target_compile_options() if the target is not | ||||
21 | # used for linking | ||||
22 | # | ||||
23 | # If ``PipeWire_FOUND`` is TRUE, it will also define the following imported target: | ||||
24 | # | ||||
25 | # ``PipeWire::PipeWire`` | ||||
26 | # The PipeWire library | ||||
27 | # | ||||
28 | # In general we recommend using the imported target, as it is easier to use. | ||||
29 | # Bear in mind, however, that if the target is in the link interface of an | ||||
30 | # exported library, it must be made available by the package config file. | ||||
31 | | ||||
32 | #============================================================================= | ||||
33 | # Copyright 2014 Alex Merry <alex.merry@kde.org> | ||||
34 | # Copyright 2014 Martin Gräßlin <mgraesslin@kde.org> | ||||
35 | # Copyright 2018 Jan Grulich <jgrulich@redhat.com> | ||||
36 | # | ||||
37 | # Redistribution and use in source and binary forms, with or without | ||||
38 | # modification, are permitted provided that the following conditions | ||||
39 | # are met: | ||||
40 | # | ||||
41 | # 1. Redistributions of source code must retain the copyright | ||||
42 | # notice, this list of conditions and the following disclaimer. | ||||
43 | # 2. Redistributions in binary form must reproduce the copyright | ||||
44 | # notice, this list of conditions and the following disclaimer in the | ||||
45 | # documentation and/or other materials provided with the distribution. | ||||
46 | # 3. The name of the author may not be used to endorse or promote products | ||||
47 | # derived from this software without specific prior written permission. | ||||
48 | # | ||||
49 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||||
50 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||||
51 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||||
52 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||||
53 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||||
54 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||||
55 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||||
56 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||||
57 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
58 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
59 | #============================================================================= | ||||
60 | | ||||
61 | # Use pkg-config to get the directories and then use these values | ||||
62 | # in the FIND_PATH() and FIND_LIBRARY() calls | ||||
63 | find_package(PkgConfig QUIET) | ||||
64 | pkg_check_modules(PKG_PipeWire QUIET libpipewire-0.2 libpipewire-0.3) | ||||
65 | | ||||
66 | set(PipeWire_DEFINITIONS "${PKG_PipeWire_CFLAGS_OTHER}") | ||||
67 | set(PipeWire_VERSION "${PKG_PipeWire_VERSION}") | ||||
68 | | ||||
69 | find_path(PipeWire_INCLUDE_DIRS | ||||
70 | NAMES | ||||
71 | pipewire/pipewire.h | ||||
72 | HINTS | ||||
73 | ${PKG_PipeWire_INCLUDE_DIRS} | ||||
74 | ) | ||||
75 | | ||||
76 | find_library(PipeWire_LIBRARIES | ||||
77 | NAMES | ||||
78 | pipewire-0.2 pipewire-0.3 | ||||
79 | HINTS | ||||
80 | ${PKG_PipeWire_LIBRARIES_DIRS} | ||||
81 | ) | ||||
82 | | ||||
83 | include(FindPackageHandleStandardArgs) | ||||
84 | find_package_handle_standard_args(PipeWire | ||||
85 | FOUND_VAR | ||||
86 | PipeWire_FOUND | ||||
87 | REQUIRED_VARS | ||||
88 | PipeWire_LIBRARIES | ||||
89 | PipeWire_INCLUDE_DIRS | ||||
90 | VERSION_VAR | ||||
91 | PipeWire_VERSION | ||||
92 | ) | ||||
93 | | ||||
94 | if(PipeWire_FOUND AND NOT TARGET PipeWire::PipeWire) | ||||
95 | add_library(PipeWire::PipeWire UNKNOWN IMPORTED) | ||||
96 | set_target_properties(PipeWire::PipeWire PROPERTIES | ||||
97 | IMPORTED_LOCATION "${PipeWire_LIBRARIES}" | ||||
98 | INTERFACE_COMPILE_OPTIONS "${PipeWire_DEFINITIONS}" | ||||
99 | INTERFACE_INCLUDE_DIRECTORIES "${PipeWire_INCLUDE_DIRS}" | ||||
100 | ) | ||||
101 | endif() | ||||
102 | | ||||
103 | mark_as_advanced(PipeWire_LIBRARIES PipeWire_INCLUDE_DIRS) | ||||
104 | | ||||
105 | include(FeatureSummary) | ||||
106 | set_package_properties(PipeWire PROPERTIES | ||||
107 | URL "http://www.pipewire.org" | ||||
108 | DESCRIPTION "PipeWire - multimedia processing" | ||||
109 | ) |