diff options
Diffstat (limited to 'project/cmake/addons')
| -rw-r--r-- | project/cmake/addons/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | project/cmake/addons/README | 94 | ||||
| -rw-r--r-- | project/cmake/addons/README.md | 61 | ||||
| -rw-r--r-- | project/cmake/addons/bootstrap/bootstrap.cmake | 2 |
4 files changed, 67 insertions, 96 deletions
diff --git a/project/cmake/addons/CMakeLists.txt b/project/cmake/addons/CMakeLists.txt index 8fc1a23..982d977 100644 --- a/project/cmake/addons/CMakeLists.txt +++ b/project/cmake/addons/CMakeLists.txt | |||
| @@ -120,6 +120,7 @@ endif() | |||
| 120 | if(NOT ADDONS_TO_BUILD) | 120 | if(NOT ADDONS_TO_BUILD) |
| 121 | set(ADDONS_TO_BUILD "all") | 121 | set(ADDONS_TO_BUILD "all") |
| 122 | else() | 122 | else() |
| 123 | string(STRIP "${ADDONS_TO_BUILD}" ADDONS_TO_BUILD) | ||
| 123 | message(STATUS "Building following addons: ${ADDONS_TO_BUILD}") | 124 | message(STATUS "Building following addons: ${ADDONS_TO_BUILD}") |
| 124 | separate_arguments(ADDONS_TO_BUILD) | 125 | separate_arguments(ADDONS_TO_BUILD) |
| 125 | endif() | 126 | endif() |
| @@ -132,6 +133,7 @@ endif() | |||
| 132 | get_filename_component(ADDONS_DEFINITION_DIR "${ADDONS_DEFINITION_DIR}" ABSOLUTE) | 133 | get_filename_component(ADDONS_DEFINITION_DIR "${ADDONS_DEFINITION_DIR}" ABSOLUTE) |
| 133 | 134 | ||
| 134 | if(ADDON_SRC_PREFIX) | 135 | if(ADDON_SRC_PREFIX) |
| 136 | get_filename_component(ADDON_SRC_PREFIX "${ADDON_SRC_PREFIX}" ABSOLUTE) | ||
| 135 | message(STATUS "Overriding addon source directory prefix: ${ADDON_SRC_PREFIX}") | 137 | message(STATUS "Overriding addon source directory prefix: ${ADDON_SRC_PREFIX}") |
| 136 | endif() | 138 | endif() |
| 137 | 139 | ||
| @@ -196,12 +198,12 @@ if(NOT addons) | |||
| 196 | file(MAKE_DIRECTORY ${BOOTSTRAP_BUILD_DIR}) | 198 | file(MAKE_DIRECTORY ${BOOTSTRAP_BUILD_DIR}) |
| 197 | endif() | 199 | endif() |
| 198 | 200 | ||
| 201 | string (REPLACE ";" " " ADDONS_TO_BUILD_STR "${ADDONS_TO_BUILD}") | ||
| 199 | # generate the bootstrap buildsystem | 202 | # generate the bootstrap buildsystem |
| 200 | execute_process(COMMAND ${CMAKE_COMMAND} ${PROJECT_SOURCE_DIR}/bootstrap | 203 | execute_process(COMMAND ${CMAKE_COMMAND} ${PROJECT_SOURCE_DIR}/bootstrap |
| 201 | -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} | ||
| 202 | -DCMAKE_INSTALL_PREFIX:PATH=${ADDONS_DEFINITION_DIR} | 204 | -DCMAKE_INSTALL_PREFIX:PATH=${ADDONS_DEFINITION_DIR} |
| 203 | -DBUILD_DIR:PATH=${BOOTSTRAP_BUILD_DIR} | 205 | -DBUILD_DIR:PATH=${BOOTSTRAP_BUILD_DIR} |
| 204 | -DADDONS_TO_BUILD=${ADDONS_TO_BUILD} | 206 | -DADDONS_TO_BUILD:STRING=${ADDONS_TO_BUILD_STR} |
| 205 | WORKING_DIRECTORY ${BOOTSTRAP_BUILD_DIR}) | 207 | WORKING_DIRECTORY ${BOOTSTRAP_BUILD_DIR}) |
| 206 | 208 | ||
| 207 | # execute the generated bootstrap buildsystem | 209 | # execute the generated bootstrap buildsystem |
diff --git a/project/cmake/addons/README b/project/cmake/addons/README deleted file mode 100644 index a0f2c32..0000000 --- a/project/cmake/addons/README +++ /dev/null | |||
| @@ -1,94 +0,0 @@ | |||
| 1 | KODI ADDONS | ||
| 2 | =========== | ||
| 3 | This directory contains the cmake-based buildsystem for addons. It looks into | ||
| 4 | the directory pointed to by the ADDONS_DEFINITION_DIR option (which defaults to | ||
| 5 | the "addons" sub-directory) and parses all *.txt files recursively. Each addon | ||
| 6 | must have its own <addon-id>.txt file in a separate sub-directory which must | ||
| 7 | follow one of the defined format: | ||
| 8 | <addon-id> <git-url> <git-revision> | ||
| 9 | <addon-id> <tarball-url> | ||
| 10 | <addon-id> <file://path> | ||
| 11 | where | ||
| 12 | * <addon-id> must be identical to the addon's ID as defined in the addon's | ||
| 13 | addon.xml | ||
| 14 | * <git-url> must be the URL of the git repository containing the addon | ||
| 15 | * <git-revision> must be a valid git tag/branch/commit in the addon's git | ||
| 16 | repository which will be used for the build. | ||
| 17 | * <tarball-url> must be the URL to a .tar.gz tarball containing the addon | ||
| 18 | * <file://path> must be a file:// based path to the directory containing the | ||
| 19 | addon | ||
| 20 | |||
| 21 | Reserved filenames (for additional information on how to build an addon) | ||
| 22 | are: | ||
| 23 | * platforms.txt: List of platforms to build an addon for (or "all"). It is | ||
| 24 | also supported to specify negated platforms with a leading exclamation mark | ||
| 25 | (i), e.g. "!windows". | ||
| 26 | Available platforms are: linux, windows, osx, ios, android, rbpi, freebsd | ||
| 27 | |||
| 28 | ATTENTION: If no addon definitions could be found the buildsystem assumes that | ||
| 29 | the bootstrapping of the addon definition repositories hasn't been | ||
| 30 | performed yet and automatically executes the addon bootstrapping | ||
| 31 | buildsystem located in the "bootstrap" sub-directory with the default | ||
| 32 | settings (i.e. all addons from all pre-defined addon definition | ||
| 33 | repositories are bootstrapped into the directory pointed to by the | ||
| 34 | ADDONS_DEFINITION_DIR option). | ||
| 35 | |||
| 36 | The buildsystem uses the following variables (which can be passed into it when | ||
| 37 | executing cmake with the -D<variable-name>=<value> option) to e.g. access | ||
| 38 | specific paths: | ||
| 39 | * ADDONS_TO_BUILD has two variations, which are tested in order: | ||
| 40 | - a quoted, space delimited list of <addon-id>s that | ||
| 41 | you want to build (default is "all"). | ||
| 42 | - a regular expression that every <addon-id> is matched against | ||
| 43 | e.g.: ADDONS_TO_BUILD=pvr.* to build all pvr addons | ||
| 44 | * ADDONS_DEFINITION_DIR points to the directory containing the definitions | ||
| 45 | for the addons to be built. | ||
| 46 | * ADDON_SRC_PREFIX can be used to override the addon repository location. | ||
| 47 | It must point to the locally available parent directory of the addon(s) to build | ||
| 48 | <addon-id> will be appended to this path automatically | ||
| 49 | * CMAKE_BUILD_TYPE specifies the type of the build. This can be either "Debug" | ||
| 50 | or "Release" (default is "Release"). | ||
| 51 | * CMAKE_INSTALL_PREFIX points to the directory where the built addons and their | ||
| 52 | additional files (addon.xml, resources ...) will be installed to (defaults | ||
| 53 | to <DEPENDS_PATH>). | ||
| 54 | * CMAKE_TOOLCHAIN_FILE can be used to pass a toolchain file into the add-on | ||
| 55 | builds. | ||
| 56 | * DEPENDS_PATH points to the directory containing the "include" and "lib" | ||
| 57 | directories of the addons' dependencies. | ||
| 58 | * APP_ROOT points to the root directory of the project (default is the | ||
| 59 | absolute representation of ../../.. starting from this directory). | ||
| 60 | * BUILD_DIR points to the directory where the addons and their dependencies | ||
| 61 | will be downloaded and built. | ||
| 62 | * PACKAGE_ZIP=ON means that the add-ons will be 'packaged' into a common folder, | ||
| 63 | rather than being placed in <CMAKE_INSTALL_PREFIX>/lib/kodi/addons and | ||
| 64 | <CMAKE_INSTALL_PREFIX>/share/kodi/addons. | ||
| 65 | * PACKAGE_DIR points to the directory where the ZIP archived addons will be | ||
| 66 | stored after they have been packaged (defaults to <BUILD_DIR>/zips) | ||
| 67 | * ARCH_DEFINES specifies the platform-specific C/C++ preprocessor defines | ||
| 68 | (defaults to empty). | ||
| 69 | * ADDON_TARBALL_CACHING specifies whether downloaded addon source tarballs | ||
| 70 | should be cached or not (defaults to ON). | ||
| 71 | |||
| 72 | The buildsystem makes some assumptions about the environment which must be met | ||
| 73 | by whoever uses it: | ||
| 74 | * Any dependencies of the addons must already be built and their include and | ||
| 75 | library files must be present in the path pointed to by <CMAKE_PREFIX_PATH> (in | ||
| 76 | "include" and "lib" sub-directories). | ||
| 77 | |||
| 78 | To trigger the cmake-based buildsystem the following command must be executed | ||
| 79 | with <path> being the path to this directory (absolute or relative, allowing for | ||
| 80 | in-source and out-of-source builds). | ||
| 81 | |||
| 82 | cmake <path> -G <generator> | ||
| 83 | |||
| 84 | cmake supports multiple generators, see | ||
| 85 | http://www.cmake.org/cmake/help/v2.8.8/cmake.html#section_Generators for a list. | ||
| 86 | |||
| 87 | In case of additional options the call might look like this | ||
| 88 | |||
| 89 | cmake <path> [-G <generator>] \ | ||
| 90 | -DCMAKE_BUILD_TYPE=Release \ | ||
| 91 | -DAPP_ROOT="<path-to-app-root>" \ | ||
| 92 | -DARCH_DEFINES="-DTARGET_LINUX" \ | ||
| 93 | -DDEPENDS_PATH="<path-to-built-depends>" \ | ||
| 94 | -DCMAKE_INSTALL_PREFIX="<path-to-install-directory" | ||
diff --git a/project/cmake/addons/README.md b/project/cmake/addons/README.md new file mode 100644 index 0000000..c75ead7 --- /dev/null +++ b/project/cmake/addons/README.md | |||
| @@ -0,0 +1,61 @@ | |||
| 1 |  | ||
| 2 | # Kodi add-ons CMake based buildsystem | ||
| 3 | This directory contains the cmake-based buildsystem for Kodi add-ons. It looks into the directory pointed to by the *ADDONS_DEFINITION_DIR* option (which defaults to the *addons* sub-directory) and parses all *.txt files recursively. Each add-on must have its own `<addon-id>.txt` file in a separate sub-directory that must follow one of the defined formats: | ||
| 4 | |||
| 5 | - `<addon-id> <git-url> <git-revision>` | ||
| 6 | - `<addon-id> <tarball-url>` | ||
| 7 | - `<addon-id> <file://path>` | ||
| 8 | |||
| 9 | where | ||
| 10 | - `<addon-id>` must be identical to the add-on's ID as defined in the add-on's addon.xml | ||
| 11 | - `<git-url>` must be the URL of the git repository containing the add-on | ||
| 12 | - `<git-revision>` must be a valid git tag/branch/commit in the add-on's git repository which will be used for the build | ||
| 13 | - `<tarball-url>` must be the URL to a .tar.gz tarball containing the add-on | ||
| 14 | - `<file://path>` must be a *file://* based path to the directory containing the add-on | ||
| 15 | |||
| 16 | ## Reserved filenames | ||
| 17 | - **platforms.txt** | ||
| 18 | |||
| 19 | List of platforms to build an add-on for (or *all*). Negating platforms is supported using a leading exclamation mark, e.g. *!windows*. | ||
| 20 | |||
| 21 | Available platforms are: linux, windows, osx, ios, android, rbpi and freebsd. | ||
| 22 | |||
| 23 | #### Attention | ||
| 24 | 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). | ||
| 25 | |||
| 26 | ## Buildsystem variables | ||
| 27 | The buildsystem uses the following 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: | ||
| 29 | - a quoted, space delimited list of `<addon-id>s` that you want to build (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 | ||
| 31 | - `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 | ||
| 33 | - `CMAKE_BUILD_TYPE` specifies the type of the build. This can be either *Debug* or *Release* (default is *Release*) | ||
| 34 | - `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 `<DEPENDS_PATH>`) | ||
| 35 | - `CMAKE_TOOLCHAIN_FILE` can be used to pass a toolchain file into the add-on builds | ||
| 36 | - `DEPENDS_PATH` points to the directory containing the *include* and *lib* directories of the add-ons' dependencies. | ||
| 37 | - `APP_ROOT` points to the root directory of the project (default is the absolute representation of ../../.. starting from this directory) | ||
| 38 | - `BUILD_DIR` points to the directory where the add-ons and their dependencies will be downloaded and built | ||
| 39 | - `PACKAGE_ZIP=ON` means that the add-ons will be 'packaged' into a common folder, rather than being placed in `<CMAKE_INSTALL_PREFIX>/lib/kodi/addons` and `<CMAKE_INSTALL_PREFIX>/share/kodi/addons` | ||
| 40 | - `PACKAGE_DIR` points to the directory where the ZIP archived add-ons will be stored after they have been packaged (defaults to `<BUILD_DIR>/zips`) | ||
| 41 | - `ARCH_DEFINES` specifies the platform-specific C/C++ preprocessor defines (defaults to empty) | ||
| 42 | - `ADDON_TARBALL_CACHING` specifies whether downloaded add-on source tarballs should be cached or not (defaults to *ON*) | ||
| 43 | |||
| 44 | ## Building | ||
| 45 | The buildsystem makes some assumptions about the environment which must be met by whoever uses it: | ||
| 46 | - 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) | ||
| 47 | |||
| 48 | To trigger the cmake-based buildsystem the following command must be executed with `<path>` set to this directory (absolute or relative) allowing for in-source and out-of-source builds | ||
| 49 | |||
| 50 | `cmake <path> -G <generator>` | ||
| 51 | |||
| 52 | CMake supports multiple generators. See [here] (https://cmake.org/cmake/help/v3.1/manual/cmake-generators.7.html) for a list. | ||
| 53 | |||
| 54 | In case of additional options the call might look like this: | ||
| 55 | |||
| 56 | cmake `<path>` [-G `<generator>`] \ | ||
| 57 | -DCMAKE_BUILD_TYPE=Release \ | ||
| 58 | -DAPP_ROOT="`<path-to-app-root>`" \ | ||
| 59 | -DARCH_DEFINES="-DTARGET_LINUX" \ | ||
| 60 | -DDEPENDS_PATH=`<path-to-built-depends>` \ | ||
| 61 | -DCMAKE_INSTALL_PREFIX="`<path-to-install-directory`" | ||
diff --git a/project/cmake/addons/bootstrap/bootstrap.cmake b/project/cmake/addons/bootstrap/bootstrap.cmake index c78910c..25e8aa2 100644 --- a/project/cmake/addons/bootstrap/bootstrap.cmake +++ b/project/cmake/addons/bootstrap/bootstrap.cmake | |||
| @@ -9,6 +9,8 @@ endif() | |||
| 9 | if(NOT ADDONS_TO_BUILD) | 9 | if(NOT ADDONS_TO_BUILD) |
| 10 | set(ADDONS_TO_BUILD "all") | 10 | set(ADDONS_TO_BUILD "all") |
| 11 | else() | 11 | else() |
| 12 | string(STRIP "${ADDONS_TO_BUILD}" ADDONS_TO_BUILD) | ||
| 13 | message(STATUS "Bootstrapping following addons: ${ADDONS_TO_BUILD}") | ||
| 12 | separate_arguments(ADDONS_TO_BUILD) | 14 | separate_arguments(ADDONS_TO_BUILD) |
| 13 | endif() | 15 | endif() |
| 14 | 16 | ||
