cmake: Add option to override download versions and hashes

Allows users to override the built-in download values with custom ones, in order to build with different versions of OBS or the depencencies used.
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2020-11-02 16:52:02 +01:00
parent f796c85527
commit 2eb59a58f8

View file

@ -70,21 +70,6 @@ set(PROJECT_DESCRIPTION "Better Production Quality, for free.")
set(PROJECT_AUTHORS "Michael Fabian 'Xaymar' Dirks <info@xaymar.com>")
set(PROJECT_COPYRIGHT_YEARS "2018 - 2020")
# Internal Configuration
set(OBS_DOWNLOAD_VERSION "26.0.2-ci")
if(WIN32)
set(OBS_DOWNLOAD_HASH_32 "SHA512=C8CABFAA59BDF5E4CD1C69CBC349F3E62FD6FE37A1A1A8BE4AC1B37BF087F597A313B2B004E019827C43A5951B50957B60578B7F2249383C117E634FD8714844")
set(OBS_DOWNLOAD_HASH_64 "SHA512=75E83548AD8FD994D45BE2395E97499BED8444C245857C811BA44D35BF3C49186B1187D3EF250F2618295D7AFA7D8ED5A66582BD140A01A46A77F6BC19BDDBE2")
set(OBS_DEPENDENCIES_VERSION "26.0.0")
set(OBS_DEPENDENCIES_HASH "SHA512=7545696B5B684E6BF57F11158FBDF7A0477C4C2CBB872070105A400E56ACD16A54934928BB917E8C952631667DB63953B56F8BACB9C52D36285EA3DD83B9F473")
set(OBS_QT_VERSION "5.10.1")
set(OBS_QT_HASH "SHA512=848B9AC00B06FCA1F1A85BD4EFEA4138D278E8EC96823C5C36CC988DDE5D27E2F91300B02F2F0E71F075CCB0D791D3C888CDA6A5048DDFE6F946A8697DFEF1E9")
elseif(UNIX AND NOT APPLE)
set(OBS_DOWNLOAD_HASH_32 "")
set(OBS_DOWNLOAD_HASH_64 "SHA512=EAB0450F4B3D9C6252C347CD138A4AB49725CF930A742FF6D1EAEADDEDE31627D1C0A45831FE26A19C0B278386A476736CAA170B351EF833E8A5E8DAD6BB57D2")
# Qt & Dependencies are system packages.
endif()
################################################################################
# Setup / Bootstrap
################################################################################
@ -257,6 +242,31 @@ set(${PREFIX}SIGN_ENABLED FALSE CACHE BOOL "Enable signing builds.")
set(${PREFIX}SIGN_KEY "" CACHE FILEPATH "Path to the private key with which to sign.")
set(${PREFIX}SIGN_PASSWORD "" CACHE STRING "Password for the private key.")
# Not-Native Components
if(NOT ${PREFIX}OBS_NATIVE)
set(${PREFIX}DOWNLOAD_OBS_VERSION "" CACHE STRING "(Optional) OBS Studio version to build against.")
set(${PREFIX}DOWNLOAD_OBS_HASH_32 "" CACHE STRING "")
set(${PREFIX}DOWNLOAD_OBS_HASH_64 "" CACHE STRING "")
mark_as_advanced(
${PREFIX}DOWNLOAD_OBS_VERSION
${PREFIX}DOWNLOAD_OBS_HASH_32
${PREFIX}DOWNLOAD_OBS_HASH_64
)
if(WIN32)
set(${PREFIX}DOWNLOAD_OBSDEPS_VERSION "" CACHE STRING "(Optional) OBS Studio dependencies version to build against.")
set(${PREFIX}DOWNLOAD_OBSDEPS_HASH "" CACHE STRING "")
set(${PREFIX}DOWNLOAD_QT_VERSION "" CACHE STRING "(Optional) Qt Version to build against.")
set(${PREFIX}DOWNLOAD_QT_HASH "" CACHE STRING "")
mark_as_advanced(
${PREFIX}DOWNLOAD_OBSDEPS_VERSION
${PREFIX}DOWNLOAD_OBSDEPS_HASH
${PREFIX}DOWNLOAD_QT_VERSION
${PREFIX}DOWNLOAD_QT_HASH
)
endif()
endif()
################################################################################
# CMake / Compiler Dependencies
################################################################################
@ -438,6 +448,43 @@ refresh_components()
# OBS (Always first)
if(NOT ${PREFIX}OBS_NATIVE)
if(NOT ${PREFIX}DOWNLOAD_OBS_VERSION STREQUAL "")
set(_DOWNLOAD_OBS_VERSION ${PREFIX}DOWNLOAD_OBS_VERSION)
set(_DOWNLOAD_OBS_HASH_32 ${PREFIX}DOWNLOAD_OBS_HASH_32)
set(_DOWNLOAD_OBS_HASH_64 ${PREFIX}DOWNLOAD_OBS_HASH_64)
else()
set(_DOWNLOAD_OBS_VERSION "26.0.2-ci")
if(D_PLATFORM_WINDOWS)
set(_DOWNLOAD_OBS_HASH_32 "SHA512=468A999ECC8C826683E208B8758FBAE2FD3C9C034A73A147F6BE0F40B6E0AF0B0C9A99DFCB8D3A856206A26FC45F5F0A3B1FF781949B3EF68B765FECEB5CEB55")
set(_DOWNLOAD_OBS_HASH_64 "SHA512=571B4196DF5CFBD3A8E113C97C7890000C490DDF1C6747529DE0F06063F928E7488095775919017104DE7A693CCF51A7A82BD04BCE62D6B3F0ED1F74A5F32B32")
elseif(D_PLATFORM_LINUX)
set(_DOWNLOAD_OBS_HASH_32 "")
set(_DOWNLOAD_OBS_HASH_64 "SHA512=62EAD42890CEF953806F5780ED37304D6BD110F65D3ED83A88ADA462B0A0E46E9DEE477A76D456C444102EBA4F9F9A9EAAA299DCFDB2872233E2B35F775CCD0D")
elseif(D_PLATFORM_MAC)
set(_DOWNLOAD_OBS_HASH_32 "")
set(_DOWNLOAD_OBS_HASH_64 "SHA512=2A7E312666FAABF539740DAD8E30788DEB5882BE8D2FF062848741FD6F8C2077FB237CFB399634BC9C3DE38CF78B3043B1EAE92D833CE6A8B32F5E1EB92D6618")
else()
message(FATAL_ERROR "No prebuilt packages available for this operating system.")
return()
endif()
endif()
if(WIN32)
if(NOT ${PREFIX}DOWNLOAD_OBSDEPS_VERSION STREQUAL "")
set(_DOWNLOAD_OBSDEPS_VERSION ${PREFIX}DOWNLOAD_OBSDEPS_VERSION)
set(_DOWNLOAD_OBSDEPS_HASH ${PREFIX}DOWNLOAD_OBSDEPS_HASH)
else()
set(_DOWNLOAD_OBSDEPS_VERSION "26.0.0")
set(_DOWNLOAD_OBSDEPS_HASH "SHA512=2D47E7579DE3FBD88C52BB62C2CA4D649BD958FBAE8E5B01EE263D7583B4D8EEEA8CE13C543BEF110FAC9142891C031973A1BC20AC6EED596E6AB97CCC669D16")
endif()
if(NOT ${PREFIX}DOWNLOAD_QT_VERSION STREQUAL "")
set(_DOWNLOAD_QT_VERSION ${PREFIX}DOWNLOAD_QT_VERSION)
set(_DOWNLOAD_QT_HASH ${PREFIX}DOWNLOAD_QT_HASH)
else()
set(_DOWNLOAD_QT_VERSION "5.10.1")
set(_DOWNLOAD_QT_HASH "SHA512=848B9AC00B06FCA1F1A85BD4EFEA4138D278E8EC96823C5C36CC988DDE5D27E2F91300B02F2F0E71F075CCB0D791D3C888CDA6A5048DDFE6F946A8697DFEF1E9")
endif()
endif()
if(D_PLATFORM_WINDOWS)
set(DLSUFFIX "windows${BITS}")
elseif(D_PLATFORM_LINUX)
@ -451,8 +498,8 @@ if(NOT ${PREFIX}OBS_NATIVE)
# Library
download_project(
PROJ libobs
URL https://github.com/Xaymar/obs-studio/releases/download/${OBS_DOWNLOAD_VERSION}/obs-studio-${ARCH}-0.0.0.0-${DLSUFFIX}.7z
URL_HASH "${OBS_DOWNLOAD_HASH_${ARCH}}"
URL "https://github.com/Xaymar/obs-studio/releases/download/${_DOWNLOAD_OBS_VERSION}/obs-studio-${ARCH}-0.0.0.0-${DLSUFFIX}.7z"
URL_HASH "${_DOWNLOAD_OBS_HASH_${BITS}}"
DOWNLOAD_NAME "libobs.7z"
DOWNLOAD_NO_PROGRESS OFF
UPDATE_DISCONNECTED OFF
@ -462,8 +509,8 @@ if(NOT ${PREFIX}OBS_NATIVE)
if(D_PLATFORM_WINDOWS)
download_project(
PROJ obsdeps
URL https://github.com/Xaymar/obs-studio/releases/download/${OBS_DEPENDENCIES_VERSION}/dependencies.7z
URL_HASH "${OBS_DEPENDENCIES_HASH}"
URL "https://github.com/Xaymar/obs-studio/releases/download/${_DOWNLOAD_OBSDEPS_VERSION}/dependencies.7z"
URL_HASH "${_DOWNLOAD_OBSDEPS_HASH}"
DOWNLOAD_NAME "obsdeps.7z"
DOWNLOAD_NO_PROGRESS OFF
UPDATE_DISCONNECTED OFF
@ -556,8 +603,8 @@ if(REQUIRE_QT)
if(WIN32 AND NOT ${PREFIX}OBS_NATIVE)
download_project(
PROJ qt
URL https://github.com/Xaymar/obs-studio/releases/download/${OBS_DEPENDENCIES_VERSION}/qt_${OBS_QT_VERSION}.7z
URL_HASH "${OBS_QT_HASH}"
URL "https://github.com/Xaymar/obs-studio/releases/download/${_DOWNLOAD_OBSDEPS_VERSION}/qt_${_DOWNLOAD_QT_VERSION}.7z"
URL_HASH "${_DOWNLOAD_QT_HASH}"
DOWNLOAD_NAME "qt.7z"
DOWNLOAD_NO_PROGRESS ON
UPDATE_DISCONNECTED ON