summaryrefslogtreecommitdiffstats
path: root/project/cmake
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2015-03-03 16:53:59 +0100
committermanuel <manuel@mausz.at>2015-03-03 16:53:59 +0100
commitffca21f2743a7b367fa212799c6e2fea6190dd5d (patch)
tree0608ea3a29cf644ec9ab204e2b4bb9bfaae1c381 /project/cmake
downloadkodi-pvr-build-ffca21f2743a7b367fa212799c6e2fea6190dd5d.tar.gz
kodi-pvr-build-ffca21f2743a7b367fa212799c6e2fea6190dd5d.tar.bz2
kodi-pvr-build-ffca21f2743a7b367fa212799c6e2fea6190dd5d.zip
initial commit for kodi master
Diffstat (limited to 'project/cmake')
-rw-r--r--project/cmake/addons/CMakeLists.txt249
-rw-r--r--project/cmake/addons/README68
-rw-r--r--project/cmake/addons/addons/audioencoder.flac/audioencoder.flac.txt1
-rw-r--r--project/cmake/addons/addons/audioencoder.flac/platforms.txt1
-rw-r--r--project/cmake/addons/addons/audioencoder.lame/audioencoder.lame.txt1
-rw-r--r--project/cmake/addons/addons/audioencoder.lame/platforms.txt1
-rw-r--r--project/cmake/addons/addons/audioencoder.vorbis/audioencoder.vorbis.txt1
-rw-r--r--project/cmake/addons/addons/audioencoder.vorbis/platforms.txt1
-rw-r--r--project/cmake/addons/addons/audioencoder.wav/audioencoder.wav.txt1
-rw-r--r--project/cmake/addons/addons/audioencoder.wav/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.argustv/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.argustv/pvr.argustv.txt1
-rw-r--r--project/cmake/addons/addons/pvr.demo/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.demo/pvr.demo.txt1
-rw-r--r--project/cmake/addons/addons/pvr.dvblink/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.dvblink/pvr.dvblink.txt1
-rw-r--r--project/cmake/addons/addons/pvr.dvbviewer/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt1
-rw-r--r--project/cmake/addons/addons/pvr.hts/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.hts/pvr.hts.txt1
-rw-r--r--project/cmake/addons/addons/pvr.iptvsimple/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.iptvsimple/pvr.iptvsimple.txt1
-rw-r--r--project/cmake/addons/addons/pvr.mediaportal.tvserver/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.mediaportal.tvserver/pvr.mediaportal.tvserver.txt1
-rw-r--r--project/cmake/addons/addons/pvr.mythtv/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.mythtv/pvr.mythtv.txt1
-rw-r--r--project/cmake/addons/addons/pvr.nextpvr/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.nextpvr/pvr.nextpvr.txt1
-rw-r--r--project/cmake/addons/addons/pvr.njoy/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.njoy/pvr.njoy.txt1
-rw-r--r--project/cmake/addons/addons/pvr.vdr.vnsi/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.vdr.vnsi/pvr.vdr.vnsi.txt1
-rw-r--r--project/cmake/addons/addons/pvr.vuplus/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.vuplus/pvr.vuplus.txt1
-rw-r--r--project/cmake/addons/addons/pvr.wmc/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.wmc/pvr.wmc.txt1
-rw-r--r--project/cmake/addons/depends/CMakeLists.txt42
-rw-r--r--project/cmake/addons/depends/README61
-rw-r--r--project/cmake/addons/depends/common/kodi-platform/deps.txt2
-rw-r--r--project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt1
-rw-r--r--project/cmake/addons/depends/common/tinyxml/CMakeLists.txt23
-rw-r--r--project/cmake/addons/depends/common/tinyxml/tinyxml.txt1
-rw-r--r--project/cmake/addons/depends/windows/CMakeLists.txt55
-rw-r--r--project/cmake/addons/depends/windows/Find7Zip.cmake7
-rw-r--r--project/cmake/addons/depends/windows/README19
-rw-r--r--project/cmake/addons/depends/windows/extract-7z.cmake10
-rw-r--r--project/cmake/addons/depends/windows/extract-direct.cmake2
-rw-r--r--project/cmake/addons/depends/windows/install.cmake24
-rw-r--r--project/cmake/addons/depends/windows/prebuilt/README21
-rw-r--r--project/cmake/kodi-config.cmake.in11
-rw-r--r--project/cmake/platform/android/defines.txt1
-rw-r--r--project/cmake/platform/darwin/defines.txt1
-rw-r--r--project/cmake/platform/freebsd/defines.txt1
-rw-r--r--project/cmake/platform/ios/defines.txt1
-rw-r--r--project/cmake/platform/linux/defines.txt1
-rw-r--r--project/cmake/platform/rbpi/defines.txt1
-rw-r--r--project/cmake/platform/windows/defines.txt1
-rw-r--r--project/cmake/scripts/common/addon-helpers.cmake113
-rw-r--r--project/cmake/scripts/common/addoptions.cmake82
-rw-r--r--project/cmake/scripts/common/check_target_platform.cmake61
-rw-r--r--project/cmake/scripts/common/handle-depends.cmake191
-rw-r--r--project/cmake/scripts/common/prepare-env.cmake88
-rw-r--r--project/cmake/scripts/windows/c-flag-overrides.cmake5
-rw-r--r--project/cmake/scripts/windows/cxx-flag-overrides.cmake5
-rw-r--r--project/cmake/xbmc-config.cmake.in4
65 files changed, 1186 insertions, 0 deletions
diff --git a/project/cmake/addons/CMakeLists.txt b/project/cmake/addons/CMakeLists.txt
new file mode 100644
index 0000000..0afc622
--- /dev/null
+++ b/project/cmake/addons/CMakeLists.txt
@@ -0,0 +1,249 @@
1project(kodi-addons)
2
3cmake_minimum_required(VERSION 2.8)
4
5list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
6
7if(NOT CMAKE_BUILD_TYPE)
8 set(CMAKE_BUILD_TYPE Release)
9endif()
10
11if(NOT CORE_SYSTEM_NAME)
12 string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME)
13endif()
14
15include(ExternalProject)
16
17### setup all the necessary paths
18if(NOT APP_ROOT AND NOT XBMCROOT)
19 set(APP_ROOT ${PROJECT_SOURCE_DIR}/../../..)
20elseif(NOT APP_ROOT)
21 file(TO_CMAKE_PATH "${XBMCROOT}" APP_ROOT)
22else()
23 file(TO_CMAKE_PATH "${APP_ROOT}" APP_ROOT)
24endif()
25get_filename_component(APP_ROOT "${APP_ROOT}" ABSOLUTE)
26
27if(NOT BUILD_DIR)
28 set(BUILD_DIR "${CMAKE_BINARY_DIR}/build")
29else()
30 file(TO_CMAKE_PATH "${BUILD_DIR}" BUILD_DIR)
31endif()
32get_filename_component(BUILD_DIR "${BUILD_DIR}" ABSOLUTE)
33
34if(NOT DEPENDS_PATH)
35 set(DEPENDS_PATH "${BUILD_DIR}/depends")
36else()
37 file(TO_CMAKE_PATH "${DEPENDS_PATH}" DEPENDS_PATH)
38endif()
39get_filename_component(DEPENDS_PATH "${DEPENDS_PATH}" ABSOLUTE)
40
41if(NOT PLATFORM_DIR)
42 set(PLATFORM_DIR ${APP_ROOT}/project/cmake/platform/${CORE_SYSTEM_NAME})
43 file(TO_CMAKE_PATH "${PLATFORM_DIR}" PLATFORM_DIR)
44endif()
45
46# make sure CMAKE_PREFIX_PATH is set
47if(NOT CMAKE_PREFIX_PATH)
48 set(CMAKE_PREFIX_PATH "${DEPENDS_PATH}")
49else()
50 file(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH)
51 list(APPEND CMAKE_PREFIX_PATH "${DEPENDS_PATH}")
52endif()
53
54# check for autoconf stuff to pass on
55if(AUTOCONF_FILES)
56 separate_arguments(AUTOCONF_FILES)
57 set(CROSS_AUTOCONF "yes")
58endif()
59
60if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX)
61 set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/output/addons")
62endif()
63list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX})
64
65set(BUILD_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
66 -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
67 -DPACKAGE_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig
68 -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
69 -DCMAKE_USER_MAKE_RULES_OVERRIDE=${CMAKE_USER_MAKE_RULES_OVERRIDE}
70 -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX=${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX}
71 -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME}
72 -DBUILD_SHARED_LIBS=1
73 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
74 -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS})
75
76if(PACKAGE_ZIP)
77 # needed for project installing
78 list(APPEND BUILD_ARGS -DPACKAGE_ZIP=1)
79 MESSAGE("package zip specified")
80endif()
81
82if(CMAKE_TOOLCHAIN_FILE)
83 list(APPEND BUILD_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
84 MESSAGE("toolchain specified")
85 MESSAGE(${BUILD_ARGS})
86endif()
87
88if(NOT ADDONS_TO_BUILD)
89 set(ADDONS_TO_BUILD "all")
90else()
91 message(STATUS "Building following addons: ${ADDONS_TO_BUILD}")
92 separate_arguments(ADDONS_TO_BUILD)
93endif()
94
95if(NOT KODI_LIB_DIR)
96 set(KODI_LIB_DIR "${DEPENDS_PATH}/lib/kodi")
97else()
98 file(TO_CMAKE_PATH "${KODI_LIB_DIR}" KODI_LIB_DIR)
99endif()
100
101# check for platform specific stuff
102if(EXISTS ${PLATFORM_DIR}/defines.txt)
103 file(STRINGS ${PLATFORM_DIR}/defines.txt platformdefines)
104
105 if(NOT ARCH_DEFINES AND platformdefines)
106 set(ARCH_DEFINES ${platformdefines})
107 endif()
108endif()
109
110# include check_target_platform() function
111include(${APP_ROOT}/project/cmake/scripts/common/check_target_platform.cmake)
112
113# check install permissions
114set(ADDON_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
115check_install_permissions(${CMAKE_INSTALL_PREFIX} can_write)
116if(NOT ${can_write} AND NOT WIN32)
117 set(NEED_SUDO TRUE)
118 set(ADDON_INSTALL_DIR ${CMAKE_BINARY_DIR}/.install)
119 message(STATUS "NEED_SUDO: ${NEED_SUDO}")
120endif()
121
122### prepare the build environment for the binary addons
123# copy the prepare-env.cmake script to the depends path so that we can include it
124file(COPY ${APP_ROOT}/project/cmake/scripts/common/prepare-env.cmake DESTINATION ${KODI_LIB_DIR})
125
126# add the location of prepare-env.cmake to CMAKE_MODULE_PATH so that it is found
127list(APPEND CMAKE_MODULE_PATH ${KODI_LIB_DIR})
128
129# include prepare-env.cmake which contains the logic to install the addon header bindings etc
130include(prepare-env)
131
132### add the depends subdirectory for any general dependencies
133add_subdirectory(depends)
134
135### get and build all the binary addons
136# look for all the addons to be built
137file(GLOB_RECURSE addons ${PROJECT_SOURCE_DIR}/addons/*.txt)
138foreach(addon ${addons})
139 if(NOT (addon MATCHES platforms.txt))
140 file(STRINGS ${addon} def)
141 separate_arguments(def)
142 list(GET def 0 id)
143
144 list(FIND ADDONS_TO_BUILD ${id} idx)
145 if(idx GREATER -1 OR ADDONS_TO_BUILD STREQUAL "all")
146 get_filename_component(dir ${addon} PATH)
147
148 # check if the addon has a platforms.txt
149 set(platform_found FALSE)
150 check_target_platform(${dir} ${CORE_SYSTEM_NAME} platform_found)
151
152 if (${platform_found})
153 # make sure the output directory is clean
154 if(EXISTS "${CMAKE_INSTALL_PREFIX}/${id}")
155 file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/${id}/")
156 endif()
157
158 # get the URL and revision of the addon
159 list(LENGTH def deflength)
160 list(GET def 1 url)
161
162 set(archive_name ${id})
163
164 # if there is a 3rd parameter in the file, we consider it a git revision
165 if(deflength GREATER 2)
166 list(GET def 2 revision)
167
168 # Note: downloading specific revisions via http in the format below is probably github specific
169 # if we ever use other repositories, this might need adapting
170 set(url ${url}/archive/${revision}.tar.gz)
171 set(archive_name ${archive_name}-${revision})
172 endif()
173
174 # download and extract the addon
175 if(NOT EXISTS ${BUILD_DIR}/download/${archive_name}.tar.gz)
176 # cleanup any of the previously downloaded archives of this addon
177 file(GLOB archives "${BUILD_DIR}/download/${id}*.tar.gz")
178 if(archives)
179 message(STATUS "Removing old archives of ${id}: ${archives}")
180 file(REMOVE ${archives})
181 endif()
182
183 # download the addon
184 file(DOWNLOAD "${url}" "${BUILD_DIR}/download/${archive_name}.tar.gz" STATUS dlstatus LOG dllog SHOW_PROGRESS)
185 list(GET dlstatus 0 retcode)
186 if(NOT ${retcode} EQUAL 0)
187 message(FATAL_ERROR "ERROR downloading ${url} - status: ${dlstatus} log: ${dllog}")
188 endif()
189 endif()
190
191 # remove any previously extracted version of the addon
192 if(EXISTS "${BUILD_DIR}/${id}")
193 file(REMOVE_RECURSE "${BUILD_DIR}/${id}")
194 endif()
195
196 # extract the addon from the archive
197 execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzvf ${BUILD_DIR}/download/${archive_name}.tar.gz
198 WORKING_DIRECTORY ${BUILD_DIR})
199 file(GLOB extract_dir "${BUILD_DIR}/${archive_name}*")
200 if(extract_dir STREQUAL "")
201 message(FATAL_ERROR "Error extracting ${BUILD_DIR}/download/${archive_name}.tar.gz")
202 else()
203 file(RENAME "${extract_dir}" "${BUILD_DIR}/${id}")
204 endif()
205
206 list(APPEND downloaded_addons ${id})
207
208 endif()
209 endif()
210 endif()
211endforeach()
212
213foreach(id ${downloaded_addons})
214 externalproject_add(${id}
215 SOURCE_DIR ${BUILD_DIR}/${id}
216 INSTALL_DIR ${ADDON_INSTALL_DIR}
217 CMAKE_ARGS ${BUILD_ARGS})
218
219 # add a custom step to the external project between the configure and the build step which will always
220 # be executed and therefore forces a re-build of all changed files
221 externalproject_add_step(${id} forcebuild
222 COMMAND ${CMAKE_COMMAND} -E echo "Force build of ${id}"
223 DEPENDEES configure
224 DEPENDERS build
225 ALWAYS 1)
226
227 # add "kodi-platform" as a dependency to every addon
228 add_dependencies(${id} kodi-platform)
229
230 set(${id}_DEPENDS_DIR ${BUILD_DIR}/${id}/depends)
231
232 if(EXISTS ${${id}_DEPENDS_DIR})
233 include(${APP_ROOT}/project/cmake/scripts/common/handle-depends.cmake)
234 add_addon_depends(${id} ${${id}_DEPENDS_DIR})
235 if (${id}_DEPS AND NOT "${${id}_DEPS}" STREQUAL "")
236 message(STATUS "${id} DEPENDENCIES: ${${id}_DEPS}")
237 add_dependencies(${id} ${${id}_DEPS})
238 endif()
239 endif()
240endforeach()
241
242if(NEED_SUDO)
243 add_custom_target(install
244 COMMAND ${CMAKE_COMMAND} -E echo "\n\n"
245 COMMAND ${CMAKE_COMMAND} -E echo "WARNING: sudo rights needed to install to ${CMAKE_INSTALL_PREFIX}\n"
246 COMMAND sudo ${CMAKE_COMMAND} -E copy_directory ${ADDON_INSTALL_DIR}/ ${CMAKE_INSTALL_PREFIX}/
247 COMMAND sudo ${CMAKE_COMMAND} -E remove_directory ${ADDON_INSTALL_DIR}/
248 COMMAND sudo -k)
249endif()
diff --git a/project/cmake/addons/README b/project/cmake/addons/README
new file mode 100644
index 0000000..c66e668
--- /dev/null
+++ b/project/cmake/addons/README
@@ -0,0 +1,68 @@
1KODI ADDONS
2===========
3This directory contains the cmake-based buildsystem for addons. It looks into
4the "addons" sub-directory and parses all *.txt files recursively. Each addon
5must have its own <addon-id>.txt file in a separate sub-directory which must
6follow the defined format:
7 <addon-id> <git-url> <git-revision>
8where
9 * <addon-id> must be identical to the addon's ID as defined in the addon's
10 addon.xml
11 * <git-url> must be the URL of the git repository containing the addon.
12 * <git-revision> must be a valid git tag/branch/commit in the addon's git
13 repository which will be used for the build.
14
15Reserved filenames (for additional information on how to build an addon)
16are:
17 * platforms.txt: List of platforms to build an addon for (or "all"). It is
18 also supported to specify negated platforms with a leading exclamation mark
19 (i), e.g. "!windows".
20 Available platforms are: linux, windows, darwin, ios, android, rbpi
21
22The buildsystem uses the following variables (which can be passed into it when
23executing cmake with the -D<variable-name>=<value> option) to e.g. access
24specific paths:
25 * ADDONS_TO_BUILD is a quoted, space delimited list of <addon-id>s that
26 you want to build (default is "all").
27 * CMAKE_BUILD_TYPE specifies the type of the build. This can be either "Debug"
28 or "Release" (default is "Release").
29 * CMAKE_INSTALL_PREFIX points to the directory where the built addons and their
30 additional files (addon.xml, resources ...) will be installed to (defaults
31 to <DEPENDS_PATH>).
32 * CMAKE_TOOLCHAIN_FILE can be used to pass a toolchain file into the add-on
33 builds.
34 * DEPENDS_PATH points to the directory containing the "include" and "lib"
35 directories of the addons' dependencies.
36 * APP_ROOT points to the root directory of the project (default is the
37 absolute representation of ../../.. starting from this directory).
38 * BUILD_DIR points to the directory where the addons and their dependencies
39 will be downloaded and built.
40 * PACKAGE_ZIP=1 will mean the add-ons will be 'packaged' into a common folder,
41 rather than being placed in <CMAKE_INSTALL_PREFIX>/lib/kodi/addons and
42 <CMAKE_INSTALL_PREFIX>/share/kodi/addons.
43 * ARCH_DEFINES specifies the platform-specific C/C++ preprocessor defines
44 (defaults to empty).
45
46The buildsystem makes some assumptions about the environment which must be met
47by whoever uses it:
48 * Any dependencies of the addons must already be built and their include and
49 library files must be present in the path pointed to by <CMAKE_PREFIX_PATH> (in
50 "include" and "lib" sub-directories).
51
52To trigger the cmake-based buildsystem the following command must be executed
53with <path> being the path to this directory (absolute or relative, allowing for
54in-source and out-of-source builds).
55
56 cmake <path> -G <generator>
57
58cmake supports multiple generators, see
59http://www.cmake.org/cmake/help/v2.8.8/cmake.html#section_Generators for a list.
60
61In case of additional options the call might look like this
62
63 cmake <path> [-G <generator>] \
64 -DCMAKE_BUILD_TYPE=Release \
65 -DAPP_ROOT="<path-to-app-root>" \
66 -DARCH_DEFINES="-DTARGET_LINUX" \
67 -DDEPENDS_PATH="<path-to-built-depends>" \
68 -DCMAKE_INSTALL_PREFIX="<path-to-install-directory"
diff --git a/project/cmake/addons/addons/audioencoder.flac/audioencoder.flac.txt b/project/cmake/addons/addons/audioencoder.flac/audioencoder.flac.txt
new file mode 100644
index 0000000..5886cfa
--- /dev/null
+++ b/project/cmake/addons/addons/audioencoder.flac/audioencoder.flac.txt
@@ -0,0 +1 @@
audioencoder.flac https://github.com/xbmc/audioencoder.flac 84acb14
diff --git a/project/cmake/addons/addons/audioencoder.flac/platforms.txt b/project/cmake/addons/addons/audioencoder.flac/platforms.txt
new file mode 100644
index 0000000..174a52e
--- /dev/null
+++ b/project/cmake/addons/addons/audioencoder.flac/platforms.txt
@@ -0,0 +1 @@
!ios \ No newline at end of file
diff --git a/project/cmake/addons/addons/audioencoder.lame/audioencoder.lame.txt b/project/cmake/addons/addons/audioencoder.lame/audioencoder.lame.txt
new file mode 100644
index 0000000..a55dc44
--- /dev/null
+++ b/project/cmake/addons/addons/audioencoder.lame/audioencoder.lame.txt
@@ -0,0 +1 @@
audioencoder.lame https://github.com/xbmc/audioencoder.lame 3eb59de
diff --git a/project/cmake/addons/addons/audioencoder.lame/platforms.txt b/project/cmake/addons/addons/audioencoder.lame/platforms.txt
new file mode 100644
index 0000000..baa6044
--- /dev/null
+++ b/project/cmake/addons/addons/audioencoder.lame/platforms.txt
@@ -0,0 +1 @@
all \ No newline at end of file
diff --git a/project/cmake/addons/addons/audioencoder.vorbis/audioencoder.vorbis.txt b/project/cmake/addons/addons/audioencoder.vorbis/audioencoder.vorbis.txt
new file mode 100644
index 0000000..8decf52
--- /dev/null
+++ b/project/cmake/addons/addons/audioencoder.vorbis/audioencoder.vorbis.txt
@@ -0,0 +1 @@
audioencoder.vorbis https://github.com/xbmc/audioencoder.vorbis d556a68
diff --git a/project/cmake/addons/addons/audioencoder.vorbis/platforms.txt b/project/cmake/addons/addons/audioencoder.vorbis/platforms.txt
new file mode 100644
index 0000000..baa6044
--- /dev/null
+++ b/project/cmake/addons/addons/audioencoder.vorbis/platforms.txt
@@ -0,0 +1 @@
all \ No newline at end of file
diff --git a/project/cmake/addons/addons/audioencoder.wav/audioencoder.wav.txt b/project/cmake/addons/addons/audioencoder.wav/audioencoder.wav.txt
new file mode 100644
index 0000000..b3209f6
--- /dev/null
+++ b/project/cmake/addons/addons/audioencoder.wav/audioencoder.wav.txt
@@ -0,0 +1 @@
audioencoder.wav https://github.com/xbmc/audioencoder.wav 40aaedf
diff --git a/project/cmake/addons/addons/audioencoder.wav/platforms.txt b/project/cmake/addons/addons/audioencoder.wav/platforms.txt
new file mode 100644
index 0000000..baa6044
--- /dev/null
+++ b/project/cmake/addons/addons/audioencoder.wav/platforms.txt
@@ -0,0 +1 @@
all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.argustv/platforms.txt b/project/cmake/addons/addons/pvr.argustv/platforms.txt
new file mode 100644
index 0000000..baa6044
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.argustv/platforms.txt
@@ -0,0 +1 @@
all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.argustv/pvr.argustv.txt b/project/cmake/addons/addons/pvr.argustv/pvr.argustv.txt
new file mode 100644
index 0000000..bb928b6
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.argustv/pvr.argustv.txt
@@ -0,0 +1 @@
pvr.argustv https://github.com/kodi-pvr/pvr.argustv b6a58d3 \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.demo/platforms.txt b/project/cmake/addons/addons/pvr.demo/platforms.txt
new file mode 100644
index 0000000..baa6044
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.demo/platforms.txt
@@ -0,0 +1 @@
all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.demo/pvr.demo.txt b/project/cmake/addons/addons/pvr.demo/pvr.demo.txt
new file mode 100644
index 0000000..71e18c0
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.demo/pvr.demo.txt
@@ -0,0 +1 @@
pvr.demo https://github.com/kodi-pvr/pvr.demo e457cf4 \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.dvblink/platforms.txt b/project/cmake/addons/addons/pvr.dvblink/platforms.txt
new file mode 100644
index 0000000..baa6044
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.dvblink/platforms.txt
@@ -0,0 +1 @@
all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.dvblink/pvr.dvblink.txt b/project/cmake/addons/addons/pvr.dvblink/pvr.dvblink.txt
new file mode 100644
index 0000000..58e0d5a
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.dvblink/pvr.dvblink.txt
@@ -0,0 +1 @@
pvr.dvblink https://github.com/kodi-pvr/pvr.dvblink 10b9c1d \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.dvbviewer/platforms.txt b/project/cmake/addons/addons/pvr.dvbviewer/platforms.txt
new file mode 100644
index 0000000..baa6044
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.dvbviewer/platforms.txt
@@ -0,0 +1 @@
all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt b/project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt
new file mode 100644
index 0000000..8ebacac
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt
@@ -0,0 +1 @@
pvr.dvbviewer https://github.com/kodi-pvr/pvr.dvbviewer 3420504 \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.hts/platforms.txt b/project/cmake/addons/addons/pvr.hts/platforms.txt
new file mode 100644
index 0000000..baa6044
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.hts/platforms.txt
@@ -0,0 +1 @@
all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.hts/pvr.hts.txt b/project/cmake/addons/addons/pvr.hts/pvr.hts.txt
new file mode 100644
index 0000000..4c8068d
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.hts/pvr.hts.txt
@@ -0,0 +1 @@
pvr.hts https://github.com/kodi-pvr/pvr.hts 3bc77ae \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.iptvsimple/platforms.txt b/project/cmake/addons/addons/pvr.iptvsimple/platforms.txt
new file mode 100644
index 0000000..baa6044
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.iptvsimple/platforms.txt
@@ -0,0 +1 @@
all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.iptvsimple/pvr.iptvsimple.txt b/project/cmake/addons/addons/pvr.iptvsimple/pvr.iptvsimple.txt
new file mode 100644
index 0000000..73358b7
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.iptvsimple/pvr.iptvsimple.txt
@@ -0,0 +1 @@
pvr.iptvsimple https://github.com/kodi-pvr/pvr.iptvsimple f6ca894 \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.mediaportal.tvserver/platforms.txt b/project/cmake/addons/addons/pvr.mediaportal.tvserver/platforms.txt
new file mode 100644
index 0000000..baa6044
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.mediaportal.tvserver/platforms.txt
@@ -0,0 +1 @@
all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.mediaportal.tvserver/pvr.mediaportal.tvserver.txt b/project/cmake/addons/addons/pvr.mediaportal.tvserver/pvr.mediaportal.tvserver.txt
new file mode 100644
index 0000000..534ede1
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.mediaportal.tvserver/pvr.mediaportal.tvserver.txt
@@ -0,0 +1 @@
pvr.mediaportal.tvserver https://github.com/kodi-pvr/pvr.mediaportal.tvserver 87422e6 \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.mythtv/platforms.txt b/project/cmake/addons/addons/pvr.mythtv/platforms.txt
new file mode 100644
index 0000000..baa6044
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.mythtv/platforms.txt
@@ -0,0 +1 @@
all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.mythtv/pvr.mythtv.txt b/project/cmake/addons/addons/pvr.mythtv/pvr.mythtv.txt
new file mode 100644
index 0000000..9c77d98
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.mythtv/pvr.mythtv.txt
@@ -0,0 +1 @@
pvr.mythtv https://github.com/kodi-pvr/pvr.mythtv 6e9cf98 \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.nextpvr/platforms.txt b/project/cmake/addons/addons/pvr.nextpvr/platforms.txt
new file mode 100644
index 0000000..baa6044
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.nextpvr/platforms.txt
@@ -0,0 +1 @@
all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.nextpvr/pvr.nextpvr.txt b/project/cmake/addons/addons/pvr.nextpvr/pvr.nextpvr.txt
new file mode 100644
index 0000000..0d3df74
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.nextpvr/pvr.nextpvr.txt
@@ -0,0 +1 @@
pvr.nextpvr https://github.com/kodi-pvr/pvr.nextpvr 79557b2 \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.njoy/platforms.txt b/project/cmake/addons/addons/pvr.njoy/platforms.txt
new file mode 100644
index 0000000..baa6044
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.njoy/platforms.txt
@@ -0,0 +1 @@
all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.njoy/pvr.njoy.txt b/project/cmake/addons/addons/pvr.njoy/pvr.njoy.txt
new file mode 100644
index 0000000..e33573b
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.njoy/pvr.njoy.txt
@@ -0,0 +1 @@
pvr.njoy https://github.com/kodi-pvr/pvr.njoy dee3094 \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.vdr.vnsi/platforms.txt b/project/cmake/addons/addons/pvr.vdr.vnsi/platforms.txt
new file mode 100644
index 0000000..baa6044
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.vdr.vnsi/platforms.txt
@@ -0,0 +1 @@
all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.vdr.vnsi/pvr.vdr.vnsi.txt b/project/cmake/addons/addons/pvr.vdr.vnsi/pvr.vdr.vnsi.txt
new file mode 100644
index 0000000..8d6f770
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.vdr.vnsi/pvr.vdr.vnsi.txt
@@ -0,0 +1 @@
pvr.vdr.vnsi https://github.com/FernetMenta/pvr.vdr.vnsi 3cc618e \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.vuplus/platforms.txt b/project/cmake/addons/addons/pvr.vuplus/platforms.txt
new file mode 100644
index 0000000..baa6044
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.vuplus/platforms.txt
@@ -0,0 +1 @@
all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.vuplus/pvr.vuplus.txt b/project/cmake/addons/addons/pvr.vuplus/pvr.vuplus.txt
new file mode 100644
index 0000000..e3983d8
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.vuplus/pvr.vuplus.txt
@@ -0,0 +1 @@
pvr.vuplus https://github.com/kodi-pvr/pvr.vuplus 6acc177 \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.wmc/platforms.txt b/project/cmake/addons/addons/pvr.wmc/platforms.txt
new file mode 100644
index 0000000..baa6044
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.wmc/platforms.txt
@@ -0,0 +1 @@
all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.wmc/pvr.wmc.txt b/project/cmake/addons/addons/pvr.wmc/pvr.wmc.txt
new file mode 100644
index 0000000..1be8ad5
--- /dev/null
+++ b/project/cmake/addons/addons/pvr.wmc/pvr.wmc.txt
@@ -0,0 +1 @@
pvr.wmc https://github.com/kodi-pvr/pvr.wmc e4b5285 \ No newline at end of file
diff --git a/project/cmake/addons/depends/CMakeLists.txt b/project/cmake/addons/depends/CMakeLists.txt
new file mode 100644
index 0000000..760acf4
--- /dev/null
+++ b/project/cmake/addons/depends/CMakeLists.txt
@@ -0,0 +1,42 @@
1project(kodi-addons-depends)
2
3cmake_minimum_required(VERSION 2.8)
4
5list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
6
7if(NOT CMAKE_BUILD_TYPE)
8 set(CMAKE_BUILD_TYPE Release)
9endif()
10
11if(NOT CORE_SYSTEM_NAME)
12 string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME)
13endif()
14
15include(ExternalProject)
16
17if(NOT DEPENDS_PATH)
18 set(DEPENDS_PATH ${PROJECT_SOURCE_DIR}/../build/depends)
19else()
20 file(TO_CMAKE_PATH "${DEPENDS_PATH}" DEPENDS_PATH)
21endif()
22get_filename_component(DEPENDS_PATH "${DEPENDS_PATH}" ABSOLUTE)
23list(APPEND CMAKE_PREFIX_PATH ${DEPENDS_PATH})
24
25if(NOT BUILD_DIR)
26 set(BUILD_DIR "${CMAKE_BINARY_DIR}/build")
27else()
28 file(TO_CMAKE_PATH "${BUILD_DIR}" BUILD_DIR)
29endif()
30get_filename_component(BUILD_DIR "${BUILD_DIR}" ABSOLUTE)
31
32## use add_addon_depends to handle the cmake based dependencies
33include(${APP_ROOT}/project/cmake/scripts/common/handle-depends.cmake)
34add_addon_depends(depends "${PROJECT_SOURCE_DIR}")
35
36## if there's a platform-specific sub-directory containing a CMakeLists.txt, add it to the build as well
37if(EXISTS ${PROJECT_SOURCE_DIR}/${CORE_SYSTEM_NAME}/CMakeLists.txt)
38 message(STATUS "Processing ${CORE_SYSTEM_NAME}")
39 add_subdirectory(${CORE_SYSTEM_NAME})
40else()
41 message(STATUS "No platform specific file ${PROJECT_SOURCE_DIR}/${CORE_SYSTEM_NAME}/CMakeLists.txt found")
42endif()
diff --git a/project/cmake/addons/depends/README b/project/cmake/addons/depends/README
new file mode 100644
index 0000000..66e924a
--- /dev/null
+++ b/project/cmake/addons/depends/README
@@ -0,0 +1,61 @@
1KODI ADDON DEPENDENCIES
2=======================
3This directory contains the cmake-based buildsystem for addon dependencies. It
4looks into the "common" and the "<platform>/cmake" sub-directories and parses
5all *.txt files recursively. Each dependency must have its own <dependency>.txt
6file (either in the main sub-directory or in a separate subdirectory of the main
7subdirectory) which must follow one of the defined formats:
8 * an empty file means that no extra downloads are necessary
9 * <dependency>
10 * <dependency> <url>
11 * <dependency> <git-url> <git-revision>
12where
13 * <dependency> must be identical to the filename
14 * <url> must be the URL to an archive that is downloaded and extracted.
15 * <git-url> must be the URL of the git repository containing the
16 dependency.
17 * <git-revision> must be a valid git tag/branch/commit in the dependency's git
18 repository which will be used for the build.
19
20Reserved filenames (for additional information on how to build a dependency)
21are:
22 * CMakeLists.txt: build instructions for the dependency
23 * install.txt: instructions on how to install the dependency's built files
24 * noinstall.txt: no installation step required (content is ignored)
25 * flags.txt: additional build flags
26 * deps.txt: whitespace separated list of dependencies of this dependency
27
28The buildsystem uses the following variables (which can be passed into it when
29executing cmake with the -D<variable-name>=<value> option) to e.g. access
30specific paths:
31 * CMAKE_BUILD_TYPE specifies the type of the build. This can be either "Debug"
32 or "Release" (default is "Release").
33 * CMAKE_TOOLCHAIN_FILE can be used to pass a toolchain file into the add-on
34 builds.
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)).
37 * APP_ROOT points to the root directory of the project (default is the
38 absolute representation of ../../.. starting from this directory).
39 * DEPENDS_PATH points to the directory where the built dependencies
40 (their include and library file) will be installed to.
41 * ARCH_DEFINES specifies the platform-specific C/C++ preprocessor defines
42 (defaults to empty).
43 * DEPENDS_TO_BUILD is a quoted, space delimited list of <dependency>s that
44 you want to build (default is "all").
45
46To trigger the cmake-based buildsystem the following command must be executed
47with <path> being the path to this directory (absolute or relative, allowing for
48in-source and out-of-source builds).
49
50 cmake <path> -G <generator>
51
52cmake supports multiple generators, see
53http://www.cmake.org/cmake/help/v2.8.8/cmake.html#section_Generators for a list.
54
55In case of additional options the call might look like this
56
57 cmake <path> [-G <generator>] \
58 -DCMAKE_BUILD_TYPE=Release \
59 -DAPP_ROOT="<path-to-project-root>" \
60 -DARCH_DEFINES="-DTARGET_LINUX" \
61 -DCMAKE_INSTALL_PREFIX="<path-to-install-directory"
diff --git a/project/cmake/addons/depends/common/kodi-platform/deps.txt b/project/cmake/addons/depends/common/kodi-platform/deps.txt
new file mode 100644
index 0000000..f0e8246
--- /dev/null
+++ b/project/cmake/addons/depends/common/kodi-platform/deps.txt
@@ -0,0 +1,2 @@
1kodi
2tinyxml \ No newline at end of file
diff --git a/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt b/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt
new file mode 100644
index 0000000..fb6916a
--- /dev/null
+++ b/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt
@@ -0,0 +1 @@
kodi-platform https://github.com/xbmc/kodi-platform 68315f0
diff --git a/project/cmake/addons/depends/common/tinyxml/CMakeLists.txt b/project/cmake/addons/depends/common/tinyxml/CMakeLists.txt
new file mode 100644
index 0000000..5468bfb
--- /dev/null
+++ b/project/cmake/addons/depends/common/tinyxml/CMakeLists.txt
@@ -0,0 +1,23 @@
1project(tinyxml)
2
3cmake_minimum_required(VERSION 2.8)
4
5set(SOURCES src/tinystr.cpp
6 src/tinyxml.cpp
7 src/tinyxmlerror.cpp
8 src/tinyxmlparser.cpp)
9
10if(WIN32)
11 add_definitions(-DWIN32 -D_LIB)
12endif()
13add_definitions(-DTIXML_USE_STL)
14
15add_library(tinyxml ${SOURCES})
16
17include_directories(${PROJECT_SOURCE_DIR}/include)
18
19set(HEADERS ${PROJECT_SOURCE_DIR}/include/tinystr.h
20 ${PROJECT_SOURCE_DIR}/include/tinyxml.h)
21
22install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
23install(TARGETS tinyxml DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
diff --git a/project/cmake/addons/depends/common/tinyxml/tinyxml.txt b/project/cmake/addons/depends/common/tinyxml/tinyxml.txt
new file mode 100644
index 0000000..456b0c5
--- /dev/null
+++ b/project/cmake/addons/depends/common/tinyxml/tinyxml.txt
@@ -0,0 +1 @@
tinyxml http://mirrors.xbmc.org/build-deps/sources/tinyxml-2.6.2_2.tar.gz
diff --git a/project/cmake/addons/depends/windows/CMakeLists.txt b/project/cmake/addons/depends/windows/CMakeLists.txt
new file mode 100644
index 0000000..4480f1e
--- /dev/null
+++ b/project/cmake/addons/depends/windows/CMakeLists.txt
@@ -0,0 +1,55 @@
1project(kodi-addons-depends-windows)
2
3cmake_minimum_required(VERSION 2.8)
4
5list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
6
7if(NOT CMAKE_BUILD_TYPE)
8 set(CMAKE_BUILD_TYPE Release)
9endif()
10
11include(ExternalProject)
12
13if(NOT DEPENDS_PATH)
14 message(FATAL_ERROR "DEPENDS_PATH (${DEPENDS_PATH}) is not a valid target directory.")
15else()
16 file(TO_CMAKE_PATH "${DEPENDS_PATH}" DEPENDS_PATH)
17endif()
18get_filename_component(DEPENDS_PATH "${DEPENDS_PATH}" ABSOLUTE)
19list(APPEND CMAKE_PREFIX_PATH ${DEPENDS_PATH})
20
21if(NOT DEPENDS_TO_BUILD)
22 set(DEPENDS_TO_BUILD "all")
23endif()
24
25function(add_internal id url inputfile)
26 externalproject_add(${id}
27 URL ${url}
28 PREFIX build/${id}
29 CONFIGURE_COMMAND ""
30 BUILD_COMMAND ""
31 INSTALL_COMMAND ${CMAKE_COMMAND}
32 -DINPUTDIR=${PROJECT_BINARY_DIR}/build/${id}/src/${id}
33 -DINPUTFILE=${inputfile}
34 -DDESTDIR=${DEPENDS_PATH}
35 -P ${PROJECT_SOURCE_DIR}/install.cmake
36 )
37endfunction()
38
39#find_package(7Zip REQUIRED)
40
41file(GLOB_RECURSE download_input_files prebuilt/*.txt)
42foreach(file ${download_input_files})
43 if(NOT file MATCHES install.txt)
44 file(STRINGS ${file} def)
45 get_filename_component(dir ${file} PATH)
46 separate_arguments(def)
47 list(GET def 0 id)
48
49 list(FIND DEPENDS_TO_BUILD ${id} idx)
50 if(idx GREATER -1 OR DEPENDS_TO_BUILD STREQUAL "all")
51 list(GET def 1 url)
52 add_internal(${id} ${url} ${dir}/install.txt)
53 endif()
54 endif()
55endforeach()
diff --git a/project/cmake/addons/depends/windows/Find7Zip.cmake b/project/cmake/addons/depends/windows/Find7Zip.cmake
new file mode 100644
index 0000000..82b0902
--- /dev/null
+++ b/project/cmake/addons/depends/windows/Find7Zip.cmake
@@ -0,0 +1,7 @@
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/README b/project/cmake/addons/depends/windows/README
new file mode 100644
index 0000000..67dc594
--- /dev/null
+++ b/project/cmake/addons/depends/windows/README
@@ -0,0 +1,19 @@
1KODI WIN32 ADDON DEPENDENCIES
2=============================
3This directory contains the cmake-based buildsystem for dependencies (currently
4only prebuilt) used by one or multiple addons. The buildsystem looks into the
5"prebuilt" sub-directory, downloads all the specified dependencies, extracts
6them and places them into the "depends" sub-directory.
7
8To trigger the cmake-based buildsystem the following command must be executed
9with <path> being the path to this directory (absolute or relative, allowing for
10in-source and out-of-source builds).
11
12 cmake <path> [-G <generator>]
13
14cmake supports multiple generators, see
15http://www.cmake.org/cmake/help/v2.8.8/cmake.html#section_Generators for a list.
16For win32 builds one of the "Visual Studio XX" or the "NMake Makefiles"
17generators is preferred. For the "NMake Makefiles" generator to work the above
18command must be called from an environment prepared for VC++ builds (see
19http://msdn.microsoft.com/en-us/library/f2ccy3wt.aspx).
diff --git a/project/cmake/addons/depends/windows/extract-7z.cmake b/project/cmake/addons/depends/windows/extract-7z.cmake
new file mode 100644
index 0000000..95a2672
--- /dev/null
+++ b/project/cmake/addons/depends/windows/extract-7z.cmake
@@ -0,0 +1,10 @@
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
new file mode 100644
index 0000000..13cb74f
--- /dev/null
+++ b/project/cmake/addons/depends/windows/extract-direct.cmake
@@ -0,0 +1,2 @@
1get_filename_component(file ${URL} NAME)
2file(DOWNLOAD ${URL} ${DEST}/${file})
diff --git a/project/cmake/addons/depends/windows/install.cmake b/project/cmake/addons/depends/windows/install.cmake
new file mode 100644
index 0000000..9a3adbb
--- /dev/null
+++ b/project/cmake/addons/depends/windows/install.cmake
@@ -0,0 +1,24 @@
1if(EXISTS "${INPUTFILE}")
2 # if there's an input file we use it to determine which files to copy where
3 file(STRINGS ${INPUTFILE} FILES)
4 string(REPLACE "\n" ";" FILES "${FILES}")
5 foreach(file ${FILES})
6 string(REPLACE " " ";" file "${file}")
7 list(GET file 0 dir)
8 list(GET file 1 dest)
9 list(LENGTH file deflength)
10 if(deflength GREATER 2)
11 list(GET file 2 copy)
12 endif()
13 file(GLOB files ${INPUTDIR}/${dir})
14 foreach(instfile ${files})
15 file(COPY ${instfile} DESTINATION ${DESTDIR}/${dest})
16 if(copy)
17 file(COPY ${instfile} DESTINATION ${DESTDIR}/${copy})
18 endif()
19 endforeach()
20 endforeach()
21else()
22 # otherwise we assume that the content of the extracted archive is already well-formed and can just be copied
23 file(COPY ${INPUTDIR}/${dir} DESTINATION ${DESTDIR})
24endif() \ No newline at end of file
diff --git a/project/cmake/addons/depends/windows/prebuilt/README b/project/cmake/addons/depends/windows/prebuilt/README
new file mode 100644
index 0000000..a0c70d6
--- /dev/null
+++ b/project/cmake/addons/depends/windows/prebuilt/README
@@ -0,0 +1,21 @@
1KODI WIN32 PREBUILT ADDON DEPENDENCIES
2======================================
3This directory contains a file or sub-directory for every prebuilt dependency
4used by one of the addons being built. There are two different modes supported.
5Both include a file named <library-id>.txt which must follow the defined format
6 <library-id> <download-url>
7
8If the archive, which the <download-url> points at, contains
9 * only the necessary files and in the proper directory structure (i.e. an
10 "include" and a "lib" directory) then the file must be put into this
11 directory and nothing else is needed.
12 * unnecessary files and/or does not follow the defined directory structure
13 (i.e. an "include" and a "lib" directory) then the file must be put into a
14 sub-directory named <library-id>. Furthermore an additional file called
15 "install.txt" must be placed in that sub-directory. install.txt contains a
16 line for every path/directory/file with a destination where it must be copied
17 to. It must follow the defined format
18 <source> <destination> [<copy-destination>]
19 where <source> must be an existing file, directory or a path containing
20 wildcards, <destination> and the optional <copy-destination> must be existing
21 directories.
diff --git a/project/cmake/kodi-config.cmake.in b/project/cmake/kodi-config.cmake.in
new file mode 100644
index 0000000..0e3b158
--- /dev/null
+++ b/project/cmake/kodi-config.cmake.in
@@ -0,0 +1,11 @@
1SET(KODI_INCLUDE_DIR @prefix@/include)
2SET(APP_NAME @APP_NAME@)
3SET(APP_VERSION_MAJOR @APP_VERSION_MAJOR@)
4SET(APP_VERSION_MINOR @APP_VERSION_MINOR@)
5IF(NOT WIN32)
6 SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} @CXX11_SWITCH@")
7ENDIF()
8LIST(APPEND CMAKE_MODULE_PATH @prefix@/lib/kodi)
9ADD_DEFINITIONS(@ARCH_DEFINES@)
10
11include(addon-helpers)
diff --git a/project/cmake/platform/android/defines.txt b/project/cmake/platform/android/defines.txt
new file mode 100644
index 0000000..fa103d0
--- /dev/null
+++ b/project/cmake/platform/android/defines.txt
@@ -0,0 +1 @@
-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -DTARGET_ANDROID
diff --git a/project/cmake/platform/darwin/defines.txt b/project/cmake/platform/darwin/defines.txt
new file mode 100644
index 0000000..33b009e
--- /dev/null
+++ b/project/cmake/platform/darwin/defines.txt
@@ -0,0 +1 @@
-DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX -D_LINUX
diff --git a/project/cmake/platform/freebsd/defines.txt b/project/cmake/platform/freebsd/defines.txt
new file mode 100644
index 0000000..9483597
--- /dev/null
+++ b/project/cmake/platform/freebsd/defines.txt
@@ -0,0 +1 @@
-DTARGET_POSIX -DTARGET_FREEBSD -D_LINUX
diff --git a/project/cmake/platform/ios/defines.txt b/project/cmake/platform/ios/defines.txt
new file mode 100644
index 0000000..d0989ea
--- /dev/null
+++ b/project/cmake/platform/ios/defines.txt
@@ -0,0 +1 @@
-DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_IOS -D_LINUX
diff --git a/project/cmake/platform/linux/defines.txt b/project/cmake/platform/linux/defines.txt
new file mode 100644
index 0000000..3fe9c5c
--- /dev/null
+++ b/project/cmake/platform/linux/defines.txt
@@ -0,0 +1 @@
-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -fPIC
diff --git a/project/cmake/platform/rbpi/defines.txt b/project/cmake/platform/rbpi/defines.txt
new file mode 100644
index 0000000..08fe4cb
--- /dev/null
+++ b/project/cmake/platform/rbpi/defines.txt
@@ -0,0 +1 @@
-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_ARMEL -DTARGET_RASPBERRY_PI
diff --git a/project/cmake/platform/windows/defines.txt b/project/cmake/platform/windows/defines.txt
new file mode 100644
index 0000000..5ccd98a
--- /dev/null
+++ b/project/cmake/platform/windows/defines.txt
@@ -0,0 +1 @@
-DTARGET_WINDOWS -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_USE_32BIT_TIME_T -D_WINSOCKAPI_ \ No newline at end of file
diff --git a/project/cmake/scripts/common/addon-helpers.cmake b/project/cmake/scripts/common/addon-helpers.cmake
new file mode 100644
index 0000000..b94df2a
--- /dev/null
+++ b/project/cmake/scripts/common/addon-helpers.cmake
@@ -0,0 +1,113 @@
1# Workaround for the fact that cpack's filenames are not customizable.
2# Each add-on is added as a separate component to facilitate zip/tgz packaging.
3# The filenames are always of the form basename-component, which is
4# incompatible with the addonid-version scheme we want. This hack renames
5# the files from the file names generated by the 'package' target.
6# Sadly we cannot extend the 'package' target, as it is a builtin target, see
7# http://public.kitware.com/Bug/view.php?id=8438
8# Thus, we have to add an 'addon-package' target.
9add_custom_target(addon-package
10 COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target package)
11
12macro(add_cpack_workaround target version ext)
13 add_custom_command(TARGET addon-package PRE_BUILD
14 COMMAND ${CMAKE_COMMAND} -E rename addon-${target}-${version}.${ext} ${target}-${version}.${ext})
15endmacro()
16
17# Grab the version from a given add-on's addon.xml
18macro (addon_version dir prefix)
19 FILE(READ ${dir}/addon.xml ADDONXML)
20 STRING(REGEX MATCH "<addon[^>]*version.?=.?.[0-9\\.]+" VERSION_STRING ${ADDONXML})
21 STRING(REGEX REPLACE ".*version=.([0-9\\.]+).*" "\\1" ${prefix}_VERSION ${VERSION_STRING})
22 message(STATUS ${prefix}_VERSION=${${prefix}_VERSION})
23endmacro()
24
25# Build, link and optionally package an add-on
26macro (build_addon target prefix libs)
27 ADD_LIBRARY(${target} ${${prefix}_SOURCES})
28 TARGET_LINK_LIBRARIES(${target} ${${libs}})
29 addon_version(${target} ${prefix})
30 SET_TARGET_PROPERTIES(${target} PROPERTIES VERSION ${${prefix}_VERSION}
31 SOVERSION ${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}
32 PREFIX "")
33 IF(OS STREQUAL "android")
34 SET_TARGET_PROPERTIES(${target} PROPERTIES PREFIX "lib")
35 ENDIF(OS STREQUAL "android")
36
37 # set zip as default if addon-package is called without PACKAGE_XXX
38 SET(CPACK_GENERATOR "ZIP")
39 SET(ext "zip")
40 IF(PACKAGE_ZIP OR PACKAGE_TGZ)
41 IF(PACKAGE_TGZ)
42 SET(CPACK_GENERATOR "TGZ")
43 SET(ext "tar.gz")
44 ENDIF(PACKAGE_TGZ)
45 SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
46 set(CPACK_PACKAGE_FILE_NAME addon)
47 IF(CMAKE_BUILD_TYPE STREQUAL "Release")
48 SET(CPACK_STRIP_FILES TRUE)
49 ENDIF(CMAKE_BUILD_TYPE STREQUAL "Release")
50 set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
51 set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
52 list(APPEND CPACK_COMPONENTS_ALL ${target}-${${prefix}_VERSION})
53 # Pack files together to create an archive
54 INSTALL(DIRECTORY ${target} DESTINATION ./ COMPONENT ${target}-${${prefix}_VERSION})
55 IF(WIN32)
56 # get the installation location for the addon's target
57 get_property(dll_location TARGET ${target} PROPERTY LOCATION)
58 # in case of a VC++ project the installation location contains a $(Configuration) VS variable
59 # we replace it with ${CMAKE_BUILD_TYPE} (which doesn't cover the case when the build configuration
60 # is changed within Visual Studio)
61 string(REPLACE "$(Configuration)" "${CMAKE_BUILD_TYPE}" dll_location "${dll_location}")
62
63 # install the generated DLL file
64 INSTALL(PROGRAMS ${dll_location} DESTINATION ${target}
65 COMPONENT ${target}-${${prefix}_VERSION})
66
67 IF(CMAKE_BUILD_TYPE MATCHES Debug)
68 # for debug builds also install the PDB file
69 get_filename_component(dll_directory ${dll_location} DIRECTORY)
70 INSTALL(FILES ${dll_directory}/${target}.pdb DESTINATION ${target}
71 COMPONENT ${target}-${${prefix}_VERSION})
72 ENDIF()
73 ELSE(WIN32)
74 INSTALL(TARGETS ${target} DESTINATION ${target}
75 COMPONENT ${target}-${${prefix}_VERSION})
76 ENDIF(WIN32)
77 add_cpack_workaround(${target} ${${prefix}_VERSION} ${ext})
78 ELSE(PACKAGE_ZIP OR PACKAGE_TGZ)
79 INSTALL(TARGETS ${target} DESTINATION lib/kodi/addons/${target})
80 INSTALL(DIRECTORY ${target} DESTINATION share/kodi/addons)
81 ENDIF(PACKAGE_ZIP OR PACKAGE_TGZ)
82endmacro()
83
84# finds a path to a given file (recursive)
85function (kodi_find_path var_name filename search_path strip_file)
86 file(GLOB_RECURSE PATH_TO_FILE ${search_path} ${filename})
87 if(strip_file)
88 string(REPLACE ${filename} "" PATH_TO_FILE ${PATH_TO_FILE})
89 endif(strip_file)
90 set (${var_name} ${PATH_TO_FILE} PARENT_SCOPE)
91endfunction()
92
93# Cmake build options
94include(addoptions)
95include(TestCXXAcceptsFlag)
96OPTION(PACKAGE_ZIP "Package Zip file?" OFF)
97OPTION(PACKAGE_TGZ "Package TGZ file?" OFF)
98OPTION(BUILD_SHARED_LIBS "Build shared libs?" ON)
99
100# LTO support?
101CHECK_CXX_ACCEPTS_FLAG("-flto" HAVE_LTO)
102IF(HAVE_LTO)
103 OPTION(USE_LTO "use link time optimization" OFF)
104 IF(USE_LTO)
105 add_options(ALL_LANGUAGES ALL_BUILDS "-flto")
106 ENDIF(USE_LTO)
107ENDIF(HAVE_LTO)
108
109# set this to try linking dependencies as static as possible
110IF(ADDONS_PREFER_STATIC_LIBS)
111 SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
112ENDIF(ADDONS_PREFER_STATIC_LIBS)
113
diff --git a/project/cmake/scripts/common/addoptions.cmake b/project/cmake/scripts/common/addoptions.cmake
new file mode 100644
index 0000000..0ebb823
--- /dev/null
+++ b/project/cmake/scripts/common/addoptions.cmake
@@ -0,0 +1,82 @@
1# - Add options without repeating them on the command line
2#
3# Synopsis:
4#
5# add_options (lang build opts)
6#
7# where:
8#
9# lang Name of the language whose compiler should receive the
10# options, e.g. CXX. If a comma-separated list is received
11# then the option is added for all those languages. Use the
12# special value ALL_LANGUAGES for these languages: CXX, C
13# and Fortran
14#
15# build Kind of build to which this options should apply,
16# such as DEBUG and RELEASE. This can also be a comma-
17# separated list. Use the special value ALL_BUILDS to apply
18# to all builds.
19#
20# opts List of options to add. Each should be quoted.
21#
22# Example:
23#
24# add_options (CXX RELEASE "-O3" "-DNDEBUG" "-Wall")
25
26function (add_options langs builds)
27 # special handling of empty language specification
28 if ("${langs}" STREQUAL "ALL_LANGUAGES")
29 set (langs CXX C Fortran)
30 endif ("${langs}" STREQUAL "ALL_LANGUAGES")
31 foreach (lang IN LISTS langs)
32 # prepend underscore if necessary
33 foreach (build IN LISTS builds)
34 if (NOT ("${build}" STREQUAL "ALL_BUILDS"))
35 set (_bld "_${build}")
36 string (TOUPPER "${_bld}" _bld)
37 else (NOT ("${build}" STREQUAL "ALL_BUILDS"))
38 set (_bld "")
39 endif (NOT ("${build}" STREQUAL "ALL_BUILDS"))
40 foreach (_opt IN LISTS ARGN)
41 set (_var "CMAKE_${lang}_FLAGS${_bld}")
42 #message (STATUS "Adding \"${_opt}\" to \${${_var}}")
43 # remove it first
44 string (REPLACE "${_opt}" "" _without "${${_var}}")
45 string (STRIP "${_without}" _without)
46 # we need to strip this one as well, so they are comparable
47 string (STRIP "${${_var}}" _stripped)
48 # if it wasn't there, then add it at the end
49 if ("${_without}" STREQUAL "${_stripped}")
50 # don't add any extra spaces if no options yet are set
51 if (NOT ${_stripped} STREQUAL "")
52 set (${_var} "${_stripped} ${_opt}")
53 else (NOT ${_stripped} STREQUAL "")
54 set (${_var} "${_opt}")
55 endif (NOT ${_stripped} STREQUAL "")
56 set (${_var} "${${_var}}" PARENT_SCOPE)
57 endif ("${_without}" STREQUAL "${_stripped}")
58 endforeach (_opt)
59 endforeach (build)
60 endforeach (lang)
61endfunction (add_options lang build)
62
63# set varname to flag unless user has specified something that matches regex
64function (set_default_option varname flag regex)
65 if (NOT "$ENV{CXXFLAGS}" MATCHES "${regex}"
66 AND NOT "${CMAKE_CXX_FLAGS}" MATCHES "${regex}"
67 AND NOT "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}" MATCHES "${regex}")
68 set (${varname} ${flag} PARENT_SCOPE)
69 else (NOT "$ENV{CXXFLAGS}" MATCHES "${regex}"
70 AND NOT "${CMAKE_CXX_FLAGS}" MATCHES "${regex}"
71 AND NOT "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}" MATCHES "${regex}")
72 set (${varname} PARENT_SCOPE)
73 endif (NOT "$ENV{CXXFLAGS}" MATCHES "${regex}"
74 AND NOT "${CMAKE_CXX_FLAGS}" MATCHES "${regex}"
75 AND NOT "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}" MATCHES "${regex}")
76endfunction (set_default_option)
77
78# note: this must be called before project()
79macro (no_default_options)
80 # prevent the platform probe to set options
81 set (CMAKE_NOT_USING_CONFIG_FLAGS TRUE)
82endmacro (no_default_options)
diff --git a/project/cmake/scripts/common/check_target_platform.cmake b/project/cmake/scripts/common/check_target_platform.cmake
new file mode 100644
index 0000000..fc8b403
--- /dev/null
+++ b/project/cmake/scripts/common/check_target_platform.cmake
@@ -0,0 +1,61 @@
1# handle target platforms
2function(check_target_platform dir target_platform build)
3 # param[in] dir path/directory of the addon/dependency
4 # param[in] target_platform target platform of the build
5 # param[out] build Result whether the addon/dependency should be built for the specified target platform
6
7 set(${build} FALSE)
8 # check if the given directory exists and contains a platforms.txt
9 if(EXISTS ${dir} AND EXISTS ${dir}/platforms.txt)
10 # get all the specified platforms
11 file(STRINGS ${dir}/platforms.txt platforms)
12 separate_arguments(platforms)
13
14 # check if the addon/dependency should be built for the current platform
15 foreach(platform ${platforms})
16 if(${platform} STREQUAL "all" OR ${platform} STREQUAL ${target_platform})
17 set(${build} TRUE)
18 else()
19 # check if the platform is defined as "!<platform>"
20 string(SUBSTRING ${platform} 0 1 platform_first)
21 if(${platform_first} STREQUAL "!")
22 # extract the platform
23 string(LENGTH ${platform} platform_length)
24 MATH(EXPR platform_length "${platform_length} - 1")
25 string(SUBSTRING ${platform} 1 ${platform_length} platform)
26
27 # check if the current platform does not match the extracted platform
28 if (NOT ${platform} STREQUAL ${target_platform})
29 set(${build} TRUE)
30 endif()
31 endif()
32 endif()
33 endforeach()
34 else()
35 set(${build} TRUE)
36 endif()
37
38 # make the ${build} variable available to the calling script
39 set(${build} "${${build}}" PARENT_SCOPE)
40endfunction()
41
42function(check_install_permissions install_dir have_perms)
43 # param[in] install_dir directory to check for write permissions
44 # param[out] have_perms wether we have permissions to install to install_dir
45
46 set(${have_perms} TRUE)
47 execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${install_dir}/lib/kodi
48 COMMAND ${CMAKE_COMMAND} -E make_directory ${install_dir}/share/kodi
49 COMMAND ${CMAKE_COMMAND} -E touch ${install_dir}/lib/kodi/.cmake-inst-test ${install_dir}/share/kodi/.cmake-inst-test
50 RESULT_VARIABLE permtest)
51
52 if(${permtest} GREATER 0)
53 message(STATUS "check_install_permissions: ${permtest}")
54 set(${have_perms} FALSE)
55 endif()
56 set(${have_perms} "${${have_perms}}" PARENT_SCOPE)
57
58 if(EXISTS ${install_dir}/lib/kodi/.cmake-inst-test OR EXISTS ${install_dir}/share/kodi/.cmake-inst-test)
59 file(REMOVE ${install_dir}/lib/kodi/.cmake-inst-test ${install_dir}/share/kodi/.cmake-inst-test)
60 endif()
61endfunction()
diff --git a/project/cmake/scripts/common/handle-depends.cmake b/project/cmake/scripts/common/handle-depends.cmake
new file mode 100644
index 0000000..b3bf3cd
--- /dev/null
+++ b/project/cmake/scripts/common/handle-depends.cmake
@@ -0,0 +1,191 @@
1include(${APP_ROOT}/project/cmake/scripts/common/check_target_platform.cmake)
2
3# handle addon depends
4function(add_addon_depends addon searchpath)
5 # input: string addon string searchpath
6
7 set(OUTPUT_DIR ${DEPENDS_PATH})
8 file(GLOB_RECURSE cmake_input_files ${searchpath}/${CORE_SYSTEM_NAME}/*.txt)
9 file(GLOB_RECURSE cmake_input_files2 ${searchpath}/common/*.txt)
10 list(APPEND cmake_input_files ${cmake_input_files2})
11
12 foreach(file ${cmake_input_files})
13 if(NOT (file MATCHES CMakeLists.txt OR
14 file MATCHES install.txt OR
15 file MATCHES noinstall.txt OR
16 file MATCHES flags.txt OR
17 file MATCHES deps.txt OR
18 file MATCHES platforms.txt))
19 message(STATUS "Processing ${file}")
20 file(STRINGS ${file} def)
21 separate_arguments(def)
22 list(LENGTH def deflength)
23 get_filename_component(dir ${file} PATH)
24
25 # get the id of the dependency
26 if(NOT "${def}" STREQUAL "")
27 # read the id from the file
28 list(GET def 0 id)
29 else()
30 # read the id from the filename
31 get_filename_component(id ${file} NAME_WE)
32 endif()
33
34 # check if the dependency has a platforms.txt
35 set(platform_found FALSE)
36 check_target_platform(${dir} ${CORE_SYSTEM_NAME} platform_found)
37
38 if(${platform_found} AND NOT TARGET ${id})
39 # determine the download URL of the dependency
40 set(url "")
41 if(deflength GREATER 1)
42 list(GET def 1 url)
43 message(STATUS "${id} url: ${url}")
44 endif()
45
46 # check if there are any library specific flags that need to be passed on
47 if(EXISTS ${dir}/flags.txt)
48 file(STRINGS ${dir}/flags.txt extraflags)
49 separate_arguments(extraflags)
50 message(STATUS "${id} extraflags: ${extraflags}")
51 endif()
52
53 set(BUILD_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
54 -DOUTPUT_DIR=${OUTPUT_DIR}
55 -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
56 -DCMAKE_USER_MAKE_RULES_OVERRIDE=${CMAKE_USER_MAKE_RULES_OVERRIDE}
57 -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX=${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX}
58 -DCMAKE_INSTALL_PREFIX=${OUTPUT_DIR}
59 -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME}
60 -DENABLE_STATIC=1
61 -DBUILD_SHARED_LIBS=0)
62 # if there are no make rules override files available take care of manually passing on ARCH_DEFINES
63 if(NOT CMAKE_USER_MAKE_RULES_OVERRIDE AND NOT CMAKE_USER_MAKE_RULES_OVERRIDE_CXX)
64 # make sure we create strings, not lists
65 set(TMP_C_FLAGS "${CMAKE_C_FLAGS} ${ARCH_DEFINES}")
66 set(TMP_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_DEFINES}")
67 list(APPEND BUILD_ARGS -DCMAKE_C_FLAGS=${TMP_C_FLAGS}
68 -DCMAKE_CXX_FLAGS=${TMP_CXX_FLAGS})
69 endif()
70
71 if(CMAKE_TOOLCHAIN_FILE)
72 list(APPEND BUILD_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
73 MESSAGE("toolchain specified")
74 MESSAGE(${BUILD_ARGS})
75 endif()
76
77 # if there's a CMakeLists.txt use it to prepare the build
78 set(PATCH_FILE ${BUILD_DIR}/${id}/tmp/patch.cmake)
79 if(EXISTS ${dir}/CMakeLists.txt)
80 file(APPEND ${PATCH_FILE}
81 "file(COPY ${dir}/CMakeLists.txt
82 DESTINATION ${BUILD_DIR}/${id}/src/${id})\n")
83 endif()
84
85 # check if we have patches to apply
86 file(GLOB patches ${dir}/*.patch)
87 list(SORT patches)
88 foreach(patch ${patches})
89 file(APPEND ${PATCH_FILE}
90 "execute_process(COMMAND patch -p1 -i ${patch})\n")
91 endforeach()
92
93
94 # if there's an install.txt use it to properly install the built files
95 set(INSTALL_COMMAND "")
96 if(EXISTS ${dir}/install.txt)
97 set(INSTALL_COMMAND INSTALL_COMMAND ${CMAKE_COMMAND}
98 -DINPUTDIR=${BUILD_DIR}/${id}/src/${id}-build/
99 -DINPUTFILE=${dir}/install.txt
100 -DDESTDIR=${OUTPUT_DIR}
101 -DENABLE_STATIC=1
102 "${extraflags}"
103 -P ${PROJECT_SOURCE_DIR}/install.cmake)
104 elseif(EXISTS ${dir}/noinstall.txt)
105 set(INSTALL_COMMAND INSTALL_COMMAND "")
106 endif()
107
108 # check if there's a deps.txt containing dependencies on other libraries
109 if(EXISTS ${dir}/deps.txt)
110 file(STRINGS ${dir}/deps.txt deps)
111 message(STATUS "${id} depends: ${deps}")
112 else()
113 set(deps)
114 endif()
115
116 if(CROSS_AUTOCONF AND AUTOCONF_FILES)
117 foreach(afile ${AUTOCONF_FILES})
118 file(APPEND ${PATCH_FILE}
119 "message(STATUS \"AUTOCONF: copying ${afile} to ${BUILD_DIR}/${id}/src/${id}\")\n
120 file(COPY ${afile} DESTINATION ${BUILD_DIR}/${id}/src/${id})\n")
121 endforeach()
122 endif()
123
124 # if the patch file exists we need to set the PATCH_COMMAND
125 set(PATCH_COMMAND "")
126 if (EXISTS ${PATCH_FILE})
127 set(PATCH_COMMAND ${CMAKE_COMMAND} -P ${PATCH_FILE})
128 endif()
129
130 # prepare the setup of the call to externalproject_add()
131 set(EXTERNALPROJECT_SETUP PREFIX ${BUILD_DIR}/${id}
132 CMAKE_ARGS ${extraflags} ${BUILD_ARGS}
133 PATCH_COMMAND ${PATCH_COMMAND}
134 "${INSTALL_COMMAND}")
135
136 # if there's an url defined we need to pass that to externalproject_add()
137 if(DEFINED url AND NOT "${url}" STREQUAL "")
138 # check if there's a third parameter in the file
139 if(deflength GREATER 2)
140 # the third parameter is considered as a revision of a git repository
141 list(GET def 2 revision)
142
143 externalproject_add(${id}
144 GIT_REPOSITORY ${url}
145 GIT_TAG ${revision}
146 "${EXTERNALPROJECT_SETUP}")
147 else()
148 set(CONFIGURE_COMMAND "")
149 if(NOT WIN32)
150 # manually specify the configure command to be able to pass in the custom PKG_CONFIG_PATH
151 set(CONFIGURE_COMMAND PKG_CONFIG_PATH=${OUTPUT_DIR}/lib/pkgconfig
152 ${CMAKE_COMMAND} -DCMAKE_LIBRARY_PATH=${OUTPUT_DIR}/lib ${extraflags} ${BUILD_ARGS}
153 ${BUILD_DIR}/${id}/src/${id}
154 -DPACKAGE_CONFIG_PATH=${OUTPUT_DIR}/lib/pkgconfig
155 -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
156 -DOUTPUT_DIR=${OUTPUT_DIR}
157 -DCMAKE_PREFIX_PATH=${OUTPUT_DIR}
158 -DCMAKE_INSTALL_PREFIX=${OUTPUT_DIR}
159 -DCMAKE_EXE_LINKER_FLAGS=-L${OUTPUT_DIR}/lib
160 -DCMAKE_INCLUDE_PATH=${OUTPUT_DIR}/include)
161 endif()
162
163 externalproject_add(${id}
164 URL ${url}
165 DOWNLOAD_DIR ${BUILD_DIR}/download
166 CONFIGURE_COMMAND ${CONFIGURE_COMMAND}
167 "${EXTERNALPROJECT_SETUP}")
168 endif()
169 else()
170 externalproject_add(${id}
171 SOURCE_DIR ${dir}
172 "${EXTERNALPROJECT_SETUP}")
173 endif()
174
175 if(deps)
176 add_dependencies(${id} ${deps})
177 endif()
178 endif()
179
180 # if the dependency is available for the target platform add it to the list of the addon's dependencies
181 # (even if the target already exists as it still has to be built before the addon)
182 if(${platform_found})
183 list(APPEND ${addon}_DEPS ${id})
184 endif()
185 endif()
186 endforeach()
187
188 # make the ${addon}_DEPS variable available to the calling script
189 set(${addon}_DEPS "${${addon}_DEPS}" PARENT_SCOPE)
190endfunction()
191
diff --git a/project/cmake/scripts/common/prepare-env.cmake b/project/cmake/scripts/common/prepare-env.cmake
new file mode 100644
index 0000000..7df421c
--- /dev/null
+++ b/project/cmake/scripts/common/prepare-env.cmake
@@ -0,0 +1,88 @@
1# parse version.txt to get the version info
2if(EXISTS "${APP_ROOT}/version.txt")
3 file(STRINGS "${APP_ROOT}/version.txt" versions)
4 foreach (version ${versions})
5 if(version MATCHES "^VERSION_.*")
6 string(REGEX MATCH "^[^ ]+" version_name ${version})
7 string(REPLACE "${version_name} " "" version_value ${version})
8 set(APP_${version_name} "${version_value}")
9 else()
10 string(REGEX MATCH "^[^ ]+" name ${version})
11 string(REPLACE "${name} " "" value ${version})
12 set(${name} "${value}")
13 endif()
14 endforeach()
15endif()
16
17# bail if we can't parse versions
18if(NOT DEFINED APP_VERSION_MAJOR OR NOT DEFINED APP_VERSION_MINOR)
19 message(FATAL_ERROR "Could not determine app version! make sure that ${APP_ROOT}/version.txt exists")
20endif()
21
22### copy all the addon binding header files to include/kodi
23# make sure include/kodi exists and is empty
24set(KODI_LIB_DIR ${DEPENDS_PATH}/lib/kodi)
25if(NOT EXISTS "${KODI_LIB_DIR}/")
26 file(MAKE_DIRECTORY ${KODI_LIB_DIR})
27endif()
28
29set(KODI_INCLUDE_DIR ${DEPENDS_PATH}/include/kodi)
30if(NOT EXISTS "${KODI_INCLUDE_DIR}/")
31 file(MAKE_DIRECTORY ${KODI_INCLUDE_DIR})
32endif()
33
34# we still need XBMC_INCLUDE_DIR and XBMC_LIB_DIR for backwards compatibility to xbmc
35set(XBMC_LIB_DIR ${DEPENDS_PATH}/lib/xbmc)
36if(NOT EXISTS "${XBMC_LIB_DIR}/")
37 file(MAKE_DIRECTORY ${XBMC_LIB_DIR})
38endif()
39set(XBMC_INCLUDE_DIR ${DEPENDS_PATH}/include/xbmc)
40if(NOT EXISTS "${XBMC_INCLUDE_DIR}/")
41 file(MAKE_DIRECTORY ${XBMC_INCLUDE_DIR})
42endif()
43
44# make sure C++11 is always set
45if(NOT WIN32)
46 string(REGEX MATCH "-std=(gnu|c)\\+\\+11" cxx11flag "${CMAKE_CXX_FLAGS}")
47 if(NOT cxx11flag)
48 set(CXX11_SWITCH "-std=c++11")
49 endif()
50endif()
51
52# kodi-config.cmake.in (further down) expects a "prefix" variable
53get_filename_component(prefix "${DEPENDS_PATH}" ABSOLUTE)
54
55# generate the proper kodi-config.cmake file
56configure_file(${APP_ROOT}/project/cmake/kodi-config.cmake.in ${KODI_LIB_DIR}/kodi-config.cmake @ONLY)
57# copy cmake helpers to lib/kodi
58file(COPY ${APP_ROOT}/project/cmake/scripts/common/addon-helpers.cmake ${APP_ROOT}/project/cmake/scripts/common/addoptions.cmake DESTINATION ${KODI_LIB_DIR})
59
60# generate xbmc-config.cmake for backwards compatibility to xbmc
61configure_file(${APP_ROOT}/project/cmake/xbmc-config.cmake.in ${XBMC_LIB_DIR}/xbmc-config.cmake @ONLY)
62
63### copy all the addon binding header files to include/kodi
64# parse addon-bindings.mk to get the list of header files to copy
65file(STRINGS ${APP_ROOT}/xbmc/addons/addon-bindings.mk bindings)
66string(REPLACE "\n" ";" bindings "${bindings}")
67foreach(binding ${bindings})
68 string(REPLACE " =" ";" binding "${binding}")
69 string(REPLACE "+=" ";" binding "${binding}")
70 list(GET binding 1 header)
71 # copy the header file to include/kodi
72 file(COPY ${APP_ROOT}/${header} DESTINATION ${KODI_INCLUDE_DIR})
73
74 # auto-generate header files for backwards compatibility to xbmc with deprecation warning
75 # but only do it if the file doesn't already exist
76 get_filename_component(headerfile ${header} NAME)
77 if (NOT EXISTS "${XBMC_INCLUDE_DIR}/${headerfile}")
78 file(WRITE ${XBMC_INCLUDE_DIR}/${headerfile}
79"#pragma once
80#define DEPRECATION_WARNING \"Including xbmc/${headerfile} has been deprecated, please use kodi/${headerfile}\"
81#ifdef _MSC_VER
82 #pragma message(\"WARNING: \" DEPRECATION_WARNING)
83#else
84 #warning DEPRECATION_WARNING
85#endif
86#include \"kodi/${headerfile}\"")
87 endif()
88endforeach()
diff --git a/project/cmake/scripts/windows/c-flag-overrides.cmake b/project/cmake/scripts/windows/c-flag-overrides.cmake
new file mode 100644
index 0000000..ab19701
--- /dev/null
+++ b/project/cmake/scripts/windows/c-flag-overrides.cmake
@@ -0,0 +1,5 @@
1if(MSVC)
2 set(CMAKE_C_FLAGS "/MP /DWIN32 /D_WINDOWS /W3 /Zi /arch:SSE2")
3 set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG /MDd /Ob0 /Od /RTC1 /D_HAS_ITERATOR_DEBUGGING=0 /D_SECURE_SCL=0")
4 set(CMAKE_C_FLAGS_RELEASE "/MD /Ox /Ob2 /Oi /Ot /Oy /GL /DNDEBUG")
5endif(MSVC) \ No newline at end of file
diff --git a/project/cmake/scripts/windows/cxx-flag-overrides.cmake b/project/cmake/scripts/windows/cxx-flag-overrides.cmake
new file mode 100644
index 0000000..ad3a090
--- /dev/null
+++ b/project/cmake/scripts/windows/cxx-flag-overrides.cmake
@@ -0,0 +1,5 @@
1if(MSVC)
2 set(CMAKE_CXX_FLAGS "/MP /DWIN32 /D_WINDOWS /W3 /GR /Zi /EHsc /arch:SSE2")
3 set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MDd /Ob0 /Od /RTC1 /D_HAS_ITERATOR_DEBUGGING=0 /D_SECURE_SCL=0")
4 set(CMAKE_CXX_FLAGS_RELEASE "/MD /Ox /Ob2 /Oi /Ot /Oy /GL /DNDEBUG")
5endif(MSVC) \ No newline at end of file
diff --git a/project/cmake/xbmc-config.cmake.in b/project/cmake/xbmc-config.cmake.in
new file mode 100644
index 0000000..73d1c9c
--- /dev/null
+++ b/project/cmake/xbmc-config.cmake.in
@@ -0,0 +1,4 @@
1message(WARNING "find_package(xbmc) has been deprecated, please use find_package(kodi)")
2
3find_package(kodi REQUIRED)
4set(XBMC_INCLUDE_DIR ${KODI_INCLUDE_DIR}) \ No newline at end of file