robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
2c1e8f7e96
master
1# This is similar to the build recipes, but instead downloads a third party 2# binary and installs it under the DEPS_PREFIX. 3# The INSTALL_COMMAND is executed in the folder where downloaded files are 4# extracted and the ${DEPS_INSTALL_DIR} holds the path to the third-party 5# install root. 6function ( GetBinaryDep ) 7cmake_parse_arguments ( _gettool 8"" 9"TARGET" 10"INSTALL_COMMAND" 11${ ARGN }) 12 13string ( TOUPPER " ${ _gettool_TARGET } _URL" URL_VARNAME ) 14string ( TOUPPER " ${ _gettool_TARGET } _SHA256" HASH_VARNAME ) 15set ( URL ${ $ { URL_VARNAME }}) 16set ( HASH ${ $ { HASH_VARNAME }}) 17 18ExternalProject_Add ( $ { _gettool_TARGET } 19URL ${ URL } 20URL_HASH SHA256= ${ HASH } 21DOWNLOAD_DIR ${ DEPS_DOWNLOAD_DIR } 22CONFIGURE_COMMAND "" 23BUILD_IN_SOURCE 1 24BUILD_COMMAND "" 25INSTALL_COMMAND ${ CMAKE_COMMAND } -E make_directory ${ DEPS_BIN_DIR } 26COMMAND " ${ _gettool_INSTALL_COMMAND } " 27DOWNLOAD_NO_PROGRESS TRUE ) 28endfunction () 29 30# Download executable and move it to DEPS_BIN_DIR 31function ( GetExecutable ) 32cmake_parse_arguments ( ARG 33"" 34"TARGET" 35"" 36${ ARGN }) 37 38string ( TOUPPER " ${ ARG_TARGET } _URL" URL_VARNAME ) 39string ( TOUPPER " ${ ARG_TARGET } _SHA256" HASH_VARNAME ) 40set ( URL ${ $ { URL_VARNAME }}) 41set ( HASH ${ $ { HASH_VARNAME }}) 42 43ExternalProject_Add ( $ { ARG_TARGET } 44URL ${ URL } 45URL_HASH SHA256= ${ HASH } 46DOWNLOAD_DIR ${ DEPS_DOWNLOAD_DIR } 47DOWNLOAD_NO_EXTRACT TRUE 48CONFIGURE_COMMAND "" 49BUILD_COMMAND "" 50INSTALL_COMMAND ${ CMAKE_COMMAND } -E make_directory ${ DEPS_BIN_DIR } 51COMMAND ${ CMAKE_COMMAND } -E copy <DOWNLOADED_FILE> ${ DEPS_BIN_DIR } 52DOWNLOAD_NO_PROGRESS TRUE ) 53endfunction ()