summaryrefslogtreecommitdiffstats
path: root/project/cmake/addons/bootstrap/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'project/cmake/addons/bootstrap/CMakeLists.txt')
-rw-r--r--project/cmake/addons/bootstrap/CMakeLists.txt94
1 files changed, 0 insertions, 94 deletions
diff --git a/project/cmake/addons/bootstrap/CMakeLists.txt b/project/cmake/addons/bootstrap/CMakeLists.txt
deleted file mode 100644
index c20b97e..0000000
--- a/project/cmake/addons/bootstrap/CMakeLists.txt
+++ /dev/null
@@ -1,94 +0,0 @@
1cmake_minimum_required(VERSION 3.1)
2project(kodi-addons-bootstrap)
3
4list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
5
6# make sure CMAKE_INSTALL_PREFIX is properly set
7if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX)
8 set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/../addons")
9endif()
10list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX})
11
12# figure out where the build directory is located
13if(NOT BUILD_DIR)
14 set(BUILD_DIR "${CMAKE_BINARY_DIR}/build")
15else()
16 file(TO_CMAKE_PATH "${BUILD_DIR}" BUILD_DIR)
17endif()
18get_filename_component(BUILD_DIR "${BUILD_DIR}" ABSOLUTE)
19
20# make sure that the repositories to build have been specified
21if(NOT REPOSITORY_TO_BUILD)
22 set(REPOSITORY_TO_BUILD_DEFAULT ON)
23 set(REPOSITORY_TO_BUILD "all")
24 set(REPOSITORY_REVISION "")
25 message(STATUS "Bootstrapping all repositories")
26else()
27 set(REPOSITORY_TO_BUILD_DEFAULT OFF)
28 message(STATUS "Bootstrapping following repository: ${REPOSITORY_TO_BUILD}")
29endif()
30
31# figure out which addons to bootstrap (defaults to all)
32if(NOT ADDONS_TO_BUILD)
33 set(ADDONS_TO_BUILD "all")
34 message(STATUS "Bootstrapping all addons")
35else()
36 message(STATUS "Bootstrapping following addons: ${ADDONS_TO_BUILD}")
37endif()
38
39include(ExternalProject)
40
41function(bootstrap_repo repo_id repo_url repo_revision)
42 message(STATUS "Bootstrapping addons from ${repo_id} (${repo_url} ${repo_revision})...")
43 externalproject_add(${repo_id}
44 GIT_REPOSITORY ${repo_url}
45 GIT_TAG ${repo_revision}
46 PREFIX ${BUILD_DIR}/${repo_id}
47 CONFIGURE_COMMAND ""
48 BUILD_COMMAND ""
49 INSTALL_COMMAND ${CMAKE_COMMAND}
50 -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
51 -DPROJECT_SOURCE_DIR=<SOURCE_DIR>
52 -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
53 -DADDONS_TO_BUILD=${ADDONS_TO_BUILD}
54 -P ${PROJECT_SOURCE_DIR}/Bootstrap.cmake
55 )
56endfunction()
57
58# look for all addons repository definitions
59set(REPOSITORY_TO_BUILD_FOUND OFF)
60file(GLOB repos repositories/*.txt)
61foreach(repo ${repos})
62 file(STRINGS ${repo} repo_definition)
63 string(REPLACE " " ";" repo_definition ${repo_definition})
64 list(GET repo_definition 0 repo_id)
65
66 list(FIND REPOSITORY_TO_BUILD ${repo_id} idx)
67 if(idx GREATER -1 OR REPOSITORY_TO_BUILD STREQUAL "all")
68 set(REPOSITORY_TO_BUILD_FOUND ON)
69
70 # get the URL of the repository
71 list(GET repo_definition 1 repo_url)
72
73 # get the revision of the repository if not provided as an argument
74 if(NOT REPOSITORY_REVISION)
75 list(GET repo_definition 2 repo_revision)
76 else()
77 set(repo_revision "${REPOSITORY_REVISION}")
78 endif()
79
80 bootstrap_repo(${repo_id} ${repo_url} ${repo_revision})
81 endif()
82endforeach()
83
84# if we have been asked to bootstrap a specific repository (not the default one) and
85# it couldn't be found in the predefined repository definitions we assume that it's a
86# URL to a specific repository
87if(NOT REPOSITORY_TO_BUILD_DEFAULT AND NOT REPOSITORY_TO_BUILD_FOUND)
88 # default to the master branch if no revision has been provided
89 if(NOT REPOSITORY_REVISION)
90 set(REPOSITORY_REVISION "master")
91 endif()
92
93 bootstrap_repo(binary-addons-custom ${REPOSITORY_TO_BUILD} ${REPOSITORY_REVISION})
94endif()