From be933ef2241d79558f91796cc5b3a161f72ebf9c Mon Sep 17 00:00:00 2001 From: manuel Date: Mon, 19 Oct 2020 00:52:24 +0200 Subject: sync with upstream --- cmake/addons/CMakeLists.txt | 72 +++++++++++++++++++++++++++++++++++++++------ cmake/addons/README.md | 12 ++++---- 2 files changed, 70 insertions(+), 14 deletions(-) (limited to 'cmake/addons') 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() # error either in ADDONS_TO_BUILD or in the directory configuration. set(SUPPORTED_ADDON_FOUND FALSE) +if(NOT ADDONS_TO_BUILD) + set(ADDONS_TO_BUILD "all") +endif() + +if(NOT ADDONS_TO_BUILD STREQUAL "all") + # Exact addon match list + set(REGEX_ADDONS_TO_BUILD ${ADDONS_TO_BUILD}) + set(EXACT_MATCH_ADDON_LIST "") + set(EXCLUDE_ADDONS "") + + foreach(addon ${ADDONS_TO_BUILD}) + set(FOUND_EXCLUSION "") + string(REGEX MATCH "^[-](.*)" FOUND_EXCLUSION "${addon}") + if(NOT FOUND_EXCLUSION STREQUAL "") + list(APPEND EXCLUDE_ADDONS ${CMAKE_MATCH_1}) + list(REMOVE_ITEM REGEX_ADDONS_TO_BUILD "-${CMAKE_MATCH_1}") + else() + foreach(addonrepoitem ${addons}) + if(NOT (addonrepoitem MATCHES platforms.txt)) + # need to strip regex chars, or the filter regex will use + string(REPLACE "*" "" strippedregex ${addon}) + if(${addonrepoitem} MATCHES "^.*\/(${strippedregex}).txt") + list(APPEND EXACT_MATCH_ADDON_LIST ${addon}) + # remove exact matches from addons_to_build + list(REMOVE_ITEM REGEX_ADDONS_TO_BUILD "${addon}") + endif() + endif() + endforeach() + endif() + endforeach() + + message(STATUS "Exclusion list: ${EXCLUDE_ADDONS}") + message(STATUS "Exact Match list: ${EXACT_MATCH_ADDON_LIST}") + message(STATUS "Regex list: ${REGEX_ADDONS_TO_BUILD}") +endif() + foreach(addon ${addons}) if(NOT (addon MATCHES platforms.txt)) file(STRINGS ${addon} def) string(REPLACE " " ";" def ${def}) list(GET def 0 id) - set(ADDON_FOUND FALSE) - # try to find a perfect match - list(FIND ADDONS_TO_BUILD ${id} idx) - if(idx GREATER -1 OR "${ADDONS_TO_BUILD}" STREQUAL "all") + if("${ADDONS_TO_BUILD}" STREQUAL "all") set(ADDON_FOUND TRUE) - # Maybe we have a regex else() - foreach(ADDONLISTITEM ${ADDONS_TO_BUILD}) - if(id MATCHES "${ADDONLISTITEM}") - message(STATUS "Pattern ${ADDONLISTITEM} matches ${id}, building addon") - set(ADDON_FOUND TRUE) + set(ADDON_EXCLUDE FALSE) + set(ADDON_FOUND FALSE) + foreach(exclusion ${EXCLUDE_ADDONS}) + if(id MATCHES "${exclusion}") + set(ADDON_EXCLUDE TRUE) + message(STATUS "Addon ${id} matches exclusion rule -${exclusion}") break() endif() endforeach() + + if(ADDON_EXCLUDE) + continue() + endif() + + list(FIND EXACT_MATCH_ADDON_LIST ${id} idx) + if(idx GREATER -1) + # exact match, so build + message(STATUS "Exact match ${id}, building addon") + set(ADDON_FOUND TRUE) + else() + # regex search + foreach(ADDONLISTITEM ${REGEX_ADDONS_TO_BUILD}) + if(id MATCHES "${ADDONLISTITEM}") + message(STATUS "Pattern ${ADDONLISTITEM} matches ${id}, building addon") + set(ADDON_FOUND TRUE) + break() + endif() + endforeach() + endif() endif() 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 List of platforms to build an add-on for (or *all*). Negating platforms is supported using a leading exclamation mark, e.g. *!windows*. -Available platforms are: linux, windows, osx, ios, android, rbpi and freebsd. +Available platforms are: linux, windows, osx, ios, android and freebsd. #### Attention If 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). ## Buildsystem variables The buildsystem uses the following addon-related variables (which can be passed into it when executing cmake with the -D`=` format) to manipulate the build process: -- `ADDONS_TO_BUILD` has two variations, which are tested in order: - - a quoted, space delimited list of `s` that you want to build (default is *all*) - - a regular expression that every `` is matched against (e.g. `ADDONS_TO_BUILD="pvr.*"`) to build all pvr add-ons +- `ADDONS_TO_BUILD` has four rules for matching a provided space delimited list: + - to build all addons, just use `all` (default is *all*) + - an exact match of an `` that you want to build (e.g. `ADDONS_TO_BUILD="game.libretro"`) + - a regular expression `` is matched against (e.g. `ADDONS_TO_BUILD="pvr.*"`) to build all pvr add-ons + - a regular expression exclusion can be made using `-` (e.g. `ADDONS_TO_BUILD="pvr.* -pvr.dvb"`) to exclude pvr.dvblink and pvr.dvbviewer, but build all other pvr add-ons - `ADDONS_DEFINITION_DIR` points to the directory containing the definitions for the addons to be built - `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. `` will be appended to this path automatically - `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 ``) @@ -44,4 +46,4 @@ Buildsystem will print a warning if you use any of the below-listed variables. F ## Building The buildsystem makes some assumptions about the environment which must be met by whoever uses it: -- 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 `` (in *include* and *lib* sub-directories) \ No newline at end of file +- 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 `` (in *include* and *lib* sub-directories) -- cgit v1.2.3