vcpkg/ports/qt5-base/cmake/qt_download_submodule.cmake

43 lines
1.7 KiB
CMake
Raw Normal View History

function(qt_get_submodule_name OUT_NAME)
string(REPLACE "5-" "" _tmp_name ${PORT})
set(${OUT_NAME} ${_tmp_name} PARENT_SCOPE)
endfunction()
function(qt_download_submodule)
cmake_parse_arguments(_csc "" "OUT_SOURCE_PATH" "PATCHES;BUILD_OPTIONS;BUILD_OPTIONS_RELEASE;BUILD_OPTIONS_DEBUG" ${ARGN})
2023-06-09 00:55:57 +08:00
if(NOT DEFINED _csc_OUT_SOURCE_PATH)
message(FATAL_ERROR "qt_download_module requires parameter OUT_SOURCE_PATH to be set! Please correct the portfile!")
endif()
2023-06-09 00:55:57 +08:00
vcpkg_buildpath_length_warning(37)
qt_get_submodule_name(NAME)
set(FULL_VERSION "${QT_MAJOR_MINOR_VER}.${QT_PATCH_VER}")
2022-03-08 03:27:29 +08:00
set(ARCHIVE_NAME "${NAME}-everywhere-opensource-src-${FULL_VERSION}.tar.xz")
2023-06-09 00:55:57 +08:00
set(URLS
"https://download.qt.io/archive/qt/${QT_MAJOR_MINOR_VER}/${FULL_VERSION}/submodules/${ARCHIVE_NAME}"
"https://mirrors.ocf.berkeley.edu/qt/archive/qt/${QT_MAJOR_MINOR_VER}/${FULL_VERSION}/submodules/${ARCHIVE_NAME}"
)
vcpkg_download_distfile(ARCHIVE_FILE
URLS ${URLS}
FILENAME ${ARCHIVE_NAME}
SHA512 ${QT_HASH_${PORT}}
)
2019-09-17 03:37:55 +08:00
if(QT_UPDATE_VERSION)
file(SHA512 "${ARCHIVE_FILE}" ARCHIVE_HASH)
message(STATUS "${PORT} new hash is ${ARCHIVE_HASH}")
file(APPEND "${VCPKG_ROOT_DIR}/ports/qt5-base/cmake/qt_new_hashes.cmake" "set(QT_HASH_${PORT} ${ARCHIVE_HASH})\n")
else()
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE "${ARCHIVE_FILE}"
REF ${FULL_VERSION}
PATCHES ${_csc_PATCHES}
)
endif()
2023-06-09 00:55:57 +08:00
set(${_csc_OUT_SOURCE_PATH} "${SOURCE_PATH}" PARENT_SCOPE)
endfunction()