diff options
Diffstat (limited to 'project/cmake/addons/depends/windows/CMakeLists.txt')
| -rw-r--r-- | project/cmake/addons/depends/windows/CMakeLists.txt | 55 |
1 files changed, 55 insertions, 0 deletions
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 @@ | |||
| 1 | project(kodi-addons-depends-windows) | ||
| 2 | |||
| 3 | cmake_minimum_required(VERSION 2.8) | ||
| 4 | |||
| 5 | list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) | ||
| 6 | |||
| 7 | if(NOT CMAKE_BUILD_TYPE) | ||
| 8 | set(CMAKE_BUILD_TYPE Release) | ||
| 9 | endif() | ||
| 10 | |||
| 11 | include(ExternalProject) | ||
| 12 | |||
| 13 | if(NOT DEPENDS_PATH) | ||
| 14 | message(FATAL_ERROR "DEPENDS_PATH (${DEPENDS_PATH}) is not a valid target directory.") | ||
| 15 | else() | ||
| 16 | file(TO_CMAKE_PATH "${DEPENDS_PATH}" DEPENDS_PATH) | ||
| 17 | endif() | ||
| 18 | get_filename_component(DEPENDS_PATH "${DEPENDS_PATH}" ABSOLUTE) | ||
| 19 | list(APPEND CMAKE_PREFIX_PATH ${DEPENDS_PATH}) | ||
| 20 | |||
| 21 | if(NOT DEPENDS_TO_BUILD) | ||
| 22 | set(DEPENDS_TO_BUILD "all") | ||
| 23 | endif() | ||
| 24 | |||
| 25 | function(add_internal id url inputfile) | ||
| 26 | externalproject_add(${id} | ||
| 27 | URL ${url} | ||
| 28 | PREFIX build/${id} | ||
| 29 | CONFIGURE_COMMAND "" | ||
| 30 | BUILD_COMMAND "" | ||
| 31 | INSTALL_COMMAND ${CMAKE_COMMAND} | ||
| 32 | -DINPUTDIR=${PROJECT_BINARY_DIR}/build/${id}/src/${id} | ||
| 33 | -DINPUTFILE=${inputfile} | ||
| 34 | -DDESTDIR=${DEPENDS_PATH} | ||
| 35 | -P ${PROJECT_SOURCE_DIR}/install.cmake | ||
| 36 | ) | ||
| 37 | endfunction() | ||
| 38 | |||
| 39 | #find_package(7Zip REQUIRED) | ||
| 40 | |||
| 41 | file(GLOB_RECURSE download_input_files prebuilt/*.txt) | ||
| 42 | foreach(file ${download_input_files}) | ||
| 43 | if(NOT file MATCHES install.txt) | ||
| 44 | file(STRINGS ${file} def) | ||
| 45 | get_filename_component(dir ${file} PATH) | ||
| 46 | separate_arguments(def) | ||
| 47 | list(GET def 0 id) | ||
| 48 | |||
| 49 | list(FIND DEPENDS_TO_BUILD ${id} idx) | ||
| 50 | if(idx GREATER -1 OR DEPENDS_TO_BUILD STREQUAL "all") | ||
| 51 | list(GET def 1 url) | ||
| 52 | add_internal(${id} ${url} ${dir}/install.txt) | ||
| 53 | endif() | ||
| 54 | endif() | ||
| 55 | endforeach() | ||
