summaryrefslogtreecommitdiffstats
path: root/project/cmake/addons/depends
diff options
context:
space:
mode:
Diffstat (limited to 'project/cmake/addons/depends')
-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
13 files changed, 268 insertions, 0 deletions
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.