From ffca21f2743a7b367fa212799c6e2fea6190dd5d Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 3 Mar 2015 16:53:59 +0100 Subject: initial commit for kodi master --- .../cmake/addons/depends/windows/CMakeLists.txt | 55 ++++++++++++++++++++++ .../cmake/addons/depends/windows/Find7Zip.cmake | 7 +++ project/cmake/addons/depends/windows/README | 19 ++++++++ .../cmake/addons/depends/windows/extract-7z.cmake | 10 ++++ .../addons/depends/windows/extract-direct.cmake | 2 + project/cmake/addons/depends/windows/install.cmake | 24 ++++++++++ .../cmake/addons/depends/windows/prebuilt/README | 21 +++++++++ 7 files changed, 138 insertions(+) create mode 100644 project/cmake/addons/depends/windows/CMakeLists.txt create mode 100644 project/cmake/addons/depends/windows/Find7Zip.cmake create mode 100644 project/cmake/addons/depends/windows/README create mode 100644 project/cmake/addons/depends/windows/extract-7z.cmake create mode 100644 project/cmake/addons/depends/windows/extract-direct.cmake create mode 100644 project/cmake/addons/depends/windows/install.cmake create mode 100644 project/cmake/addons/depends/windows/prebuilt/README (limited to 'project/cmake/addons/depends/windows') 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 @@ +project(kodi-addons-depends-windows) + +cmake_minimum_required(VERSION 2.8) + +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() + +include(ExternalProject) + +if(NOT DEPENDS_PATH) + message(FATAL_ERROR "DEPENDS_PATH (${DEPENDS_PATH}) is not a valid target directory.") +else() + file(TO_CMAKE_PATH "${DEPENDS_PATH}" DEPENDS_PATH) +endif() +get_filename_component(DEPENDS_PATH "${DEPENDS_PATH}" ABSOLUTE) +list(APPEND CMAKE_PREFIX_PATH ${DEPENDS_PATH}) + +if(NOT DEPENDS_TO_BUILD) + set(DEPENDS_TO_BUILD "all") +endif() + +function(add_internal id url inputfile) + externalproject_add(${id} + URL ${url} + PREFIX build/${id} + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND ${CMAKE_COMMAND} + -DINPUTDIR=${PROJECT_BINARY_DIR}/build/${id}/src/${id} + -DINPUTFILE=${inputfile} + -DDESTDIR=${DEPENDS_PATH} + -P ${PROJECT_SOURCE_DIR}/install.cmake + ) +endfunction() + +#find_package(7Zip REQUIRED) + +file(GLOB_RECURSE download_input_files prebuilt/*.txt) +foreach(file ${download_input_files}) + if(NOT file MATCHES install.txt) + file(STRINGS ${file} def) + get_filename_component(dir ${file} PATH) + separate_arguments(def) + list(GET def 0 id) + + list(FIND DEPENDS_TO_BUILD ${id} idx) + if(idx GREATER -1 OR DEPENDS_TO_BUILD STREQUAL "all") + list(GET def 1 url) + add_internal(${id} ${url} ${dir}/install.txt) + endif() + endif() +endforeach() 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 @@ +find_program(7ZIP_EXECUTABLE NAMES 7z.exe + HINTS PATHS "c:/Program Files/7-Zip") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(7Zip DEFAULT_MSG 7ZIP_EXECUTABLE) + +mark_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 @@ +KODI WIN32 ADDON DEPENDENCIES +============================= +This directory contains the cmake-based buildsystem for dependencies (currently +only prebuilt) used by one or multiple addons. The buildsystem looks into the +"prebuilt" sub-directory, downloads all the specified dependencies, extracts +them and places them into the "depends" sub-directory. + +To trigger the cmake-based buildsystem the following command must be executed +with being the path to this directory (absolute or relative, allowing for +in-source and out-of-source builds). + + cmake [-G ] + +cmake supports multiple generators, see +http://www.cmake.org/cmake/help/v2.8.8/cmake.html#section_Generators for a list. +For win32 builds one of the "Visual Studio XX" or the "NMake Makefiles" +generators is preferred. For the "NMake Makefiles" generator to work the above +command must be called from an environment prepared for VC++ builds (see +http://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 @@ +get_filename_component(file ${URL} NAME) +file(DOWNLOAD ${URL} ${DEST}/${file}) +execute_process(COMMAND ${7ZIP_EXECUTABLE} -y x ${DEST}/${file} + WORKING_DIRECTORY ${DESTDIR}) +if(${file} MATCHES .tar) + string(REPLACE ".7z" "" tarball ${file}) + string(REPLACE ".lzma" "" tarball ${file}) + execute_process(COMMAND ${7ZIP_EXECUTABLE} -y x ${DESTDIR}/${tarball} + WORKING_DIRECTORY ${DESTDIR}) +endif() 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 @@ +get_filename_component(file ${URL} NAME) +file(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 @@ +if(EXISTS "${INPUTFILE}") + # if there's an input file we use it to determine which files to copy where + file(STRINGS ${INPUTFILE} FILES) + string(REPLACE "\n" ";" FILES "${FILES}") + foreach(file ${FILES}) + string(REPLACE " " ";" file "${file}") + list(GET file 0 dir) + list(GET file 1 dest) + list(LENGTH file deflength) + if(deflength GREATER 2) + list(GET file 2 copy) + endif() + file(GLOB files ${INPUTDIR}/${dir}) + foreach(instfile ${files}) + file(COPY ${instfile} DESTINATION ${DESTDIR}/${dest}) + if(copy) + file(COPY ${instfile} DESTINATION ${DESTDIR}/${copy}) + endif() + endforeach() + endforeach() +else() + # otherwise we assume that the content of the extracted archive is already well-formed and can just be copied + file(COPY ${INPUTDIR}/${dir} DESTINATION ${DESTDIR}) +endif() \ 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 @@ +KODI WIN32 PREBUILT ADDON DEPENDENCIES +====================================== +This directory contains a file or sub-directory for every prebuilt dependency +used by one of the addons being built. There are two different modes supported. +Both include a file named .txt which must follow the defined format + + +If the archive, which the points at, contains + * only the necessary files and in the proper directory structure (i.e. an + "include" and a "lib" directory) then the file must be put into this + directory and nothing else is needed. + * unnecessary files and/or does not follow the defined directory structure + (i.e. an "include" and a "lib" directory) then the file must be put into a + sub-directory named . Furthermore an additional file called + "install.txt" must be placed in that sub-directory. install.txt contains a + line for every path/directory/file with a destination where it must be copied + to. It must follow the defined format + [] + where must be an existing file, directory or a path containing + wildcards, and the optional must be existing + directories. -- cgit v1.2.3