summaryrefslogtreecommitdiffstats
path: root/project/cmake/addons
diff options
context:
space:
mode:
Diffstat (limited to 'project/cmake/addons')
-rw-r--r--project/cmake/addons/CMakeLists.txt122
-rw-r--r--project/cmake/addons/README.md14
-rw-r--r--project/cmake/addons/bootstrap/Bootstrap.cmake (renamed from project/cmake/addons/bootstrap/bootstrap.cmake)9
-rw-r--r--project/cmake/addons/bootstrap/CMakeLists.txt7
-rw-r--r--project/cmake/addons/depends/CMakeLists.txt15
-rw-r--r--project/cmake/addons/depends/README6
-rw-r--r--project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt2
-rw-r--r--project/cmake/addons/depends/common/tinyxml/CMakeLists.txt3
-rw-r--r--project/cmake/addons/depends/windows/CMakeLists.txt23
-rw-r--r--project/cmake/addons/depends/windows/Find7Zip.cmake7
-rw-r--r--project/cmake/addons/depends/windows/Install.cmake (renamed from project/cmake/addons/depends/windows/install.cmake)0
-rw-r--r--project/cmake/addons/depends/windows/extract-7z.cmake10
-rw-r--r--project/cmake/addons/depends/windows/extract-direct.cmake2
13 files changed, 108 insertions, 112 deletions
diff --git a/project/cmake/addons/CMakeLists.txt b/project/cmake/addons/CMakeLists.txt
index 982d977..96e544b 100644
--- a/project/cmake/addons/CMakeLists.txt
+++ b/project/cmake/addons/CMakeLists.txt
@@ -1,12 +1,6 @@
1cmake_minimum_required(VERSION 3.1)
1project(kodi-addons) 2project(kodi-addons)
2 3
3if(WIN32)
4 # there seems to be a bug in the CMake generator implementation in CMake 2.8.x releases for WIN32
5 cmake_minimum_required(VERSION 3.0)
6else()
7 cmake_minimum_required(VERSION 2.8)
8endif()
9
10list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) 4list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
11 5
12option(ADDON_TARBALL_CACHING "Cache downloaded addon source tarballs?" ON) 6option(ADDON_TARBALL_CACHING "Cache downloaded addon source tarballs?" ON)
@@ -31,14 +25,17 @@ endif()
31include(ExternalProject) 25include(ExternalProject)
32 26
33### setup all the necessary paths 27### setup all the necessary paths
34if(NOT APP_ROOT AND NOT XBMCROOT) 28if(APP_ROOT)
35 set(APP_ROOT ${PROJECT_SOURCE_DIR}/../../..) 29 set(CORE_SOURCE_DIR ${APP_ROOT})
36elseif(NOT APP_ROOT) 30 unset(APP_ROOT)
37 file(TO_CMAKE_PATH "${XBMCROOT}" APP_ROOT) 31 message(WARNING "APP_ROOT is deprecated. Please use CORE_SOURCE_DIR instead.")
32endif()
33if(NOT CORE_SOURCE_DIR)
34 set(CORE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../..)
38else() 35else()
39 file(TO_CMAKE_PATH "${APP_ROOT}" APP_ROOT) 36 file(TO_CMAKE_PATH "${CORE_SOURCE_DIR}" CORE_SOURCE_DIR)
40endif() 37endif()
41get_filename_component(APP_ROOT "${APP_ROOT}" ABSOLUTE) 38get_filename_component(CORE_SOURCE_DIR "${CORE_SOURCE_DIR}" ABSOLUTE)
42 39
43if(NOT BUILD_DIR) 40if(NOT BUILD_DIR)
44 set(BUILD_DIR "${CMAKE_BINARY_DIR}/build") 41 set(BUILD_DIR "${CMAKE_BINARY_DIR}/build")
@@ -47,29 +44,29 @@ else()
47endif() 44endif()
48get_filename_component(BUILD_DIR "${BUILD_DIR}" ABSOLUTE) 45get_filename_component(BUILD_DIR "${BUILD_DIR}" ABSOLUTE)
49 46
50if(NOT DEPENDS_PATH) 47if(NOT ADDON_DEPENDS_PATH)
51 set(DEPENDS_PATH "${BUILD_DIR}/depends") 48 set(ADDON_DEPENDS_PATH "${BUILD_DIR}/depends")
52else() 49else()
53 file(TO_CMAKE_PATH "${DEPENDS_PATH}" DEPENDS_PATH) 50 file(TO_CMAKE_PATH "${ADDON_DEPENDS_PATH}" ADDON_DEPENDS_PATH)
54endif() 51endif()
55get_filename_component(DEPENDS_PATH "${DEPENDS_PATH}" ABSOLUTE) 52get_filename_component(ADDON_DEPENDS_PATH "${ADDON_DEPENDS_PATH}" ABSOLUTE)
56 53
57if(NOT PLATFORM_DIR) 54if(NOT PLATFORM_DIR)
58 set(PLATFORM_DIR ${APP_ROOT}/project/cmake/platform/${CORE_SYSTEM_NAME}) 55 set(PLATFORM_DIR ${CORE_SOURCE_DIR}/project/cmake/platform/${CORE_SYSTEM_NAME})
59 file(TO_CMAKE_PATH "${PLATFORM_DIR}" PLATFORM_DIR) 56 file(TO_CMAKE_PATH "${PLATFORM_DIR}" PLATFORM_DIR)
60endif() 57endif()
61 58
62# make sure CMAKE_PREFIX_PATH is set 59# make sure CMAKE_PREFIX_PATH is set
63if(NOT CMAKE_PREFIX_PATH) 60if(NOT CMAKE_PREFIX_PATH)
64 set(CMAKE_PREFIX_PATH "${DEPENDS_PATH}") 61 set(CMAKE_PREFIX_PATH "${ADDON_DEPENDS_PATH}")
65else() 62else()
66 file(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH) 63 file(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH)
67 list(APPEND CMAKE_PREFIX_PATH "${DEPENDS_PATH}") 64 list(APPEND CMAKE_PREFIX_PATH "${ADDON_DEPENDS_PATH}")
68endif() 65endif()
69 66
70# check for autoconf stuff to pass on 67# check for autoconf stuff to pass on
71if(AUTOCONF_FILES) 68if(AUTOCONF_FILES)
72 separate_arguments(AUTOCONF_FILES) 69 string(REPLACE " " ";" AUTOCONF_FILES ${AUTOCONF_FILES})
73 set(CROSS_AUTOCONF "yes") 70 set(CROSS_AUTOCONF "yes")
74endif() 71endif()
75 72
@@ -80,8 +77,9 @@ list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX})
80 77
81set(BUILD_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} 78set(BUILD_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
82 -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> 79 -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
83 -DPACKAGE_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig 80 -DPACKAGE_CONFIG_PATH=${ADDON_DEPENDS_PATH}/lib/pkgconfig
84 -DDEPENDS_PATH=${DEPENDS_PATH} 81 -DADDON_DEPENDS_PATH=${ADDON_DEPENDS_PATH}
82 -DOVERRIDE_PATHS=${OVERRIDE_PATHS}
85 -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} 83 -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
86 -DCMAKE_USER_MAKE_RULES_OVERRIDE=${CMAKE_USER_MAKE_RULES_OVERRIDE} 84 -DCMAKE_USER_MAKE_RULES_OVERRIDE=${CMAKE_USER_MAKE_RULES_OVERRIDE}
87 -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX=${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX} 85 -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX=${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX}
@@ -108,13 +106,13 @@ if(PACKAGE_ZIP)
108 endif() 106 endif()
109 list(APPEND BUILD_ARGS -DPACKAGE_DIR=${PACKAGE_DIR}) 107 list(APPEND BUILD_ARGS -DPACKAGE_DIR=${PACKAGE_DIR})
110 108
111 MESSAGE(STATUS "ZIP packaging enabled (destination: ${PACKAGE_DIR})") 109 message(STATUS "ZIP packaging enabled (destination: ${PACKAGE_DIR})")
112endif() 110endif()
113 111
114if(CMAKE_TOOLCHAIN_FILE) 112if(CMAKE_TOOLCHAIN_FILE)
115 list(APPEND BUILD_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) 113 list(APPEND BUILD_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
116 MESSAGE(STATUS "Toolchain specified") 114 message(STATUS "Toolchain specified")
117 MESSAGE(STATUS ${BUILD_ARGS}) 115 message(STATUS ${BUILD_ARGS})
118endif() 116endif()
119 117
120if(NOT ADDONS_TO_BUILD) 118if(NOT ADDONS_TO_BUILD)
@@ -122,7 +120,7 @@ if(NOT ADDONS_TO_BUILD)
122else() 120else()
123 string(STRIP "${ADDONS_TO_BUILD}" ADDONS_TO_BUILD) 121 string(STRIP "${ADDONS_TO_BUILD}" ADDONS_TO_BUILD)
124 message(STATUS "Building following addons: ${ADDONS_TO_BUILD}") 122 message(STATUS "Building following addons: ${ADDONS_TO_BUILD}")
125 separate_arguments(ADDONS_TO_BUILD) 123 string(REPLACE " " ";" ADDONS_TO_BUILD ${ADDONS_TO_BUILD})
126endif() 124endif()
127 125
128if(NOT ADDONS_DEFINITION_DIR) 126if(NOT ADDONS_DEFINITION_DIR)
@@ -133,12 +131,14 @@ endif()
133get_filename_component(ADDONS_DEFINITION_DIR "${ADDONS_DEFINITION_DIR}" ABSOLUTE) 131get_filename_component(ADDONS_DEFINITION_DIR "${ADDONS_DEFINITION_DIR}" ABSOLUTE)
134 132
135if(ADDON_SRC_PREFIX) 133if(ADDON_SRC_PREFIX)
136 get_filename_component(ADDON_SRC_PREFIX "${ADDON_SRC_PREFIX}" ABSOLUTE) 134 if(NOT IS_ABSOLUTE ${ADDON_SRC_PREFIX})
135 get_filename_component(ADDON_SRC_PREFIX "${CMAKE_BINARY_DIR}/${ADDON_SRC_PREFIX}" ABSOLUTE)
136 endif()
137 message(STATUS "Overriding addon source directory prefix: ${ADDON_SRC_PREFIX}") 137 message(STATUS "Overriding addon source directory prefix: ${ADDON_SRC_PREFIX}")
138endif() 138endif()
139 139
140if(NOT APP_LIB_DIR) 140if(NOT APP_LIB_DIR)
141 set(APP_LIB_DIR "${DEPENDS_PATH}/lib/kodi") 141 set(APP_LIB_DIR "${ADDON_DEPENDS_PATH}/lib/kodi")
142else() 142else()
143 file(TO_CMAKE_PATH "${APP_LIB_DIR}" APP_LIB_DIR) 143 file(TO_CMAKE_PATH "${APP_LIB_DIR}" APP_LIB_DIR)
144endif() 144endif()
@@ -155,7 +155,7 @@ if(EXISTS ${PLATFORM_DIR}/defines.txt)
155endif() 155endif()
156 156
157# include check_target_platform() function 157# include check_target_platform() function
158include(${APP_ROOT}/project/cmake/scripts/common/check_target_platform.cmake) 158include(${CORE_SOURCE_DIR}/project/cmake/scripts/common/CheckTargetPlatform.cmake)
159 159
160set(ADDON_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}) 160set(ADDON_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
161if(NOT WIN32) 161if(NOT WIN32)
@@ -164,21 +164,23 @@ if(NOT WIN32)
164 if(NOT ${can_write} AND CMAKE_SYSTEM_NAME STREQUAL "Linux") 164 if(NOT ${can_write} AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
165 set(NEED_SUDO TRUE) 165 set(NEED_SUDO TRUE)
166 set(ADDON_INSTALL_DIR ${CMAKE_BINARY_DIR}/.install) 166 set(ADDON_INSTALL_DIR ${CMAKE_BINARY_DIR}/.install)
167 message(STATUS "NEED_SUDO: ${NEED_SUDO}") 167 list(APPEND BUILD_ARGS -DOVERRIDE_PATHS=ON)
168 message(STATUS "NEED_SUDO: ${NEED_SUDO} (no write permission for ${CMAKE_INSTALL_PREFIX})")
168 endif() 169 endif()
169endif() 170endif()
170 171
171### prepare the build environment for the binary addons 172### prepare the build environment for the binary addons
172# copy the prepare-env.cmake script to the depends path so that we can include it 173# copy the PrepareEnv.cmake script to the depends path so that we can include it
173file(COPY ${APP_ROOT}/project/cmake/scripts/common/prepare-env.cmake DESTINATION ${APP_LIB_DIR}) 174file(COPY ${CORE_SOURCE_DIR}/project/cmake/scripts/common/PrepareEnv.cmake DESTINATION ${APP_LIB_DIR})
174 175
175# add the location of prepare-env.cmake to CMAKE_MODULE_PATH so that it is found 176# add the location of PrepareEnv.cmake to CMAKE_MODULE_PATH so that it is found
176list(APPEND CMAKE_MODULE_PATH ${APP_LIB_DIR}) 177list(APPEND CMAKE_MODULE_PATH ${APP_LIB_DIR})
177 178
178# include prepare-env.cmake which contains the logic to install the addon header bindings etc 179# include PrepareEnv.cmake which contains the logic to install the addon header bindings etc
179include(prepare-env) 180include(PrepareEnv)
180 181
181### add the depends subdirectory for any general dependencies 182### add the depends subdirectory for any general dependencies
183message(STATUS "\n-- ---- Preparing general dependencies ----")
182add_subdirectory(depends) 184add_subdirectory(depends)
183 185
184# add a custom target "package-addons" which will package and install all addons 186# add a custom target "package-addons" which will package and install all addons
@@ -198,12 +200,13 @@ if(NOT addons)
198 file(MAKE_DIRECTORY ${BOOTSTRAP_BUILD_DIR}) 200 file(MAKE_DIRECTORY ${BOOTSTRAP_BUILD_DIR})
199 endif() 201 endif()
200 202
201 string (REPLACE ";" " " ADDONS_TO_BUILD_STR "${ADDONS_TO_BUILD}") 203 string(REPLACE ";" " " ADDONS_TO_BUILD_STR "${ADDONS_TO_BUILD}")
202 # generate the bootstrap buildsystem 204 # generate the bootstrap buildsystem
203 execute_process(COMMAND ${CMAKE_COMMAND} ${PROJECT_SOURCE_DIR}/bootstrap 205 execute_process(COMMAND ${CMAKE_COMMAND} ${PROJECT_SOURCE_DIR}/bootstrap
204 -DCMAKE_INSTALL_PREFIX:PATH=${ADDONS_DEFINITION_DIR} 206 -DCMAKE_INSTALL_PREFIX:PATH=${ADDONS_DEFINITION_DIR}
205 -DBUILD_DIR:PATH=${BOOTSTRAP_BUILD_DIR} 207 -DBUILD_DIR:PATH=${BOOTSTRAP_BUILD_DIR}
206 -DADDONS_TO_BUILD:STRING=${ADDONS_TO_BUILD_STR} 208 -DADDONS_TO_BUILD:STRING=${ADDONS_TO_BUILD_STR}
209 -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
207 WORKING_DIRECTORY ${BOOTSTRAP_BUILD_DIR}) 210 WORKING_DIRECTORY ${BOOTSTRAP_BUILD_DIR})
208 211
209 # execute the generated bootstrap buildsystem 212 # execute the generated bootstrap buildsystem
@@ -218,10 +221,14 @@ if(NOT addons)
218 endif() 221 endif()
219endif() 222endif()
220 223
224# Track if at least one addon has been found. Everything else is likely an
225# error either in ADDONS_TO_BUILD or in the directory configuration.
226set(SUPPORTED_ADDON_FOUND FALSE)
227
221foreach(addon ${addons}) 228foreach(addon ${addons})
222 if(NOT (addon MATCHES platforms.txt)) 229 if(NOT (addon MATCHES platforms.txt))
223 file(STRINGS ${addon} def) 230 file(STRINGS ${addon} def)
224 separate_arguments(def) 231 string(REPLACE " " ";" def ${def})
225 list(GET def 0 id) 232 list(GET def 0 id)
226 233
227 set(ADDON_FOUND FALSE) 234 set(ADDON_FOUND FALSE)
@@ -236,17 +243,18 @@ foreach(addon ${addons})
236 endif() 243 endif()
237 244
238 if(ADDON_FOUND) 245 if(ADDON_FOUND)
239 get_filename_component(dir ${addon} PATH) 246 message(STATUS "\n-- ---- Configuring addon ${addon} ----")
247 set(SUPPORTED_ADDON_FOUND TRUE)
248
249 get_filename_component(dir ${addon} DIRECTORY)
240 250
241 # check if the addon has a platforms.txt 251 # check if the addon has a platforms.txt
242 set(platform_found FALSE) 252 set(platform_found FALSE)
243 check_target_platform(${dir} ${CORE_SYSTEM_NAME} platform_found) 253 check_target_platform(${dir} ${CORE_SYSTEM_NAME} platform_found)
244 254
245 if (${platform_found}) 255 if(${platform_found})
246 # make sure the output directory is clean 256 # make sure the output directory is clean
247 if(EXISTS "${CMAKE_INSTALL_PREFIX}/${id}") 257 file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/${id}/")
248 file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/${id}/")
249 endif()
250 258
251 # get the URL and revision of the addon 259 # get the URL and revision of the addon
252 list(LENGTH def deflength) 260 list(LENGTH def deflength)
@@ -324,9 +332,7 @@ foreach(addon ${addons})
324 endif() 332 endif()
325 333
326 # remove any previously extracted version of the addon 334 # remove any previously extracted version of the addon
327 if(EXISTS "${BUILD_DIR}/${id}") 335 file(REMOVE_RECURSE "${BUILD_DIR}/${id}")
328 file(REMOVE_RECURSE "${BUILD_DIR}/${id}")
329 endif()
330 336
331 # extract the addon from the archive 337 # extract the addon from the archive
332 execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzvf ${BUILD_DIR}/download/${archive_name}.tar.gz 338 execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzvf ${BUILD_DIR}/download/${archive_name}.tar.gz
@@ -365,7 +371,7 @@ foreach(addon ${addons})
365 set(${id}_DEPENDS_DIR ${SOURCE_DIR}/depends) 371 set(${id}_DEPENDS_DIR ${SOURCE_DIR}/depends)
366 372
367 if(EXISTS ${${id}_DEPENDS_DIR}) 373 if(EXISTS ${${id}_DEPENDS_DIR})
368 include(${APP_ROOT}/project/cmake/scripts/common/handle-depends.cmake) 374 include(${CORE_SOURCE_DIR}/project/cmake/scripts/common/HandleDepends.cmake)
369 add_addon_depends(${id} ${${id}_DEPENDS_DIR}) 375 add_addon_depends(${id} ${${id}_DEPENDS_DIR})
370 if(${id}_DEPS AND NOT "${${id}_DEPS}" STREQUAL "") 376 if(${id}_DEPS AND NOT "${${id}_DEPS}" STREQUAL "")
371 message(STATUS "${id} DEPENDENCIES: ${${id}_DEPS}") 377 message(STATUS "${id} DEPENDENCIES: ${${id}_DEPS}")
@@ -401,16 +407,28 @@ foreach(addon ${addons})
401 endif() 407 endif()
402 endif() 408 endif()
403endforeach() 409endforeach()
410message(STATUS "")
404 411
405if(NEED_SUDO) 412if(NEED_SUDO)
406 add_custom_target(install 413 add_custom_target(sudo-install
407 COMMAND ${CMAKE_COMMAND} -E echo "\n\n" 414 COMMAND ${CMAKE_COMMAND} -E echo "sudo rights needed to install to ${CMAKE_INSTALL_PREFIX}\n"
408 COMMAND ${CMAKE_COMMAND} -E echo "WARNING: sudo rights needed to install to ${CMAKE_INSTALL_PREFIX}\n"
409 COMMAND sudo ${CMAKE_COMMAND} -E copy_directory ${ADDON_INSTALL_DIR}/ ${CMAKE_INSTALL_PREFIX}/ 415 COMMAND sudo ${CMAKE_COMMAND} -E copy_directory ${ADDON_INSTALL_DIR}/ ${CMAKE_INSTALL_PREFIX}/
410 COMMAND sudo ${CMAKE_COMMAND} -E remove_directory ${ADDON_INSTALL_DIR}/
411 COMMAND sudo -k) 416 COMMAND sudo -k)
417
418 foreach(_id ${ALL_ADDONS_BUILDING})
419 add_dependencies(sudo-install ${_id})
420 endforeach()
421 message(WARNING "sudo rights needed to install to ${CMAKE_INSTALL_PREFIX}")
422 message(STATUS "\nplease type \"make sudo-install\"\n\n")
423endif()
424
425if(NOT SUPPORTED_ADDON_FOUND)
426 message(FATAL_ERROR "${ADDONS_TO_BUILD} did not match any of the supported addons. \
427 A list of supported addons can be viewed by building the 'supported_addons' target. \
428 Addon definitions are loaded from ADDONS_DEFINITION_DIR (${ADDONS_DEFINITION_DIR}).")
412endif() 429endif()
413 430
414# add custom target "supported_addons" that returns all addons that are supported on this platform 431# add custom target "supported_addons" that returns all addons that are supported on this platform
415string(REPLACE ";" " " ALL_ADDONS_BUILDING "${ALL_ADDONS_BUILDING}") 432string(REPLACE ";" " " ALL_ADDONS_BUILDING "${ALL_ADDONS_BUILDING}")
416add_custom_target(supported_addons COMMAND ${CMAKE_COMMAND} -E echo "ALL_ADDONS_BUILDING: ${ALL_ADDONS_BUILDING}" VERBATIM) \ No newline at end of file 433add_custom_target(supported_addons COMMAND ${CMAKE_COMMAND} -E echo "ALL_ADDONS_BUILDING: ${ALL_ADDONS_BUILDING}" VERBATIM)
434add_custom_target(need-sudo COMMAND ${CMAKE_COMMAND} -E echo ${NEED_SUDO} VERBATIM)
diff --git a/project/cmake/addons/README.md b/project/cmake/addons/README.md
index c75ead7..6470ee1 100644
--- a/project/cmake/addons/README.md
+++ b/project/cmake/addons/README.md
@@ -31,16 +31,20 @@ The buildsystem uses the following variables (which can be passed into it when e
31- `ADDONS_DEFINITION_DIR` points to the directory containing the definitions for the addons to be built 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 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*) 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>`) 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 `<ADDON_DEPENDS_PATH>`)
35- `CMAKE_TOOLCHAIN_FILE` can be used to pass a toolchain file into the add-on builds 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. 36- `ADDON_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) 37- `CORE_SOURCE_DIR` 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 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` 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`) 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) 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*) 42- `ADDON_TARBALL_CACHING` specifies whether downloaded add-on source tarballs should be cached or not (defaults to *ON*)
43 43
44## Deprecated buildsystem variables
45Buildsystem will print a warning if you use any of the below-listed variables. For now they still work but you should adapt your workflow to the new variables.
46- `APP_ROOT` - Use `CORE_SOURCE_DIR` instead
47
44## Building 48## Building
45The buildsystem makes some assumptions about the environment which must be met by whoever uses it: 49The 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) 50- 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)
@@ -55,7 +59,7 @@ In case of additional options the call might look like this:
55 59
56cmake `<path>` [-G `<generator>`] \ 60cmake `<path>` [-G `<generator>`] \
57 -DCMAKE_BUILD_TYPE=Release \ 61 -DCMAKE_BUILD_TYPE=Release \
58 -DAPP_ROOT="`<path-to-app-root>`" \ 62 -DCORE_SOURCE_DIR="`<path-to-app-root>`" \
59 -DARCH_DEFINES="-DTARGET_LINUX" \ 63 -DARCH_DEFINES="-DTARGET_LINUX" \
60 -DDEPENDS_PATH=`<path-to-built-depends>` \ 64 -DADDON_DEPENDS_PATH=`<path-to-built-depends>` \
61 -DCMAKE_INSTALL_PREFIX="`<path-to-install-directory`" 65 -DCMAKE_INSTALL_PREFIX="`<path-to-install-directory`"
diff --git a/project/cmake/addons/bootstrap/bootstrap.cmake b/project/cmake/addons/bootstrap/Bootstrap.cmake
index 25e8aa2..5d20302 100644
--- a/project/cmake/addons/bootstrap/bootstrap.cmake
+++ b/project/cmake/addons/bootstrap/Bootstrap.cmake
@@ -11,7 +11,7 @@ if(NOT ADDONS_TO_BUILD)
11else() 11else()
12 string(STRIP "${ADDONS_TO_BUILD}" ADDONS_TO_BUILD) 12 string(STRIP "${ADDONS_TO_BUILD}" ADDONS_TO_BUILD)
13 message(STATUS "Bootstrapping following addons: ${ADDONS_TO_BUILD}") 13 message(STATUS "Bootstrapping following addons: ${ADDONS_TO_BUILD}")
14 separate_arguments(ADDONS_TO_BUILD) 14 string(REPLACE " " ";" ADDONS_TO_BUILD ${ADDONS_TO_BUILD})
15endif() 15endif()
16 16
17# find all addon definitions and go through them 17# find all addon definitions and go through them
@@ -21,16 +21,15 @@ foreach(ADDON_DEFINITION_FILE ${ADDON_DEFINITIONS})
21 if(NOT (ADDON_DEFINITION_FILE MATCHES platforms.txt)) 21 if(NOT (ADDON_DEFINITION_FILE MATCHES platforms.txt))
22 # read the addon definition file 22 # read the addon definition file
23 file(STRINGS ${ADDON_DEFINITION_FILE} ADDON_DEFINITION) 23 file(STRINGS ${ADDON_DEFINITION_FILE} ADDON_DEFINITION)
24 separate_arguments(ADDON_DEFINITION) 24 string(REPLACE " " ";" ADDON_DEFINITION ${ADDON_DEFINITION})
25 25
26 # extract the addon definition's identifier 26 # extract the addon definition's identifier
27 list(GET ADDON_DEFINITION 0 ADDON_ID) 27 list(GET ADDON_DEFINITION 0 ADDON_ID)
28 28
29 # check if the addon definition should be built 29 # check if the addon definition should be built
30 list(FIND ADDONS_TO_BUILD ${ADDON_ID} ADDONS_TO_BUILD_IDX) 30 if(ADDON_ID MATCHES "^${ADDONS_TO_BUILD}" OR ADDONS_TO_BUILD STREQUAL all)
31 if(ADDONS_TO_BUILD_IDX GREATER -1 OR "${ADDONS_TO_BUILD}" STREQUAL "all")
32 # get the path to the addon definition directory 31 # get the path to the addon definition directory
33 get_filename_component(ADDON_DEFINITION_DIR ${ADDON_DEFINITION_FILE} PATH) 32 get_filename_component(ADDON_DEFINITION_DIR ${ADDON_DEFINITION_FILE} DIRECTORY)
34 33
35 # install the addon definition 34 # install the addon definition
36 message(STATUS "Bootstrapping ${ADDON_ID} addon...") 35 message(STATUS "Bootstrapping ${ADDON_ID} addon...")
diff --git a/project/cmake/addons/bootstrap/CMakeLists.txt b/project/cmake/addons/bootstrap/CMakeLists.txt
index 86950b8..c20b97e 100644
--- a/project/cmake/addons/bootstrap/CMakeLists.txt
+++ b/project/cmake/addons/bootstrap/CMakeLists.txt
@@ -1,7 +1,6 @@
1cmake_minimum_required(VERSION 3.1)
1project(kodi-addons-bootstrap) 2project(kodi-addons-bootstrap)
2 3
3cmake_minimum_required(VERSION 2.8)
4
5list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) 4list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
6 5
7# make sure CMAKE_INSTALL_PREFIX is properly set 6# make sure CMAKE_INSTALL_PREFIX is properly set
@@ -52,7 +51,7 @@ function(bootstrap_repo repo_id repo_url repo_revision)
52 -DPROJECT_SOURCE_DIR=<SOURCE_DIR> 51 -DPROJECT_SOURCE_DIR=<SOURCE_DIR>
53 -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} 52 -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
54 -DADDONS_TO_BUILD=${ADDONS_TO_BUILD} 53 -DADDONS_TO_BUILD=${ADDONS_TO_BUILD}
55 -P ${PROJECT_SOURCE_DIR}/bootstrap.cmake 54 -P ${PROJECT_SOURCE_DIR}/Bootstrap.cmake
56 ) 55 )
57endfunction() 56endfunction()
58 57
@@ -61,7 +60,7 @@ set(REPOSITORY_TO_BUILD_FOUND OFF)
61file(GLOB repos repositories/*.txt) 60file(GLOB repos repositories/*.txt)
62foreach(repo ${repos}) 61foreach(repo ${repos})
63 file(STRINGS ${repo} repo_definition) 62 file(STRINGS ${repo} repo_definition)
64 separate_arguments(repo_definition) 63 string(REPLACE " " ";" repo_definition ${repo_definition})
65 list(GET repo_definition 0 repo_id) 64 list(GET repo_definition 0 repo_id)
66 65
67 list(FIND REPOSITORY_TO_BUILD ${repo_id} idx) 66 list(FIND REPOSITORY_TO_BUILD ${repo_id} idx)
diff --git a/project/cmake/addons/depends/CMakeLists.txt b/project/cmake/addons/depends/CMakeLists.txt
index 760acf4..622701d 100644
--- a/project/cmake/addons/depends/CMakeLists.txt
+++ b/project/cmake/addons/depends/CMakeLists.txt
@@ -1,7 +1,6 @@
1cmake_minimum_required(VERSION 3.1)
1project(kodi-addons-depends) 2project(kodi-addons-depends)
2 3
3cmake_minimum_required(VERSION 2.8)
4
5list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) 4list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
6 5
7if(NOT CMAKE_BUILD_TYPE) 6if(NOT CMAKE_BUILD_TYPE)
@@ -14,13 +13,13 @@ endif()
14 13
15include(ExternalProject) 14include(ExternalProject)
16 15
17if(NOT DEPENDS_PATH) 16if(NOT ADDON_DEPENDS_PATH)
18 set(DEPENDS_PATH ${PROJECT_SOURCE_DIR}/../build/depends) 17 set(ADDON_DEPENDS_PATH ${PROJECT_SOURCE_DIR}/../build/depends)
19else() 18else()
20 file(TO_CMAKE_PATH "${DEPENDS_PATH}" DEPENDS_PATH) 19 file(TO_CMAKE_PATH "${ADDON_DEPENDS_PATH}" ADDON_DEPENDS_PATH)
21endif() 20endif()
22get_filename_component(DEPENDS_PATH "${DEPENDS_PATH}" ABSOLUTE) 21get_filename_component(ADDON_DEPENDS_PATH "${ADDON_DEPENDS_PATH}" ABSOLUTE)
23list(APPEND CMAKE_PREFIX_PATH ${DEPENDS_PATH}) 22list(APPEND CMAKE_PREFIX_PATH ${ADDON_DEPENDS_PATH})
24 23
25if(NOT BUILD_DIR) 24if(NOT BUILD_DIR)
26 set(BUILD_DIR "${CMAKE_BINARY_DIR}/build") 25 set(BUILD_DIR "${CMAKE_BINARY_DIR}/build")
@@ -30,7 +29,7 @@ endif()
30get_filename_component(BUILD_DIR "${BUILD_DIR}" ABSOLUTE) 29get_filename_component(BUILD_DIR "${BUILD_DIR}" ABSOLUTE)
31 30
32## use add_addon_depends to handle the cmake based dependencies 31## use add_addon_depends to handle the cmake based dependencies
33include(${APP_ROOT}/project/cmake/scripts/common/handle-depends.cmake) 32include(${CORE_SOURCE_DIR}/project/cmake/scripts/common/HandleDepends.cmake)
34add_addon_depends(depends "${PROJECT_SOURCE_DIR}") 33add_addon_depends(depends "${PROJECT_SOURCE_DIR}")
35 34
36## if there's a platform-specific sub-directory containing a CMakeLists.txt, add it to the build as well 35## if there's a platform-specific sub-directory containing a CMakeLists.txt, add it to the build as well
diff --git a/project/cmake/addons/depends/README b/project/cmake/addons/depends/README
index 66e924a..584a167 100644
--- a/project/cmake/addons/depends/README
+++ b/project/cmake/addons/depends/README
@@ -34,9 +34,9 @@ specific paths:
34 builds. 34 builds.
35 * CORE_SYSTEM_NAME is the name of the platform (e.g. "linux" or "android") in 35 * CORE_SYSTEM_NAME is the name of the platform (e.g. "linux" or "android") in
36 lower-case (defaults to lowercase(CMAKE_SYSTEM_NAME)). 36 lower-case (defaults to lowercase(CMAKE_SYSTEM_NAME)).
37 * APP_ROOT points to the root directory of the project (default is the 37 * CORE_SOURCE_DIR points to the root directory of the project (default is the
38 absolute representation of ../../.. starting from this directory). 38 absolute representation of ../../.. starting from this directory).
39 * DEPENDS_PATH points to the directory where the built dependencies 39 * ADDON_DEPENDS_PATH points to the directory where the built dependencies
40 (their include and library file) will be installed to. 40 (their include and library file) will be installed to.
41 * ARCH_DEFINES specifies the platform-specific C/C++ preprocessor defines 41 * ARCH_DEFINES specifies the platform-specific C/C++ preprocessor defines
42 (defaults to empty). 42 (defaults to empty).
@@ -56,6 +56,6 @@ In case of additional options the call might look like this
56 56
57 cmake <path> [-G <generator>] \ 57 cmake <path> [-G <generator>] \
58 -DCMAKE_BUILD_TYPE=Release \ 58 -DCMAKE_BUILD_TYPE=Release \
59 -DAPP_ROOT="<path-to-project-root>" \ 59 -DCORE_SOURCE_DIR="<path-to-project-root>" \
60 -DARCH_DEFINES="-DTARGET_LINUX" \ 60 -DARCH_DEFINES="-DTARGET_LINUX" \
61 -DCMAKE_INSTALL_PREFIX="<path-to-install-directory" 61 -DCMAKE_INSTALL_PREFIX="<path-to-install-directory"
diff --git a/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt b/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt
index de42267..46ef93c 100644
--- a/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt
+++ b/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt
@@ -1 +1 @@
kodi-platform https://github.com/xbmc/kodi-platform fed924e764b4c9c722f7f5d825ce70d4b61ae54f kodi-platform https://github.com/xbmc/kodi-platform c8188d82678fec6b784597db69a68e74ff4986b5
diff --git a/project/cmake/addons/depends/common/tinyxml/CMakeLists.txt b/project/cmake/addons/depends/common/tinyxml/CMakeLists.txt
index 5468bfb..ec396ee 100644
--- a/project/cmake/addons/depends/common/tinyxml/CMakeLists.txt
+++ b/project/cmake/addons/depends/common/tinyxml/CMakeLists.txt
@@ -1,7 +1,6 @@
1cmake_minimum_required(VERSION 3.1)
1project(tinyxml) 2project(tinyxml)
2 3
3cmake_minimum_required(VERSION 2.8)
4
5set(SOURCES src/tinystr.cpp 4set(SOURCES src/tinystr.cpp
6 src/tinyxml.cpp 5 src/tinyxml.cpp
7 src/tinyxmlerror.cpp 6 src/tinyxmlerror.cpp
diff --git a/project/cmake/addons/depends/windows/CMakeLists.txt b/project/cmake/addons/depends/windows/CMakeLists.txt
index 4480f1e..c8739c0 100644
--- a/project/cmake/addons/depends/windows/CMakeLists.txt
+++ b/project/cmake/addons/depends/windows/CMakeLists.txt
@@ -1,7 +1,6 @@
1cmake_minimum_required(VERSION 3.1)
1project(kodi-addons-depends-windows) 2project(kodi-addons-depends-windows)
2 3
3cmake_minimum_required(VERSION 2.8)
4
5list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) 4list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
6 5
7if(NOT CMAKE_BUILD_TYPE) 6if(NOT CMAKE_BUILD_TYPE)
@@ -10,13 +9,13 @@ endif()
10 9
11include(ExternalProject) 10include(ExternalProject)
12 11
13if(NOT DEPENDS_PATH) 12if(NOT ADDON_DEPENDS_PATH)
14 message(FATAL_ERROR "DEPENDS_PATH (${DEPENDS_PATH}) is not a valid target directory.") 13 message(FATAL_ERROR "ADDON_DEPENDS_PATH (${ADDON_DEPENDS_PATH}) is not a valid target directory.")
15else() 14else()
16 file(TO_CMAKE_PATH "${DEPENDS_PATH}" DEPENDS_PATH) 15 file(TO_CMAKE_PATH "${ADDON_DEPENDS_PATH}" ADDON_DEPENDS_PATH)
17endif() 16endif()
18get_filename_component(DEPENDS_PATH "${DEPENDS_PATH}" ABSOLUTE) 17get_filename_component(ADDON_DEPENDS_PATH "${ADDON_DEPENDS_PATH}" ABSOLUTE)
19list(APPEND CMAKE_PREFIX_PATH ${DEPENDS_PATH}) 18list(APPEND CMAKE_PREFIX_PATH ${ADDON_DEPENDS_PATH})
20 19
21if(NOT DEPENDS_TO_BUILD) 20if(NOT DEPENDS_TO_BUILD)
22 set(DEPENDS_TO_BUILD "all") 21 set(DEPENDS_TO_BUILD "all")
@@ -31,19 +30,17 @@ function(add_internal id url inputfile)
31 INSTALL_COMMAND ${CMAKE_COMMAND} 30 INSTALL_COMMAND ${CMAKE_COMMAND}
32 -DINPUTDIR=${PROJECT_BINARY_DIR}/build/${id}/src/${id} 31 -DINPUTDIR=${PROJECT_BINARY_DIR}/build/${id}/src/${id}
33 -DINPUTFILE=${inputfile} 32 -DINPUTFILE=${inputfile}
34 -DDESTDIR=${DEPENDS_PATH} 33 -DDESTDIR=${ADDON_DEPENDS_PATH}
35 -P ${PROJECT_SOURCE_DIR}/install.cmake 34 -P ${PROJECT_SOURCE_DIR}/Install.cmake
36 ) 35 )
37endfunction() 36endfunction()
38 37
39#find_package(7Zip REQUIRED)
40
41file(GLOB_RECURSE download_input_files prebuilt/*.txt) 38file(GLOB_RECURSE download_input_files prebuilt/*.txt)
42foreach(file ${download_input_files}) 39foreach(file ${download_input_files})
43 if(NOT file MATCHES install.txt) 40 if(NOT file MATCHES install.txt)
44 file(STRINGS ${file} def) 41 file(STRINGS ${file} def)
45 get_filename_component(dir ${file} PATH) 42 get_filename_component(dir ${file} DIRECTORY)
46 separate_arguments(def) 43 string(REPLACE " " ";" def ${def})
47 list(GET def 0 id) 44 list(GET def 0 id)
48 45
49 list(FIND DEPENDS_TO_BUILD ${id} idx) 46 list(FIND DEPENDS_TO_BUILD ${id} idx)
diff --git a/project/cmake/addons/depends/windows/Find7Zip.cmake b/project/cmake/addons/depends/windows/Find7Zip.cmake
deleted file mode 100644
index 82b0902..0000000
--- a/project/cmake/addons/depends/windows/Find7Zip.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
1find_program(7ZIP_EXECUTABLE NAMES 7z.exe
2 HINTS PATHS "c:/Program Files/7-Zip")
3
4include(FindPackageHandleStandardArgs)
5find_package_handle_standard_args(7Zip DEFAULT_MSG 7ZIP_EXECUTABLE)
6
7mark_as_advanced(7ZIP_EXECUTABLE)
diff --git a/project/cmake/addons/depends/windows/install.cmake b/project/cmake/addons/depends/windows/Install.cmake
index 9a3adbb..9a3adbb 100644
--- a/project/cmake/addons/depends/windows/install.cmake
+++ b/project/cmake/addons/depends/windows/Install.cmake
diff --git a/project/cmake/addons/depends/windows/extract-7z.cmake b/project/cmake/addons/depends/windows/extract-7z.cmake
deleted file mode 100644
index 95a2672..0000000
--- a/project/cmake/addons/depends/windows/extract-7z.cmake
+++ /dev/null
@@ -1,10 +0,0 @@
1get_filename_component(file ${URL} NAME)
2file(DOWNLOAD ${URL} ${DEST}/${file})
3execute_process(COMMAND ${7ZIP_EXECUTABLE} -y x ${DEST}/${file}
4 WORKING_DIRECTORY ${DESTDIR})
5if(${file} MATCHES .tar)
6 string(REPLACE ".7z" "" tarball ${file})
7 string(REPLACE ".lzma" "" tarball ${file})
8 execute_process(COMMAND ${7ZIP_EXECUTABLE} -y x ${DESTDIR}/${tarball}
9 WORKING_DIRECTORY ${DESTDIR})
10endif()
diff --git a/project/cmake/addons/depends/windows/extract-direct.cmake b/project/cmake/addons/depends/windows/extract-direct.cmake
deleted file mode 100644
index 13cb74f..0000000
--- a/project/cmake/addons/depends/windows/extract-direct.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
1get_filename_component(file ${URL} NAME)
2file(DOWNLOAD ${URL} ${DEST}/${file})