aboutsummaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authorSascha Montellese <sascha.montellese@gmail.com>2015-10-21 13:41:13 +0200
committerSascha Montellese <sascha.montellese@gmail.com>2015-10-21 13:41:13 +0200
commit9a49e02ca53411afa31a2478d6447c84c0fbba2f (patch)
treea050a0a0296bfee2e37b32198a2d125136eab2b9 /project
parentf1463ee5a7a579d20c6a92bb20b1b86b2b18018d (diff)
parent0a49f48674b269e3bf2cef905d99bc6c332a79e9 (diff)
Merge pull request #8209 from Montellese/binary_addons_bootstrapping
[binary addons] improve bootstrap buildsystem to support arbitrary meta repositories
Diffstat (limited to 'project')
-rw-r--r--project/cmake/addons/bootstrap/CMakeLists.txt50
-rw-r--r--project/cmake/addons/depends/common/kodi-platform/deps.txt1
-rw-r--r--project/cmake/scripts/common/addon-helpers.cmake16
3 files changed, 49 insertions, 18 deletions
diff --git a/project/cmake/addons/bootstrap/CMakeLists.txt b/project/cmake/addons/bootstrap/CMakeLists.txt
index 738136b442..86950b810d 100644
--- a/project/cmake/addons/bootstrap/CMakeLists.txt
+++ b/project/cmake/addons/bootstrap/CMakeLists.txt
@@ -20,10 +20,12 @@ get_filename_component(BUILD_DIR "${BUILD_DIR}" ABSOLUTE)
# make sure that the repositories to build have been specified
if(NOT REPOSITORY_TO_BUILD)
+ set(REPOSITORY_TO_BUILD_DEFAULT ON)
set(REPOSITORY_TO_BUILD "all")
set(REPOSITORY_REVISION "")
message(STATUS "Bootstrapping all repositories")
else()
+ set(REPOSITORY_TO_BUILD_DEFAULT OFF)
message(STATUS "Bootstrapping following repository: ${REPOSITORY_TO_BUILD}")
endif()
@@ -37,7 +39,25 @@ endif()
include(ExternalProject)
+function(bootstrap_repo repo_id repo_url repo_revision)
+ message(STATUS "Bootstrapping addons from ${repo_id} (${repo_url} ${repo_revision})...")
+ externalproject_add(${repo_id}
+ GIT_REPOSITORY ${repo_url}
+ GIT_TAG ${repo_revision}
+ PREFIX ${BUILD_DIR}/${repo_id}
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ${CMAKE_COMMAND}
+ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
+ -DPROJECT_SOURCE_DIR=<SOURCE_DIR>
+ -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
+ -DADDONS_TO_BUILD=${ADDONS_TO_BUILD}
+ -P ${PROJECT_SOURCE_DIR}/bootstrap.cmake
+ )
+endfunction()
+
# look for all addons repository definitions
+set(REPOSITORY_TO_BUILD_FOUND OFF)
file(GLOB repos repositories/*.txt)
foreach(repo ${repos})
file(STRINGS ${repo} repo_definition)
@@ -46,6 +66,8 @@ foreach(repo ${repos})
list(FIND REPOSITORY_TO_BUILD ${repo_id} idx)
if(idx GREATER -1 OR REPOSITORY_TO_BUILD STREQUAL "all")
+ set(REPOSITORY_TO_BUILD_FOUND ON)
+
# get the URL of the repository
list(GET repo_definition 1 repo_url)
@@ -56,20 +78,18 @@ foreach(repo ${repos})
set(repo_revision "${REPOSITORY_REVISION}")
endif()
- message(STATUS "Bootstrapping addons from ${repo_id} (${repo_url} ${repo_revision})...")
- externalproject_add(${repo_id}
- GIT_REPOSITORY ${repo_url}
- GIT_TAG ${repo_revision}
- PREFIX ${BUILD_DIR}/${repo_id}
- CONFIGURE_COMMAND ""
- BUILD_COMMAND ""
- INSTALL_COMMAND ${CMAKE_COMMAND}
- -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
- -DPROJECT_SOURCE_DIR=<SOURCE_DIR>
- -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
- -DADDONS_TO_BUILD=${ADDONS_TO_BUILD}
- -P ${PROJECT_SOURCE_DIR}/bootstrap.cmake
- )
-
+ bootstrap_repo(${repo_id} ${repo_url} ${repo_revision})
endif()
endforeach()
+
+# if we have been asked to bootstrap a specific repository (not the default one) and
+# it couldn't be found in the predefined repository definitions we assume that it's a
+# URL to a specific repository
+if(NOT REPOSITORY_TO_BUILD_DEFAULT AND NOT REPOSITORY_TO_BUILD_FOUND)
+ # default to the master branch if no revision has been provided
+ if(NOT REPOSITORY_REVISION)
+ set(REPOSITORY_REVISION "master")
+ endif()
+
+ bootstrap_repo(binary-addons-custom ${REPOSITORY_TO_BUILD} ${REPOSITORY_REVISION})
+endif()
diff --git a/project/cmake/addons/depends/common/kodi-platform/deps.txt b/project/cmake/addons/depends/common/kodi-platform/deps.txt
index 828f05a6b0..36e3ff0158 100644
--- a/project/cmake/addons/depends/common/kodi-platform/deps.txt
+++ b/project/cmake/addons/depends/common/kodi-platform/deps.txt
@@ -1,3 +1,2 @@
-kodi
tinyxml
platform
diff --git a/project/cmake/scripts/common/addon-helpers.cmake b/project/cmake/scripts/common/addon-helpers.cmake
index a02836a983..c3f52e1235 100644
--- a/project/cmake/scripts/common/addon-helpers.cmake
+++ b/project/cmake/scripts/common/addon-helpers.cmake
@@ -15,9 +15,8 @@ macro(add_cpack_workaround target version ext)
endif()
add_custom_command(TARGET addon-package PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E rename ${CMAKE_BINARY_DIR}/addon-${target}-${version}.${ext} ${CMAKE_BINARY_DIR}/${target}-${version}.${ext}
COMMAND ${CMAKE_COMMAND} -E make_directory ${PACKAGE_DIR}
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/${target}-${version}.${ext} ${PACKAGE_DIR})
+ COMMAND ${CMAKE_COMMAND} -E copy ${CPACK_PACKAGE_DIRECTORY}/addon-${target}-${version}.${ext} ${PACKAGE_DIR}/${target}-${version}.${ext})
endmacro()
# Grab the version from a given add-on's addon.xml
@@ -83,6 +82,19 @@ macro (build_addon target prefix libs)
# Pack files together to create an archive
INSTALL(DIRECTORY ${target} DESTINATION ./ COMPONENT ${target}-${${prefix}_VERSION} PATTERN "addon.xml.in" EXCLUDE)
IF(WIN32)
+ if(NOT CPACK_PACKAGE_DIRECTORY)
+ # determine the temporary path
+ file(TO_CMAKE_PATH "$ENV{TEMP}" WIN32_TEMP_PATH)
+ string(LENGTH "${WIN32_TEMP_PATH}" WIN32_TEMP_PATH_LENGTH)
+ string(LENGTH "${PROJECT_BINARY_DIR}" PROJECT_BINARY_DIR_LENGTH)
+
+ # check if the temporary path is shorter than the default packaging directory path
+ if(WIN32_TEMP_PATH_LENGTH GREATER 0 AND WIN32_TEMP_PATH_LENGTH LESS PROJECT_BINARY_DIR_LENGTH)
+ # set the directory used by CPack for packaging to the temp directory
+ set(CPACK_PACKAGE_DIRECTORY ${WIN32_TEMP_PATH})
+ endif()
+ endif()
+
# in case of a VC++ project the installation location contains a $(Configuration) VS variable
# we replace it with ${CMAKE_BUILD_TYPE} (which doesn't cover the case when the build configuration
# is changed within Visual Studio)