Changeset View
Changeset View
Standalone View
Standalone View
cmake/modules/FindSPA.cmake
- This file was moved from cmake/modules/Findgbm.cmake.
1 | #.rst: | 1 | #.rst: | ||
---|---|---|---|---|---|
2 | # Findgbm | 2 | # FindSPA | ||
3 | # ------- | 3 | # ------- | ||
4 | # | 4 | # | ||
5 | # Try to find gbm on a Unix system. | 5 | # Try to find spa 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 | # ``SPA_FOUND`` | ||
10 | # True if (the requested version of) gbm is available | 10 | # True if (the requested version of) spa is available | ||
11 | # ``gbm_VERSION`` | 11 | # ``SPA_VERSION`` | ||
12 | # The version of gbm | 12 | # The version of spa | ||
13 | # ``gbm_LIBRARIES`` | 13 | # ``SPA_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 ``SPA::SPA`` | ||
15 | # target | 15 | # target | ||
16 | # ``gbm_INCLUDE_DIRS`` | 16 | # ``SPA_INCLUDE_DIRSS`` | ||
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 | # ``SPA_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 ``SPA_FOUND`` is TRUE, it will also define the following imported target: | ||
24 | # | 24 | # | ||
25 | # ``gbm::gbm`` | 25 | # ``SPA::SPA`` | ||
26 | # The gbm library | 26 | # The spa 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 | # | 35 | # Copyright 2018 Jan Grulich <jgrulich@redhat.com> | ||
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 | ||
43 | # notice, this list of conditions and the following disclaimer in the | 44 | # notice, this list of conditions and the following disclaimer in the | ||
44 | # documentation and/or other materials provided with the distribution. | 45 | # documentation and/or other materials provided with the distribution. | ||
45 | # 3. The name of the author may not be used to endorse or promote products | 46 | # 3. The name of the author may not be used to endorse or promote products | ||
46 | # derived from this software without specific prior written permission. | 47 | # derived from this software without specific prior written permission. | ||
47 | # | 48 | # | ||
48 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 49 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
49 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 50 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
50 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 51 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
51 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 52 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
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 | 61 | | |||
67 | if(NOT WIN32) | | |||
68 | # Use pkg-config to get the directories and then use these values | 62 | # Use pkg-config to get the directories and then use these values | ||
69 | # in the FIND_PATH() and FIND_LIBRARY() calls | 63 | # in the FIND_PATH() and FIND_LIBRARY() calls | ||
70 | find_package(PkgConfig) | 64 | find_package(PkgConfig) | ||
71 | pkg_check_modules(PKG_gbm QUIET gbm) | 65 | pkg_check_modules(PKG_SPA QUIET libspa-0.1) | ||
72 | 66 | | |||
73 | set(gbm_DEFINITIONS ${PKG_gbm_CFLAGS_OTHER}) | 67 | set(SPA_DEFINITIONS ${PKG_SPA_CFLAGS_OTHER}) | ||
74 | set(gbm_VERSION ${PKG_gbm_VERSION}) | 68 | set(SPA_VERSION ${PKG_SPA_VERSION}) | ||
75 | 69 | | |||
76 | find_path(gbm_INCLUDE_DIR | 70 | find_path(SPA_INCLUDE_DIRS | ||
77 | NAMES | 71 | NAMES | ||
78 | gbm.h | 72 | spa/pod/pod.h | ||
79 | HINTS | 73 | HINTS | ||
80 | ${PKG_gbm_INCLUDE_DIRS} | 74 | ${PKG_SPA_INCLUDE_DIRS} | ||
81 | ) | 75 | ) | ||
82 | find_library(gbm_LIBRARY | 76 | | ||
77 | find_library(SPA_LIBRARIES | ||||
83 | NAMES | 78 | NAMES | ||
84 | gbm | 79 | spa-lib | ||
85 | HINTS | 80 | HINTS | ||
86 | ${PKG_gbm_LIBRARY_DIRS} | 81 | ${PKG_SPA_LIBRARIES_DIRS} | ||
87 | ) | 82 | ) | ||
88 | 83 | | |||
89 | include(FindPackageHandleStandardArgs) | 84 | include(FindPackageHandleStandardArgs) | ||
90 | find_package_handle_standard_args(gbm | 85 | find_package_handle_standard_args(SPA | ||
91 | FOUND_VAR | 86 | FOUND_VAR | ||
92 | gbm_FOUND | 87 | SPA_FOUND | ||
93 | REQUIRED_VARS | 88 | REQUIRED_VARS | ||
94 | gbm_LIBRARY | 89 | SPA_LIBRARIES | ||
95 | gbm_INCLUDE_DIR | 90 | SPA_INCLUDE_DIRS | ||
96 | VERSION_VAR | 91 | VERSION_VAR | ||
97 | gbm_VERSION | 92 | SPA_VERSION | ||
98 | ) | 93 | ) | ||
99 | 94 | | |||
100 | if(gbm_FOUND AND NOT TARGET gbm::gbm) | 95 | if(SPA_FOUND AND NOT TARGET SPA::SPA) | ||
101 | add_library(gbm::gbm UNKNOWN IMPORTED) | 96 | add_library(SPA::SPA UNKNOWN IMPORTED) | ||
102 | set_target_properties(gbm::gbm PROPERTIES | 97 | set_target_properties(SPA::SPA PROPERTIES | ||
103 | IMPORTED_LOCATION "${gbm_LIBRARY}" | 98 | IMPORTED_LOCATION "${SPA_LIBRARIES}" | ||
104 | INTERFACE_COMPILE_OPTIONS "${gbm_DEFINITIONS}" | 99 | INTERFACE_COMPILE_OPTIONS "${SPA_DEFINITIONS}" | ||
105 | INTERFACE_INCLUDE_DIRECTORIES "${gbm_INCLUDE_DIR}" | 100 | INTERFACE_INCLUDE_DIRECTORIES "${SPA_INCLUDE_DIRS}" | ||
106 | ) | 101 | ) | ||
107 | endif() | 102 | endif() | ||
108 | 103 | | |||
109 | mark_as_advanced(gbm_LIBRARY gbm_INCLUDE_DIR) | 104 | mark_as_advanced(SPA_LIBRARIES SPA_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 | 105 | | |||
121 | include(FeatureSummary) | 106 | include(FeatureSummary) | ||
122 | set_package_properties(gbm PROPERTIES | 107 | set_package_properties(SPA PROPERTIES | ||
123 | URL "http://www.mesa3d.org" | 108 | DESCRIPTION "Simple Plugin API" | ||
124 | DESCRIPTION "Mesa gbm library." | | |||
125 | ) | 109 | ) |