aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSascha Montellese <sascha.montellese@gmail.com>2014-08-05 12:45:58 +0200
committerSascha Montellese <sascha.montellese@gmail.com>2014-08-05 12:45:58 +0200
commit4b91927d37095eefb0830fd9d0e3f4a88777d34d (patch)
treeca72914f1dd9fe4ff9ec7785cc84d32cf712d1e4
parent09f540ce61130d9faba90f7012ca3bcdc90ef8af (diff)
parente635c12e1fda930b54756bf50391de682137030e (diff)
Merge pull request #5125 from Montellese/binary_addons_plat
binary addons: add platforms.txt to be able to control on which platforms an addon can be built
-rw-r--r--project/cmake/addons/CMakeLists.txt69
-rw-r--r--project/cmake/addons/README9
-rw-r--r--project/cmake/addons/addons/audioencoder.flac/audioencoder.flac.txt (renamed from project/cmake/addons/addons/audioencoder.flac.txt)0
-rw-r--r--project/cmake/addons/addons/audioencoder.flac/platforms.txt1
-rw-r--r--project/cmake/addons/addons/audioencoder.lame/audioencoder.lame.txt (renamed from project/cmake/addons/addons/audioencoder.lame.txt)0
-rw-r--r--project/cmake/addons/addons/audioencoder.lame/platforms.txt1
-rw-r--r--project/cmake/addons/addons/audioencoder.vorbis/audioencoder.vorbis.txt (renamed from project/cmake/addons/addons/audioencoder.vorbis.txt)0
-rw-r--r--project/cmake/addons/addons/audioencoder.vorbis/platforms.txt1
-rw-r--r--project/cmake/addons/addons/audioencoder.wav/audioencoder.wav.txt (renamed from project/cmake/addons/addons/audioencoder.wav.txt)0
-rw-r--r--project/cmake/addons/addons/audioencoder.wav/platforms.txt1
-rw-r--r--project/cmake/addons/depends/CMakeLists.txt2
-rw-r--r--project/cmake/addons/depends/windows/CMakeLists.txt2
-rw-r--r--project/cmake/scripts/common/xbmc-addon-helpers.cmake4
13 files changed, 64 insertions, 26 deletions
diff --git a/project/cmake/addons/CMakeLists.txt b/project/cmake/addons/CMakeLists.txt
index e358855500..edabd879dc 100644
--- a/project/cmake/addons/CMakeLists.txt
+++ b/project/cmake/addons/CMakeLists.txt
@@ -8,6 +8,10 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
+if(NOT CORE_SYSTEM_NAME)
+ string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME)
+endif()
+
include(ExternalProject)
### setup all the necessary paths
@@ -78,27 +82,52 @@ endif()
### get and build all the binary addons
# look for all the addons to be built
-file(GLOB addons ${PROJECT_SOURCE_DIR}/addons/*.txt)
+file(GLOB_RECURSE addons ${PROJECT_SOURCE_DIR}/addons/*.txt)
foreach(addon ${addons})
- file(STRINGS ${addon} def)
- string(REPLACE " " ";" def ${def})
- list(GET def 0 id)
- list(GET def 1 url)
- list(GET def 2 revision)
-
- list(FIND ADDONS_TO_BUILD ${id} idx)
- if(idx GREATER -1 OR ADDONS_TO_BUILD STREQUAL "all")
- # make sure the output directory is clean
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/${id}")
- file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/${id}/")
+ if(NOT (addon MATCHES platforms.txt))
+ file(STRINGS ${addon} def)
+ separate_arguments(def)
+ list(GET def 0 id)
+
+ list(FIND ADDONS_TO_BUILD ${id} idx)
+ if(idx GREATER -1 OR ADDONS_TO_BUILD STREQUAL "all")
+ get_filename_component(dir ${addon} PATH)
+ set(platform_found FALSE)
+
+ # check if the addon has a platforms.txt
+ if(EXISTS ${dir}/platforms.txt)
+ # get all the specified platforms
+ file(STRINGS ${dir}/platforms.txt platforms)
+ separate_arguments(platforms)
+
+ # check if the addon should be built for the current platform
+ foreach(platform ${platforms})
+ if(${platform} STREQUAL "all" OR ${platform} STREQUAL ${CORE_SYSTEM_NAME})
+ set(platform_found TRUE)
+ endif()
+ endforeach()
+ else()
+ set(platform_found TRUE)
+ endif()
+
+ if (${platform_found})
+ # make sure the output directory is clean
+ if(EXISTS "${CMAKE_INSTALL_PREFIX}/${id}")
+ file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/${id}/")
+ endif()
+
+ # get the URL and revision of the addon
+ list(GET def 1 url)
+ list(GET def 2 revision)
+
+ # add the addon as an external project for automatic building
+ externalproject_add(${id}
+ GIT_REPOSITORY ${url}
+ GIT_TAG ${revision}
+ INSTALL_DIR "${CMAKE_INSTALL_PREFIX}"
+ CMAKE_ARGS ${BUILD_ARGS}
+ )
+ endif()
endif()
-
- # add the addon as an external project for automatic building
- externalproject_add(${id}
- GIT_REPOSITORY ${url}
- GIT_TAG ${revision}
- INSTALL_DIR "${CMAKE_INSTALL_PREFIX}"
- CMAKE_ARGS ${BUILD_ARGS}
- )
endif()
endforeach()
diff --git a/project/cmake/addons/README b/project/cmake/addons/README
index 11af701bae..2af5f0f826 100644
--- a/project/cmake/addons/README
+++ b/project/cmake/addons/README
@@ -1,8 +1,9 @@
XBMC ADDONS
===========
This directory contains the cmake-based buildsystem for addons. It looks into
-the "addons" sub-directory and parses all *.txt files. Each addon must have its
-own <addon-id>.txt file which must follow the defined format:
+the "addons" sub-directory and parses all *.txt files recursively. Each addon
+must have its own <addon-id>.txt file in a separate sub-directory which must
+follow the defined format:
<addon-id> <git-url> <git-revision>
where
* <addon-id> must be identical to the addon's ID as defined in the addon's
@@ -11,6 +12,10 @@ where
* <git-revision> must be a valid git tag/branch/commit in the addon's git
repository which will be used for the build.
+Reserved filenames (for additional information on how to build an addon)
+are:
+ * platforms.txt: list of platforms to build an addon for (or "all")
+
The buildsystem uses the following variables (which can be passed into it when
executing cmake with the -D<variable-name>=<value> option) to e.g. access
specific paths:
diff --git a/project/cmake/addons/addons/audioencoder.flac.txt b/project/cmake/addons/addons/audioencoder.flac/audioencoder.flac.txt
index 1f1468a7f7..1f1468a7f7 100644
--- a/project/cmake/addons/addons/audioencoder.flac.txt
+++ b/project/cmake/addons/addons/audioencoder.flac/audioencoder.flac.txt
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 0000000000..baa6044435
--- /dev/null
+++ b/project/cmake/addons/addons/audioencoder.flac/platforms.txt
@@ -0,0 +1 @@
+all \ No newline at end of file
diff --git a/project/cmake/addons/addons/audioencoder.lame.txt b/project/cmake/addons/addons/audioencoder.lame/audioencoder.lame.txt
index 70d5eb9ff0..70d5eb9ff0 100644
--- a/project/cmake/addons/addons/audioencoder.lame.txt
+++ b/project/cmake/addons/addons/audioencoder.lame/audioencoder.lame.txt
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 0000000000..baa6044435
--- /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.txt b/project/cmake/addons/addons/audioencoder.vorbis/audioencoder.vorbis.txt
index 731ca04d5f..731ca04d5f 100644
--- a/project/cmake/addons/addons/audioencoder.vorbis.txt
+++ b/project/cmake/addons/addons/audioencoder.vorbis/audioencoder.vorbis.txt
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 0000000000..baa6044435
--- /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.txt b/project/cmake/addons/addons/audioencoder.wav/audioencoder.wav.txt
index aef9bda109..aef9bda109 100644
--- a/project/cmake/addons/addons/audioencoder.wav.txt
+++ b/project/cmake/addons/addons/audioencoder.wav/audioencoder.wav.txt
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 0000000000..baa6044435
--- /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/depends/CMakeLists.txt b/project/cmake/addons/depends/CMakeLists.txt
index 54ab7d3399..5c4853497d 100644
--- a/project/cmake/addons/depends/CMakeLists.txt
+++ b/project/cmake/addons/depends/CMakeLists.txt
@@ -41,7 +41,7 @@ foreach(file ${cmake_input_files})
file MATCHES deps.txt))
message(STATUS "Processing ${file}")
file(STRINGS ${file} def)
- string(REPLACE " " ";" def ${def})
+ separate_arguments(def)
list(LENGTH def deflength)
get_filename_component(dir ${file} PATH)
diff --git a/project/cmake/addons/depends/windows/CMakeLists.txt b/project/cmake/addons/depends/windows/CMakeLists.txt
index de71975449..e99cf0a8d5 100644
--- a/project/cmake/addons/depends/windows/CMakeLists.txt
+++ b/project/cmake/addons/depends/windows/CMakeLists.txt
@@ -43,7 +43,7 @@ foreach(file ${download_input_files})
if(NOT file MATCHES install.txt)
file(STRINGS ${file} def)
get_filename_component(dir ${file} PATH)
- string(REPLACE " " ";" def ${def})
+ separate_arguments(def)
list(GET def 0 id)
list(FIND DEPENDS_TO_BUILD ${id} idx)
diff --git a/project/cmake/scripts/common/xbmc-addon-helpers.cmake b/project/cmake/scripts/common/xbmc-addon-helpers.cmake
index 130582afea..c882cfcd02 100644
--- a/project/cmake/scripts/common/xbmc-addon-helpers.cmake
+++ b/project/cmake/scripts/common/xbmc-addon-helpers.cmake
@@ -7,11 +7,11 @@
# http://public.kitware.com/Bug/view.php?id=8438
# Thus, we have to add an 'addon-package' target.
add_custom_target(addon-package
- COMMAND cmake --build ${CMAKE_BINARY_DIR} --target package)
+ COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target package)
macro(add_cpack_workaround target version ext)
add_custom_command(TARGET addon-package PRE_BUILD
- COMMAND cmake -E rename addon-${target}-${version}.${ext} ${target}-${version}.${ext})
+ COMMAND ${CMAKE_COMMAND} -E rename addon-${target}-${version}.${ext} ${target}-${version}.${ext})
endmacro()
# Grab the version from a given add-on's addon.xml