Changeset View
Changeset View
Standalone View
Standalone View
cmake/modules/FindPipeWire.cmake
- This file was copied from cmake/modules/Findgbm.cmake.
1 | #.rst: | 1 | #.rst: | ||
---|---|---|---|---|---|
2 | # Findgbm | 2 | # Findpipewire | ||
3 | # ------- | 3 | # ------- | ||
4 | # | 4 | # | ||
5 | # Try to find gbm on a Unix system. | 5 | # Try to find pipewire on a Unix system. | ||
6 | # | 6 | # | ||
7 | # This will define the following variables: | 7 | # This will define the following variables: | ||
8 | # | 8 | # | ||
9 | # ``gbm_FOUND`` | 9 | # ``PipeWire_FOUND`` | ||
10 | # True if (the requested version of) gbm is available | 10 | # True if (the requested version of) PipeWire is available | ||
11 | # ``gbm_VERSION`` | 11 | # ``PipeWire_VERSION`` | ||
12 | # The version of gbm | 12 | # The version of PipeWire | ||
13 | # ``gbm_LIBRARIES`` | 13 | # ``PipeWire_LIBRARIES`` | ||
14 | # This can be passed to target_link_libraries() instead of the ``gbm::gbm`` | 14 | # This can be passed to target_link_libraries() instead of the ``PipeWire::PipeWire`` | ||
15 | # target | 15 | # target | ||
16 | # ``gbm_INCLUDE_DIRS`` | 16 | # ``PipeWire_INCLUDE_DIRS`` | ||
17 | # This should be passed to target_include_directories() if the target is not | 17 | # This should be passed to target_include_directories() if the target is not | ||
18 | # used for linking | 18 | # used for linking | ||
19 | # ``gbm_DEFINITIONS`` | 19 | # ``PipeWire_DEFINITIONS`` | ||
20 | # This should be passed to target_compile_options() if the target is not | 20 | # This should be passed to target_compile_options() if the target is not | ||
21 | # used for linking | 21 | # used for linking | ||
22 | # | 22 | # | ||
23 | # If ``gbm_FOUND`` is TRUE, it will also define the following imported target: | 23 | # If ``PipeWire_FOUND`` is TRUE, it will also define the following imported target: | ||
24 | # | 24 | # | ||
25 | # ``gbm::gbm`` | 25 | # ``PipeWire::PipeWire`` | ||
26 | # The gbm library | 26 | # The PipeWire library | ||
27 | # | 27 | # | ||
28 | # In general we recommend using the imported target, as it is easier to use. | 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 | 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. | 30 | # exported library, it must be made available by the package config file. | ||
31 | 31 | | |||
32 | #============================================================================= | 32 | #============================================================================= | ||
33 | # Copyright 2014 Alex Merry <alex.merry@kde.org> | 33 | # Copyright 2014 Alex Merry <alex.merry@kde.org> | ||
34 | # Copyright 2014 Martin Gräßlin <mgraesslin@kde.org> | 34 | # Copyright 2014 Martin Gräßlin <mgraesslin@kde.org> | ||
35 | # Copyright 2018 Jan Grulich <jgrulich@redhat.com> | ||||
35 | # | 36 | # | ||
36 | # Redistribution and use in source and binary forms, with or without | 37 | # Redistribution and use in source and binary forms, with or without | ||
37 | # modification, are permitted provided that the following conditions | 38 | # modification, are permitted provided that the following conditions | ||
38 | # are met: | 39 | # are met: | ||
39 | # | 40 | # | ||
40 | # 1. Redistributions of source code must retain the copyright | 41 | # 1. Redistributions of source code must retain the copyright | ||
41 | # notice, this list of conditions and the following disclaimer. | 42 | # notice, this list of conditions and the following disclaimer. | ||
42 | # 2. Redistributions in binary form must reproduce the copyright | 43 | # 2. Redistributions in binary form must reproduce the copyright | ||
Show All 9 Lines | |||||
52 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 53 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
53 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 54 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
54 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 55 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
55 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 56 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
56 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 57 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
57 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 58 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
58 | #============================================================================= | 59 | #============================================================================= | ||
59 | 60 | | |||
60 | if(CMAKE_VERSION VERSION_LESS 2.8.12) | | |||
61 | message(FATAL_ERROR "CMake 2.8.12 is required by Findgbm.cmake") | | |||
62 | endif() | | |||
63 | if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12) | | |||
64 | message(AUTHOR_WARNING "Your project should require at least CMake 2.8.12 to use Findgbm.cmake") | | |||
65 | endif() | | |||
66 | | ||||
67 | if(NOT WIN32) | | |||
68 | # Use pkg-config to get the directories and then use these values | 61 | # Use pkg-config to get the directories and then use these values | ||
69 | # in the FIND_PATH() and FIND_LIBRARY() calls | 62 | # in the FIND_PATH() and FIND_LIBRARY() calls | ||
70 | find_package(PkgConfig) | 63 | find_package(PkgConfig) | ||
71 | pkg_check_modules(PKG_gbm QUIET gbm) | 64 | pkg_check_modules(PKG_PipeWire QUIET libpipewire-0.1) | ||
72 | 65 | | |||
73 | set(gbm_DEFINITIONS ${PKG_gbm_CFLAGS_OTHER}) | 66 | set(PipeWire_DEFINITIONS ${PKG_PipeWire_CFLAGS_OTHER}) | ||
74 | set(gbm_VERSION ${PKG_gbm_VERSION}) | 67 | set(PipeWire_VERSION ${PKG_PipeWire_VERSION}) | ||
75 | 68 | | |||
76 | find_path(gbm_INCLUDE_DIR | 69 | find_path(PipeWire_INCLUDE_DIRS | ||
77 | NAMES | 70 | NAMES | ||
78 | gbm.h | 71 | pipewire/pipewire.h | ||
79 | HINTS | 72 | HINTS | ||
80 | ${PKG_gbm_INCLUDE_DIRS} | 73 | ${PKG_PipeWire_INCLUDE_DIRS} | ||
81 | ) | 74 | ) | ||
82 | find_library(gbm_LIBRARY | 75 | | ||
76 | find_library(PipeWire_LIBRARIES | ||||
83 | NAMES | 77 | NAMES | ||
84 | gbm | 78 | pipewire-0.1 | ||
85 | HINTS | 79 | HINTS | ||
86 | ${PKG_gbm_LIBRARY_DIRS} | 80 | ${PKG_PipeWire_LIBRARIES_DIRS} | ||
87 | ) | 81 | ) | ||
88 | 82 | | |||
89 | include(FindPackageHandleStandardArgs) | 83 | include(FindPackageHandleStandardArgs) | ||
90 | find_package_handle_standard_args(gbm | 84 | find_package_handle_standard_args(PipeWire | ||
91 | FOUND_VAR | 85 | FOUND_VAR | ||
92 | gbm_FOUND | 86 | PipeWire_FOUND | ||
93 | REQUIRED_VARS | 87 | REQUIRED_VARS | ||
94 | gbm_LIBRARY | 88 | PipeWire_LIBRARIES | ||
95 | gbm_INCLUDE_DIR | 89 | PipeWire_INCLUDE_DIRS | ||
96 | VERSION_VAR | 90 | VERSION_VAR | ||
97 | gbm_VERSION | 91 | PipeWire_VERSION | ||
98 | ) | 92 | ) | ||
99 | 93 | | |||
100 | if(gbm_FOUND AND NOT TARGET gbm::gbm) | 94 | if(PipeWire_FOUND AND NOT TARGET PipeWire::PipeWire) | ||
101 | add_library(gbm::gbm UNKNOWN IMPORTED) | 95 | add_library(PipeWire::PipeWire UNKNOWN IMPORTED) | ||
102 | set_target_properties(gbm::gbm PROPERTIES | 96 | set_target_properties(PipeWire::PipeWire PROPERTIES | ||
103 | IMPORTED_LOCATION "${gbm_LIBRARY}" | 97 | IMPORTED_LOCATION "${PipeWire_LIBRARIES}" | ||
104 | INTERFACE_COMPILE_OPTIONS "${gbm_DEFINITIONS}" | 98 | INTERFACE_COMPILE_OPTIONS "${PipeWire_DEFINITIONS}" | ||
105 | INTERFACE_INCLUDE_DIRECTORIES "${gbm_INCLUDE_DIR}" | 99 | INTERFACE_INCLUDE_DIRECTORIES "${PipeWire_INCLUDE_DIRS}" | ||
106 | ) | 100 | ) | ||
107 | endif() | 101 | endif() | ||
108 | 102 | | |||
109 | mark_as_advanced(gbm_LIBRARY gbm_INCLUDE_DIR) | 103 | mark_as_advanced(PipeWire_LIBRARIES PipeWire_INCLUDE_DIRS) | ||
110 | | ||||
111 | # compatibility variables | | |||
112 | set(gbm_LIBRARIES ${gbm_LIBRARY}) | | |||
113 | set(gbm_INCLUDE_DIRS ${gbm_INCLUDE_DIR}) | | |||
114 | set(gbm_VERSION_STRING ${gbm_VERSION}) | | |||
115 | | ||||
116 | else() | | |||
117 | message(STATUS "Findgbm.cmake cannot find gbm on Windows systems.") | | |||
118 | set(gbm_FOUND FALSE) | | |||
119 | endif() | | |||
120 | 104 | | |||
121 | include(FeatureSummary) | 105 | include(FeatureSummary) | ||
122 | set_package_properties(gbm PROPERTIES | 106 | set_package_properties(PipeWire PROPERTIES | ||
123 | URL "http://www.mesa3d.org" | 107 | URL "http://www.pipewire.org" | ||
124 | DESCRIPTION "Mesa gbm library." | 108 | DESCRIPTION "Pipewire - multimedia processing" | ||
125 | ) | 109 | ) |