From f44ecaa4f27e7538ddcad66d40e543bffa2d2d86 Mon Sep 17 00:00:00 2001 From: manuel Date: Sun, 4 Jun 2017 16:57:49 +0200 Subject: sync with upstream --- cmake/addons/depends/windows/CMakeLists.txt | 52 ++++++++++++++++++++++ cmake/addons/depends/windows/Install.cmake | 24 ++++++++++ cmake/addons/depends/windows/README | 19 ++++++++ .../depends/windows/cmake/mingw/CMakeLists.txt | 37 +++++++++++++++ .../windows/cmake/mingw/MinGWConfig.cmake.in | 3 ++ .../windows/cmake/mingw/Toolchain_mingw32.cmake.in | 17 +++++++ cmake/addons/depends/windows/cmake/mingw/mingw.txt | 1 + .../depends/windows/cmake/mingw/mingw32-cmd.bat.in | 6 +++ .../depends/windows/cmake/mingw/noinstall.txt | 0 .../depends/windows/cmake/msys/CMakeLists.txt | 5 +++ cmake/addons/depends/windows/cmake/msys/msys.txt | 1 + .../depends/windows/cmake/msys/noinstall.txt | 0 cmake/addons/depends/windows/prebuilt/README | 21 +++++++++ 13 files changed, 186 insertions(+) create mode 100644 cmake/addons/depends/windows/CMakeLists.txt create mode 100644 cmake/addons/depends/windows/Install.cmake create mode 100644 cmake/addons/depends/windows/README create mode 100644 cmake/addons/depends/windows/cmake/mingw/CMakeLists.txt create mode 100644 cmake/addons/depends/windows/cmake/mingw/MinGWConfig.cmake.in create mode 100644 cmake/addons/depends/windows/cmake/mingw/Toolchain_mingw32.cmake.in create mode 100644 cmake/addons/depends/windows/cmake/mingw/mingw.txt create mode 100644 cmake/addons/depends/windows/cmake/mingw/mingw32-cmd.bat.in create mode 100644 cmake/addons/depends/windows/cmake/mingw/noinstall.txt create mode 100644 cmake/addons/depends/windows/cmake/msys/CMakeLists.txt create mode 100644 cmake/addons/depends/windows/cmake/msys/msys.txt create mode 100644 cmake/addons/depends/windows/cmake/msys/noinstall.txt create mode 100644 cmake/addons/depends/windows/prebuilt/README (limited to 'cmake/addons/depends/windows') diff --git a/cmake/addons/depends/windows/CMakeLists.txt b/cmake/addons/depends/windows/CMakeLists.txt new file mode 100644 index 0000000..c8739c0 --- /dev/null +++ b/cmake/addons/depends/windows/CMakeLists.txt @@ -0,0 +1,52 @@ +cmake_minimum_required(VERSION 3.1) +project(kodi-addons-depends-windows) + +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() + +include(ExternalProject) + +if(NOT ADDON_DEPENDS_PATH) + message(FATAL_ERROR "ADDON_DEPENDS_PATH (${ADDON_DEPENDS_PATH}) is not a valid target directory.") +else() + file(TO_CMAKE_PATH "${ADDON_DEPENDS_PATH}" ADDON_DEPENDS_PATH) +endif() +get_filename_component(ADDON_DEPENDS_PATH "${ADDON_DEPENDS_PATH}" ABSOLUTE) +list(APPEND CMAKE_PREFIX_PATH ${ADDON_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=${ADDON_DEPENDS_PATH} + -P ${PROJECT_SOURCE_DIR}/Install.cmake + ) +endfunction() + +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} DIRECTORY) + string(REPLACE " " ";" def ${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/cmake/addons/depends/windows/Install.cmake b/cmake/addons/depends/windows/Install.cmake new file mode 100644 index 0000000..9a3adbb --- /dev/null +++ b/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/cmake/addons/depends/windows/README b/cmake/addons/depends/windows/README new file mode 100644 index 0000000..67dc594 --- /dev/null +++ b/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/cmake/addons/depends/windows/cmake/mingw/CMakeLists.txt b/cmake/addons/depends/windows/cmake/mingw/CMakeLists.txt new file mode 100644 index 0000000..02d9724 --- /dev/null +++ b/cmake/addons/depends/windows/cmake/mingw/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.1) +project(mingw) + +function(generate_mingw32_wrapper cmd) + set(CMD ${cmd}) + configure_file(${PROJECT_SOURCE_DIR}/mingw32-cmd.bat.in ${MINGW_PATH}/bin/${CMD}.bat @ONLY) +endfunction() + +get_filename_component(CORE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../../.. REALPATH) + +set(MSYS_PATH "${CORE_SOURCE_DIR}/project/BuildDependencies/msys64") +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(MINGW_PATH "${MSYS_PATH}/mingw32") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(MINGW_PATH "${MSYS_PATH}/mingw64") +endif() + +# configure the MinGW toolchain file +configure_file(${PROJECT_SOURCE_DIR}/Toolchain_mingw32.cmake.in ${CMAKE_INSTALL_PREFIX}/Toolchain_mingw32.cmake @ONLY) + +# configure MinGWConfig.cmake +configure_file(${PROJECT_SOURCE_DIR}/MinGWConfig.cmake.in ${CMAKE_INSTALL_PREFIX}/MinGWConfig.cmake) + +# TODO: MinGW GCC 5.3.0-1 comes without cc.exe, Remove this once package is bumped to 5.3.0-p2 +# See https://github.com/Alexpux/MINGW-packages/pull/1034 +if(NOT EXISTS ${MINGW_PATH}/bin/cc.exe) + execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${MINGW_PATH}/bin/gcc.exe ${MINGW_PATH}/bin/cc.exe) +endif() + +# configure the MinGW wrapper batch scripts +generate_mingw32_wrapper("make") +generate_mingw32_wrapper("gcc") +generate_mingw32_wrapper("cc") +generate_mingw32_wrapper("g++") +generate_mingw32_wrapper("ar") +generate_mingw32_wrapper("ld") +generate_mingw32_wrapper("windres") diff --git a/cmake/addons/depends/windows/cmake/mingw/MinGWConfig.cmake.in b/cmake/addons/depends/windows/cmake/mingw/MinGWConfig.cmake.in new file mode 100644 index 0000000..2d6baa7 --- /dev/null +++ b/cmake/addons/depends/windows/cmake/mingw/MinGWConfig.cmake.in @@ -0,0 +1,3 @@ +set(MINGW_INCLUDE_DIRS @MINGW_PATH@/include) +set(MINGW_MAKE @MINGW_PATH@/bin/make.bat -j$ENV{NUMBER_OF_PROCESSORS}) +set(MINGW_FOUND 1) diff --git a/cmake/addons/depends/windows/cmake/mingw/Toolchain_mingw32.cmake.in b/cmake/addons/depends/windows/cmake/mingw/Toolchain_mingw32.cmake.in new file mode 100644 index 0000000..01d281d --- /dev/null +++ b/cmake/addons/depends/windows/cmake/mingw/Toolchain_mingw32.cmake.in @@ -0,0 +1,17 @@ +set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_SYSTEM_NAME Windows) + +set(CMAKE_FIND_ROOT_PATH @CMAKE_FIND_ROOT_PATH@ @CMAKE_INSTALL_PREFIX@ @MSYS_PATH@ @MINGW_PATH@) + +# specify the cross compiler +set(CMAKE_C_COMPILER @MINGW_PATH@/bin/gcc.bat) +set(CMAKE_CXX_COMPILER @MINGW_PATH@/bin/g++.bat) +set(CMAKE_AR @MINGW_PATH@/bin/ar.bat CACHE FILEPATH "Archiver") +set(CMAKE_LINKER @MINGW_PATH@/bin/ld.bat CACHE FILEPATH "Linker") +SET(CMAKE_RC_COMPILER @MINGW_PATH@/bin/windres.bat) + +# search for programs in the build host directories +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +# for libraries and headers in the target directories +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/cmake/addons/depends/windows/cmake/mingw/mingw.txt b/cmake/addons/depends/windows/cmake/mingw/mingw.txt new file mode 100644 index 0000000..90aa6ae --- /dev/null +++ b/cmake/addons/depends/windows/cmake/mingw/mingw.txt @@ -0,0 +1 @@ +mingw diff --git a/cmake/addons/depends/windows/cmake/mingw/mingw32-cmd.bat.in b/cmake/addons/depends/windows/cmake/mingw/mingw32-cmd.bat.in new file mode 100644 index 0000000..44a0ea2 --- /dev/null +++ b/cmake/addons/depends/windows/cmake/mingw/mingw32-cmd.bat.in @@ -0,0 +1,6 @@ +@ECHO OFF +SETLOCAL + +SET PATH=@MINGW_PATH@/bin;@MSYS_PATH@/usr/bin;%PATH% +@CMD@.exe %* + diff --git a/cmake/addons/depends/windows/cmake/mingw/noinstall.txt b/cmake/addons/depends/windows/cmake/mingw/noinstall.txt new file mode 100644 index 0000000..e69de29 diff --git a/cmake/addons/depends/windows/cmake/msys/CMakeLists.txt b/cmake/addons/depends/windows/cmake/msys/CMakeLists.txt new file mode 100644 index 0000000..1c0536e --- /dev/null +++ b/cmake/addons/depends/windows/cmake/msys/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.1) +project(msys LANGUAGES NONE) + +# This is an empty dummy dependency because a lot of game addons depend on it. +# After they got fixed, this can be removed. diff --git a/cmake/addons/depends/windows/cmake/msys/msys.txt b/cmake/addons/depends/windows/cmake/msys/msys.txt new file mode 100644 index 0000000..00de9c2 --- /dev/null +++ b/cmake/addons/depends/windows/cmake/msys/msys.txt @@ -0,0 +1 @@ +msys diff --git a/cmake/addons/depends/windows/cmake/msys/noinstall.txt b/cmake/addons/depends/windows/cmake/msys/noinstall.txt new file mode 100644 index 0000000..e69de29 diff --git a/cmake/addons/depends/windows/prebuilt/README b/cmake/addons/depends/windows/prebuilt/README new file mode 100644 index 0000000..a0c70d6 --- /dev/null +++ b/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