Changeset View
Changeset View
Standalone View
Standalone View
cmake/modules/FindPipeWire.cmake
| Show All 26 Lines | |||||
| 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 | # Copyright 2018-2020 Jan Grulich <jgrulich@redhat.com> | ||
| 36 | # | 36 | # | ||
| 37 | # Redistribution and use in source and binary forms, with or without | 37 | # Redistribution and use in source and binary forms, with or without | ||
| 38 | # modification, are permitted provided that the following conditions | 38 | # modification, are permitted provided that the following conditions | ||
| 39 | # are met: | 39 | # are met: | ||
| 40 | # | 40 | # | ||
| 41 | # 1. Redistributions of source code must retain the copyright | 41 | # 1. Redistributions of source code must retain the copyright | ||
| 42 | # notice, this list of conditions and the following disclaimer. | 42 | # notice, this list of conditions and the following disclaimer. | ||
| 43 | # 2. Redistributions in binary form must reproduce the copyright | 43 | # 2. Redistributions in binary form must reproduce the copyright | ||
| Show All 12 Lines | |||||
| 56 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 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 | 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. | 58 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 59 | #============================================================================= | 59 | #============================================================================= | ||
| 60 | 60 | | |||
| 61 | # 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 | ||
| 62 | # in the FIND_PATH() and FIND_LIBRARY() calls | 62 | # in the FIND_PATH() and FIND_LIBRARY() calls | ||
| 63 | find_package(PkgConfig QUIET) | 63 | find_package(PkgConfig QUIET) | ||
| 64 | pkg_check_modules(PKG_PipeWire QUIET libpipewire-0.2 libpipewire-0.3) | | |||
| 65 | 64 | | |||
| 66 | set(PipeWire_DEFINITIONS "${PKG_PipeWire_CFLAGS_OTHER}") | 65 | pkg_search_module(PKG_PipeWire QUIET libpipewire-0.3 libpipewire-0.2) | ||
| 66 | pkg_search_module(PKG_Spa QUIET libspa-0.2 libspa-0.1) | ||||
| 67 | | ||||
| 68 | set(PipeWire_DEFINITIONS "${PKG_PipeWire_CFLAGS}" "${PKG_Spa_CFLAGS}") | ||||
| 67 | set(PipeWire_VERSION "${PKG_PipeWire_VERSION}") | 69 | set(PipeWire_VERSION "${PKG_PipeWire_VERSION}") | ||
| 68 | 70 | | |||
| 69 | find_path(PipeWire_INCLUDE_DIRS | 71 | find_path(PipeWire_INCLUDE_DIRS | ||
| 70 | NAMES | 72 | NAMES | ||
| 71 | pipewire/pipewire.h | 73 | pipewire/pipewire.h | ||
krop: this would break includes | |||||
krop: That's still the current way to include it | |||||
| 72 | HINTS | 74 | HINTS | ||
krop: same thing for this one | |||||
| 73 | ${PKG_PipeWire_INCLUDE_DIRS} | 75 | ${PKG_PipeWire_INCLUDE_DIRS} | ||
| 76 | ${PKG_PipeWire_INCLUDE_DIRS}/pipewire-0.3 | ||||
krop: ```
${PKG_Spa_INCLUDE_DIRS}
${PKG_Spa_INCLUDE_DIRS}/spa-0.2
``` | |||||
| 77 | ) | ||||
| 78 | | ||||
| 79 | find_path(Spa_INCLUDE_DIRS | ||||
| 80 | NAMES | ||||
| 81 | spa/param/props.h | ||||
| 82 | HINTS | ||||
| 83 | ${PKG_Spa_INCLUDE_DIRS} | ||||
| 84 | ${PKG_Spa_INCLUDE_DIRS}/spa-0.2 | ||||
Use: ${PKG_PipeWire_INCLUDE_DIRS}
${PKG_PipeWire_INCLUDE_DIRS}/pipewire-0.3instead. krop: Use:
```
${PKG_PipeWire_INCLUDE_DIRS}
${PKG_PipeWire_INCLUDE_DIRS}/pipewire-0.3
```
instead. | |||||
| 74 | ) | 85 | ) | ||
| 75 | 86 | | |||
| 76 | find_library(PipeWire_LIBRARIES | 87 | find_library(PipeWire_LIBRARIES | ||
| 77 | NAMES | 88 | NAMES | ||
| 78 | pipewire-0.2 pipewire-0.3 | 89 | pipewire-0.3 | ||
| 90 | pipewire-0.2 | ||||
| 79 | HINTS | 91 | HINTS | ||
| 80 | ${PKG_PipeWire_LIBRARIES_DIRS} | 92 | ${PKG_PipeWire_LIBRARY_DIRS} | ||
| 81 | ) | 93 | ) | ||
| 82 | 94 | | |||
| 83 | include(FindPackageHandleStandardArgs) | 95 | include(FindPackageHandleStandardArgs) | ||
| 84 | find_package_handle_standard_args(PipeWire | 96 | find_package_handle_standard_args(PipeWire | ||
| 85 | FOUND_VAR | 97 | FOUND_VAR | ||
| 86 | PipeWire_FOUND | 98 | PipeWire_FOUND | ||
| 87 | REQUIRED_VARS | 99 | REQUIRED_VARS | ||
| 88 | PipeWire_LIBRARIES | 100 | PipeWire_LIBRARIES | ||
| 89 | PipeWire_INCLUDE_DIRS | 101 | PipeWire_INCLUDE_DIRS | ||
| 102 | Spa_INCLUDE_DIRS | ||||
| 90 | VERSION_VAR | 103 | VERSION_VAR | ||
| 91 | PipeWire_VERSION | 104 | PipeWire_VERSION | ||
| 92 | ) | 105 | ) | ||
| 93 | 106 | | |||
| 94 | if(PipeWire_FOUND AND NOT TARGET PipeWire::PipeWire) | 107 | if(PipeWire_FOUND AND NOT TARGET PipeWire::PipeWire) | ||
| 95 | add_library(PipeWire::PipeWire UNKNOWN IMPORTED) | 108 | add_library(PipeWire::PipeWire UNKNOWN IMPORTED) | ||
| 96 | set_target_properties(PipeWire::PipeWire PROPERTIES | 109 | set_target_properties(PipeWire::PipeWire PROPERTIES | ||
| 97 | IMPORTED_LOCATION "${PipeWire_LIBRARIES}" | 110 | IMPORTED_LOCATION "${PipeWire_LIBRARIES}" | ||
| 98 | INTERFACE_COMPILE_OPTIONS "${PipeWire_DEFINITIONS}" | 111 | INTERFACE_COMPILE_OPTIONS "${PipeWire_DEFINITIONS}" | ||
| 99 | INTERFACE_INCLUDE_DIRECTORIES "${PipeWire_INCLUDE_DIRS}" | 112 | INTERFACE_INCLUDE_DIRECTORIES "${PipeWire_INCLUDE_DIRS}" "${Spa_INCLUDE_DIRS}" | ||
krop: INTERFACE_INCLUDE_DIRECTORIES "${PipeWire_INCLUDE_DIRS};${Spa_INCLUDE_DIRS}" | |||||
| 100 | ) | 113 | ) | ||
| 101 | endif() | 114 | endif() | ||
| 102 | 115 | | |||
| 103 | mark_as_advanced(PipeWire_LIBRARIES PipeWire_INCLUDE_DIRS) | 116 | mark_as_advanced(PipeWire_LIBRARIES PipeWire_INCLUDE_DIRS) | ||
| 104 | 117 | | |||
| 105 | include(FeatureSummary) | 118 | include(FeatureSummary) | ||
| 106 | set_package_properties(PipeWire PROPERTIES | 119 | set_package_properties(PipeWire PROPERTIES | ||
| 107 | URL "https://www.pipewire.org" | 120 | URL "https://www.pipewire.org" | ||
| 108 | DESCRIPTION "PipeWire - multimedia processing" | 121 | DESCRIPTION "PipeWire - multimedia processing" | ||
| 109 | ) | 122 | ) | ||
this would break includes