diff options
author | fuzzard <fuzzard@kodi.tv> | 2022-01-27 10:17:30 +1000 |
---|---|---|
committer | fuzzard <fuzzard@kodi.tv> | 2022-03-02 08:50:24 +1000 |
commit | b5636ac814842895339edd1e0559af8fb4497007 (patch) | |
tree | c07968cb50ea39ae96481d902eb7c9bbd31c4e48 /cmake | |
parent | e86ffa2930bf287660961007c47be8736cc021db (diff) |
[cmake] introduce module download macro
Macro will factor out repetitive code for internal dependency builds
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/scripts/common/ModuleHelpers.cmake | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/cmake/scripts/common/ModuleHelpers.cmake b/cmake/scripts/common/ModuleHelpers.cmake index 03b623a0b7..560bb78430 100644 --- a/cmake/scripts/common/ModuleHelpers.cmake +++ b/cmake/scripts/common/ModuleHelpers.cmake @@ -39,6 +39,8 @@ function(get_archive_name module_name) set(${UPPER_MODULE_NAME}_VER ${${UPPER_MODULE_NAME}_VER} PARENT_SCOPE) if (${UPPER_MODULE_NAME}_BASE_URL) set(${UPPER_MODULE_NAME}_BASE_URL ${${UPPER_MODULE_NAME}_BASE_URL} PARENT_SCOPE) + else() + set(${UPPER_MODULE_NAME}_BASE_URL "http://mirrors.kodi.tv/build-deps/sources" PARENT_SCOPE) endif() if (${UPPER_MODULE_NAME}_HASH_SHA256) @@ -48,3 +50,20 @@ function(get_archive_name module_name) endif() endfunction() + +# Macro to factor out the repetitive URL setup +macro(SETUP_BUILD_VARS) + get_archive_name(${MODULE_LC}) + string(TOUPPER ${MODULE_LC} MODULE) + + # allow user to override the download URL with a local tarball + # needed for offline build envs + if(${MODULE}_URL) + get_filename_component(${MODULE}_URL "${${MODULE}_URL}" ABSOLUTE) + else() + set(${MODULE}_URL ${${MODULE}_BASE_URL}/${${MODULE}_ARCHIVE}) + endif() + if(VERBOSE) + message(STATUS "${MODULE}_URL: ${${MODULE}_URL}") + endif() +endmacro()
\ No newline at end of file |