summaryrefslogtreecommitdiffstats
path: root/cmake/addons
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2020-10-19 00:52:24 +0200
committermanuel <manuel@mausz.at>2020-10-19 00:52:24 +0200
commitbe933ef2241d79558f91796cc5b3a161f72ebf9c (patch)
treefe3ab2f130e20c99001f2d7a81d610c78c96a3f4 /cmake/addons
parent5f8335c1e49ce108ef3481863833c98efa00411b (diff)
downloadkodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.gz
kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.bz2
kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.zip
sync with upstream
Diffstat (limited to 'cmake/addons')
-rw-r--r--cmake/addons/CMakeLists.txt72
-rw-r--r--cmake/addons/README.md12
2 files changed, 70 insertions, 14 deletions
diff --git a/cmake/addons/CMakeLists.txt b/cmake/addons/CMakeLists.txt
index 3dccc01..c1313d7 100644
--- a/cmake/addons/CMakeLists.txt
+++ b/cmake/addons/CMakeLists.txt
@@ -244,26 +244,80 @@ endif()
244# error either in ADDONS_TO_BUILD or in the directory configuration. 244# error either in ADDONS_TO_BUILD or in the directory configuration.
245set(SUPPORTED_ADDON_FOUND FALSE) 245set(SUPPORTED_ADDON_FOUND FALSE)
246 246
247if(NOT ADDONS_TO_BUILD)
248 set(ADDONS_TO_BUILD "all")
249endif()
250
251if(NOT ADDONS_TO_BUILD STREQUAL "all")
252 # Exact addon match list
253 set(REGEX_ADDONS_TO_BUILD ${ADDONS_TO_BUILD})
254 set(EXACT_MATCH_ADDON_LIST "")
255 set(EXCLUDE_ADDONS "")
256
257 foreach(addon ${ADDONS_TO_BUILD})
258 set(FOUND_EXCLUSION "")
259 string(REGEX MATCH "^[-](.*)" FOUND_EXCLUSION "${addon}")
260 if(NOT FOUND_EXCLUSION STREQUAL "")
261 list(APPEND EXCLUDE_ADDONS ${CMAKE_MATCH_1})
262 list(REMOVE_ITEM REGEX_ADDONS_TO_BUILD "-${CMAKE_MATCH_1}")
263 else()
264 foreach(addonrepoitem ${addons})
265 if(NOT (addonrepoitem MATCHES platforms.txt))
266 # need to strip regex chars, or the filter regex will use
267 string(REPLACE "*" "" strippedregex ${addon})
268 if(${addonrepoitem} MATCHES "^.*\/(${strippedregex}).txt")
269 list(APPEND EXACT_MATCH_ADDON_LIST ${addon})
270 # remove exact matches from addons_to_build
271 list(REMOVE_ITEM REGEX_ADDONS_TO_BUILD "${addon}")
272 endif()
273 endif()
274 endforeach()
275 endif()
276 endforeach()
277
278 message(STATUS "Exclusion list: ${EXCLUDE_ADDONS}")
279 message(STATUS "Exact Match list: ${EXACT_MATCH_ADDON_LIST}")
280 message(STATUS "Regex list: ${REGEX_ADDONS_TO_BUILD}")
281endif()
282
247foreach(addon ${addons}) 283foreach(addon ${addons})
248 if(NOT (addon MATCHES platforms.txt)) 284 if(NOT (addon MATCHES platforms.txt))
249 file(STRINGS ${addon} def) 285 file(STRINGS ${addon} def)
250 string(REPLACE " " ";" def ${def}) 286 string(REPLACE " " ";" def ${def})
251 list(GET def 0 id) 287 list(GET def 0 id)
252 288
253 set(ADDON_FOUND FALSE) 289 if("${ADDONS_TO_BUILD}" STREQUAL "all")
254 # try to find a perfect match
255 list(FIND ADDONS_TO_BUILD ${id} idx)
256 if(idx GREATER -1 OR "${ADDONS_TO_BUILD}" STREQUAL "all")
257 set(ADDON_FOUND TRUE) 290 set(ADDON_FOUND TRUE)
258 # Maybe we have a regex
259 else() 291 else()
260 foreach(ADDONLISTITEM ${ADDONS_TO_BUILD}) 292 set(ADDON_EXCLUDE FALSE)
261 if(id MATCHES "${ADDONLISTITEM}") 293 set(ADDON_FOUND FALSE)
262 message(STATUS "Pattern ${ADDONLISTITEM} matches ${id}, building addon") 294 foreach(exclusion ${EXCLUDE_ADDONS})
263 set(ADDON_FOUND TRUE) 295 if(id MATCHES "${exclusion}")
296 set(ADDON_EXCLUDE TRUE)
297 message(STATUS "Addon ${id} matches exclusion rule -${exclusion}")
264 break() 298 break()
265 endif() 299 endif()
266 endforeach() 300 endforeach()
301
302 if(ADDON_EXCLUDE)
303 continue()
304 endif()
305
306 list(FIND EXACT_MATCH_ADDON_LIST ${id} idx)
307 if(idx GREATER -1)
308 # exact match, so build
309 message(STATUS "Exact match ${id}, building addon")
310 set(ADDON_FOUND TRUE)
311 else()
312 # regex search
313 foreach(ADDONLISTITEM ${REGEX_ADDONS_TO_BUILD})
314 if(id MATCHES "${ADDONLISTITEM}")
315 message(STATUS "Pattern ${ADDONLISTITEM} matches ${id}, building addon")
316 set(ADDON_FOUND TRUE)
317 break()
318 endif()
319 endforeach()
320 endif()
267 endif() 321 endif()
268 322
269 if(ADDON_FOUND) 323 if(ADDON_FOUND)
diff --git a/cmake/addons/README.md b/cmake/addons/README.md
index 17e6460..ed1894e 100644
--- a/cmake/addons/README.md
+++ b/cmake/addons/README.md
@@ -18,16 +18,18 @@ where
18 18
19List of platforms to build an add-on for (or *all*). Negating platforms is supported using a leading exclamation mark, e.g. *!windows*. 19List of platforms to build an add-on for (or *all*). Negating platforms is supported using a leading exclamation mark, e.g. *!windows*.
20 20
21Available platforms are: linux, windows, osx, ios, android, rbpi and freebsd. 21Available platforms are: linux, windows, osx, ios, android and freebsd.
22 22
23#### Attention 23#### Attention
24If no add-on definitions could be found, the buildsystem assumes that the bootstrapping of the add-on definition repositories hasn't been performed yet and automatically executes the add-on bootstrapping buildsystem located in the *bootstrap* sub-directory with the default settings (i.e. *all* add-ons from all pre-defined add-on definition repositories are bootstrapped into the directory pointed to by the *ADDONS_DEFINITION_DIR* option). 24If no add-on definitions could be found, the buildsystem assumes that the bootstrapping of the add-on definition repositories hasn't been performed yet and automatically executes the add-on bootstrapping buildsystem located in the *bootstrap* sub-directory with the default settings (i.e. *all* add-ons from all pre-defined add-on definition repositories are bootstrapped into the directory pointed to by the *ADDONS_DEFINITION_DIR* option).
25 25
26## Buildsystem variables 26## Buildsystem variables
27The buildsystem uses the following addon-related variables (which can be passed into it when executing cmake with the -D`<variable-name>=<value>` format) to manipulate the build process: 27The buildsystem uses the following addon-related variables (which can be passed into it when executing cmake with the -D`<variable-name>=<value>` format) to manipulate the build process:
28- `ADDONS_TO_BUILD` has two variations, which are tested in order: 28- `ADDONS_TO_BUILD` has four rules for matching a provided space delimited list:
29 - a quoted, space delimited list of `<addon-id>s` that you want to build (default is *all*) 29 - to build all addons, just use `all` (default is *all*)
30 - a regular expression that every `<addon-id>` is matched against (e.g. `ADDONS_TO_BUILD="pvr.*"`) to build all pvr add-ons 30 - an exact match of an `<addon-id>` that you want to build (e.g. `ADDONS_TO_BUILD="game.libretro"`)
31 - a regular expression `<addon-id>` is matched against (e.g. `ADDONS_TO_BUILD="pvr.*"`) to build all pvr add-ons
32 - a regular expression exclusion can be made using `-<addon-id regex>` (e.g. `ADDONS_TO_BUILD="pvr.* -pvr.dvb"`) to exclude pvr.dvblink and pvr.dvbviewer, but build all other pvr add-ons
31- `ADDONS_DEFINITION_DIR` points to the directory containing the definitions for the addons to be built 33- `ADDONS_DEFINITION_DIR` points to the directory containing the definitions for the addons to be built
32- `ADDON_SRC_PREFIX` can be used to override the add-on repository location. It must point to the locally available parent directory of the add-on(s) to build. `<addon-id>` will be appended to this path automatically 34- `ADDON_SRC_PREFIX` can be used to override the add-on repository location. It must point to the locally available parent directory of the add-on(s) to build. `<addon-id>` will be appended to this path automatically
33- `CMAKE_INSTALL_PREFIX` points to the directory where the built add-ons and their additional files (addon.xml, resources, ...) will be installed to (defaults to `<ADDON_DEPENDS_PATH>`) 35- `CMAKE_INSTALL_PREFIX` points to the directory where the built add-ons and their additional files (addon.xml, resources, ...) will be installed to (defaults to `<ADDON_DEPENDS_PATH>`)
@@ -44,4 +46,4 @@ Buildsystem will print a warning if you use any of the below-listed variables. F
44 46
45## Building 47## Building
46The buildsystem makes some assumptions about the environment which must be met by whoever uses it: 48The buildsystem makes some assumptions about the environment which must be met by whoever uses it:
47- Any dependencies of the add-ons must already be built and their include and library files must be present in the path pointed to by `<CMAKE_PREFIX_PATH>` (in *include* and *lib* sub-directories) \ No newline at end of file 49- Any dependencies of the add-ons must already be built and their include and library files must be present in the path pointed to by `<CMAKE_PREFIX_PATH>` (in *include* and *lib* sub-directories)