2017-05-25 14:33:16 +08:00
## # vcpkg_find_acquire_program
##
## Download or find a well-known tool.
##
## ## Usage
## ```cmake
## vcpkg_find_acquire_program(<VAR>)
## ```
## ## Parameters
## ### VAR
## This variable specifies both the program to be acquired as well as the out parameter that will be set to the path of the program executable.
##
## ## Notes
## The current list of programs includes:
##
## - 7Z
2020-02-13 07:58:43 +08:00
## - ARIA2 (Downloader)
2017-05-25 14:33:16 +08:00
## - BISON
2020-02-13 07:58:43 +08:00
## - DARK
## - DOXYGEN
2017-05-25 14:33:16 +08:00
## - FLEX
2017-06-18 02:30:03 +08:00
## - GASPREPROCESSOR
2020-02-13 07:58:43 +08:00
## - GPERF
2017-05-25 14:33:16 +08:00
## - PERL
## - PYTHON2
## - PYTHON3
2020-03-06 06:23:05 +08:00
## - GIT
2020-05-12 05:58:12 +08:00
## - GN
2019-10-05 02:14:35 +08:00
## - GO
2017-05-25 14:33:16 +08:00
## - JOM
## - MESON
## - NASM
## - NINJA
2019-03-14 15:10:11 +08:00
## - NUGET
2020-02-13 07:58:43 +08:00
## - SCONS
2020-08-03 06:49:20 +08:00
## - SWIG
2017-05-25 14:33:16 +08:00
## - YASM
##
## Note that msys2 has a dedicated helper function: [`vcpkg_acquire_msys`](vcpkg_acquire_msys.md).
##
## ## Examples
##
## * [ffmpeg](https://github.com/Microsoft/vcpkg/blob/master/ports/ffmpeg/portfile.cmake)
## * [openssl](https://github.com/Microsoft/vcpkg/blob/master/ports/openssl/portfile.cmake)
## * [qt5](https://github.com/Microsoft/vcpkg/blob/master/ports/qt5/portfile.cmake)
2016-09-19 11:50:08 +08:00
function ( vcpkg_find_acquire_program VAR )
2017-10-12 23:22:50 +08:00
set ( EXPANDED_VAR ${ ${VAR } } )
if ( EXPANDED_VAR )
2016-09-19 11:50:08 +08:00
return ( )
endif ( )
unset ( NOEXTRACT )
2018-03-27 08:21:46 +08:00
unset ( _vfa_RENAME )
2017-02-04 00:16:13 +08:00
unset ( SUBDIR )
2017-02-10 01:13:52 +08:00
unset ( REQUIRED_INTERPRETER )
2019-08-21 03:13:26 +08:00
unset ( _vfa_SUPPORTED )
2019-07-03 04:47:50 +08:00
unset ( POST_INSTALL_COMMAND )
2016-09-19 11:50:08 +08:00
2017-02-15 09:29:47 +08:00
vcpkg_get_program_files_platform_bitness ( PROGRAM_FILES_PLATFORM_BITNESS )
2020-07-07 03:42:35 +08:00
set ( PROGRAM_FILES_32_BIT $ENV{ ProgramFiles\(X86\) } )
if ( NOT DEFINED PROGRAM_FILES_32_BIT )
set ( PROGRAM_FILES_32_BIT $ENV{ PROGRAMFILES } )
endif ( )
2017-02-15 09:29:47 +08:00
2016-09-19 11:50:08 +08:00
if ( VAR MATCHES "PERL" )
2017-08-03 05:36:02 +08:00
set ( PROGNAME perl )
set ( PATHS ${ DOWNLOADS } /tools/perl/perl/bin )
2018-03-14 02:35:19 +08:00
set ( BREW_PACKAGE_NAME "perl" )
set ( APT_PACKAGE_NAME "perl" )
2020-06-19 06:42:20 +08:00
set ( URL
" h t t p s : / / s t r a w b e r r y . p e r l . b o t / d o w n l o a d / 5 . 3 0 . 0 . 1 / s t r a w b e r r y - p e r l - 5 . 3 0 . 0 . 1 - 3 2 b i t . z i p "
" h t t p : / / s t r a w b e r r y p e r l . c o m / d o w n l o a d / 5 . 3 0 . 0 . 1 / s t r a w b e r r y - p e r l - 5 . 3 0 . 0 . 1 - 3 2 b i t . z i p "
)
2019-07-02 04:31:17 +08:00
set ( ARCHIVE "strawberry-perl-5.30.0.1-32bit.zip" )
set ( HASH d353d3dc743ebdc6d1e9f6f2b7a6db3c387c1ce6c890bae8adc8ae5deae8404f4c5e3cf249d1e151e7256d4c5ee9cd317e6c41f3b6f244340de18a24b938e0c4 )
2016-09-19 11:50:08 +08:00
elseif ( VAR MATCHES "NASM" )
set ( PROGNAME nasm )
2019-07-10 14:17:17 +08:00
set ( PATHS ${ DOWNLOADS } /tools/nasm/nasm-2.14.02 )
2018-03-14 02:35:19 +08:00
set ( BREW_PACKAGE_NAME "nasm" )
set ( APT_PACKAGE_NAME "nasm" )
2019-07-10 14:17:17 +08:00
set ( URL
" h t t p : / / w w w . n a s m . u s / p u b / n a s m / r e l e a s e b u i l d s / 2 . 1 4 . 0 2 / w i n 3 2 / n a s m - 2 . 1 4 . 0 2 - w i n 3 2 . z i p "
" h t t p : / / f o s s i e s . o r g / w i n d o w s / m i s c / n a s m - 2 . 1 4 . 0 2 - w i n 3 2 . z i p "
)
set ( ARCHIVE "nasm-2.14.02-win32.zip" )
set ( HASH a0f16a9f3b668b086e3c4e23a33ff725998e120f2e3ccac8c28293fd4faeae6fc59398919e1b89eed7461685d2730de02f2eb83e321f73609f35bf6b17a23d1e )
2016-09-19 11:50:08 +08:00
elseif ( VAR MATCHES "YASM" )
set ( PROGNAME yasm )
2018-03-27 08:21:46 +08:00
set ( SUBDIR 1.3.0.6 )
set ( PATHS ${ DOWNLOADS } /tools/yasm/ ${ SUBDIR } )
2019-12-07 08:01:12 +08:00
set ( BREW_PACKAGE_NAME "yasm" )
set ( APT_PACKAGE_NAME "yasm" )
2018-03-27 08:21:46 +08:00
set ( URL "https://www.tortall.net/projects/yasm/snapshots/v1.3.0.6.g1962/yasm-1.3.0.6.g1962.exe" )
set ( ARCHIVE "yasm-1.3.0.6.g1962.exe" )
set ( _vfa_RENAME "yasm.exe" )
2016-09-19 11:50:08 +08:00
set ( NOEXTRACT ON )
2018-03-27 08:21:46 +08:00
set ( HASH c1945669d983b632a10c5ff31e86d6ecbff143c3d8b2c433c0d3d18f84356d2b351f71ac05fd44e5403651b00c31db0d14615d7f9a6ecce5750438d37105c55b )
2020-03-06 06:23:05 +08:00
elseif ( VAR MATCHES "GIT" )
set ( PROGNAME git )
if ( CMAKE_HOST_WIN32 )
2020-04-24 04:47:47 +08:00
set ( SUBDIR "git-2.26.2-1-windows" )
set ( URL "https://github.com/git-for-windows/git/releases/download/v2.26.2.windows.1/PortableGit-2.26.2-32-bit.7z.exe" )
set ( ARCHIVE "PortableGit-2.26.2-32-bit.7z.exe" )
set ( HASH d3cb60d62ca7b5d05ab7fbed0fa7567bec951984568a6c1646842a798c4aaff74bf534cf79414a6275c1927081a11b541d09931c017bf304579746e24fe57b36 )
2020-07-28 08:43:23 +08:00
set ( PATHS
2020-03-06 06:23:05 +08:00
" $ { D O W N L O A D S } / t o o l s / $ { S U B D I R } / m i n g w 3 2 / b i n "
" $ { D O W N L O A D S } / t o o l s / g i t / $ { S U B D I R } / m i n g w 3 2 / b i n " )
else ( )
set ( BREW_PACKAGE_NAME "git" )
set ( APT_PACKAGE_NAME "git" )
endif ( )
2020-05-12 05:58:12 +08:00
elseif ( VAR MATCHES "GN" )
set ( PROGNAME gn )
set ( _vfa_RENAME "gn" )
set ( CIPD_DOWNLOAD_GN "https://chrome-infra-packages.appspot.com/dl/gn/gn" )
if ( CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" )
set ( _vfa_SUPPORTED ON )
set ( GN_VERSION "xus7xtaPhpv5vCmKFOnsBVoB-PKmhZvRsSTjbQAuF0MC" )
set ( GN_PLATFORM "linux-amd64" )
set ( HASH "871e75d7f3597b74fb99e36bb41fe5a9f8ce8a4d9f167f4729fc6e444807a59f35ec8aca70c2274a99c79d70a1108272be1ad991678a8ceb39e30f77abb13135" )
elseif ( CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" )
set ( _vfa_SUPPORTED ON )
set ( GN_VERSION "qhxILDNcJ2H44HfHmfiU-XIY3E_SIXvFqLd2wvbIgOoC" )
set ( GN_PLATFORM "mac-amd64" )
set ( HASH "03ee64cb15bae7fceb412900d470601090bce147cfd45eb9b46683ac1a5dca848465a5d74c55a47df7f0e334d708151249a6d37bb021de74dd48b97ed4a07937" )
else ( )
set ( GN_VERSION "qUkAhy9J0P7c5racy-9wB6AHNK_btS18im8S06_ehhwC" )
set ( GN_PLATFORM "windows-amd64" )
set ( HASH "263e02bd79eee0cb7b664831b7898565c5656a046328d8f187ef7ae2a4d766991d477b190c9b425fcc960ab76f381cd3e396afb85cba7408ca9e74eb32c175db" )
endif ( )
set ( SUBDIR "${GN_VERSION}" )
set ( PATHS "${DOWNLOADS}/tools/gn/${SUBDIR}" )
set ( URL "${CIPD_DOWNLOAD_GN}/${GN_PLATFORM}/+/${GN_VERSION}" )
set ( ARCHIVE "gn-${GN_PLATFORM}.zip" )
2019-10-05 02:14:35 +08:00
elseif ( VAR MATCHES "GO" )
set ( PROGNAME go )
set ( PATHS ${ DOWNLOADS } /tools/go/go/bin )
set ( BREW_PACKAGE_NAME "go" )
set ( APT_PACKAGE_NAME "golang-go" )
set ( URL "https://dl.google.com/go/go1.13.1.windows-386.zip" )
set ( ARCHIVE "go1.13.1.windows-386.zip" )
set ( HASH 2ab0f07e876ad98d592351a8808c2de42351ab387217e088bc4c5fa51d6a835694c501e2350802323b55a27dc0157f8b70045597f789f9e50f5ceae50dea3027 )
2016-11-02 07:19:05 +08:00
elseif ( VAR MATCHES "PYTHON3" )
2018-11-27 08:52:11 +08:00
if ( CMAKE_HOST_WIN32 )
set ( PROGNAME python )
2020-02-05 03:32:03 +08:00
if ( VCPKG_TARGET_ARCHITECTURE STREQUAL x86 )
2020-06-12 13:23:26 +08:00
set ( SUBDIR "python-3.8.3-x86" )
set ( URL "https://www.python.org/ftp/python/3.8.3/python-3.8.3-embed-win32.zip" )
set ( ARCHIVE "python-3.8.3-embed-win32.zip" )
set ( HASH 8c9078f55b1b5d694e0e809eee6ccf8a6e15810dd4649e8ae1209bff30e102d49546ce970a5d519349ca7759d93146f459c316dc440737171f018600255dcd0a )
2020-02-05 03:32:03 +08:00
else ( )
2020-06-12 13:23:26 +08:00
set ( SUBDIR "python-3.8.3-x64" )
set ( URL "https://www.python.org/ftp/python/3.8.3/python-3.8.3-embed-amd64.zip" )
set ( ARCHIVE "python-3.8.3-embed-amd64.zip" )
set ( HASH a322fc925167edb1897764297cf47e294ad3f52c109a05f8911412807eb83e104f780e9fe783b17fe0d9b18b7838797c15e9b0805dab759829f77a9bc0159424 )
2020-02-05 03:32:03 +08:00
endif ( )
2018-11-27 08:52:11 +08:00
set ( PATHS ${ DOWNLOADS } /tools/python/ ${ SUBDIR } )
2020-06-12 13:23:26 +08:00
set ( POST_INSTALL_COMMAND ${ CMAKE_COMMAND } -E remove python38._pth )
2018-11-27 08:52:11 +08:00
else ( )
set ( PROGNAME python3 )
set ( BREW_PACKAGE_NAME "python" )
set ( APT_PACKAGE_NAME "python3" )
endif ( )
2016-11-29 09:17:28 +08:00
elseif ( VAR MATCHES "PYTHON2" )
2019-05-03 13:57:43 +08:00
if ( CMAKE_HOST_WIN32 )
set ( PROGNAME python )
2020-02-05 03:32:03 +08:00
if ( VCPKG_TARGET_ARCHITECTURE STREQUAL x86 )
set ( SUBDIR "python-2.7.16-x86" )
set ( URL "https://www.python.org/ftp/python/2.7.16/python-2.7.16.msi" )
set ( ARCHIVE "python-2.7.16.msi" )
set ( HASH c34a6fa2438682104dccb53650a2bdb79eac7996deff075201a0f71bb835d60d3ed866652a1931f15a29510fe8e1009ac04e423b285122d2e5747fefc4c10254 )
else ( )
set ( SUBDIR "python-2.7.16-x64" )
set ( URL "https://www.python.org/ftp/python/2.7.16/python-2.7.16.amd64.msi" )
set ( ARCHIVE "python-2.7.16.amd64.msi" )
set ( HASH 47c1518d1da939e3ba6722c54747778b93a44c525bcb358b253c23b2510374a49a43739c8d0454cedade858f54efa6319763ba33316fdc721305bc457efe4ffb )
endif ( )
2019-05-03 13:57:43 +08:00
set ( PATHS ${ DOWNLOADS } /tools/python/ ${ SUBDIR } )
else ( )
set ( PROGNAME python2 )
set ( BREW_PACKAGE_NAME "python2" )
set ( APT_PACKAGE_NAME "python" )
endif ( )
2017-05-29 15:05:52 +08:00
elseif ( VAR MATCHES "RUBY" )
set ( PROGNAME "ruby" )
2019-07-02 04:31:17 +08:00
set ( PATHS ${ DOWNLOADS } /tools/ruby/rubyinstaller-2.6.3-1-x86/bin )
set ( URL https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.3-1/rubyinstaller-2.6.3-1-x86.7z )
set ( ARCHIVE rubyinstaller-2.6.3-1-x86.7z )
set ( HASH 4322317dd02ce13527bf09d6e6a7787ca3814ea04337107d28af1ac360bd272504b32e20ed3ea84eb5b21dae7b23bfe5eb0e529b6b0aa21a1a2bbb0a542d7aec )
2016-10-25 17:56:02 +08:00
elseif ( VAR MATCHES "JOM" )
2016-10-25 09:39:50 +08:00
set ( PROGNAME jom )
2019-04-26 02:56:36 +08:00
set ( SUBDIR "jom-1.1.3" )
2017-02-23 19:29:25 +08:00
set ( PATHS ${ DOWNLOADS } /tools/jom/ ${ SUBDIR } )
2020-07-28 08:43:23 +08:00
set ( URL
" h t t p : / / d o w n l o a d . q t . i o / o f f i c i a l _ r e l e a s e s / j o m / j o m _ 1 _ 1 _ 3 . z i p "
2020-01-28 06:44:33 +08:00
" h t t p : / / m i r r o r s . o c f . b e r k e l e y . e d u / q t / o f f i c i a l _ r e l e a s e s / j o m / j o m _ 1 _ 1 _ 3 . z i p "
)
2019-04-26 02:56:36 +08:00
set ( ARCHIVE "jom_1_1_3.zip" )
set ( HASH 5b158ead86be4eb3a6780928d9163f8562372f30bde051d8c281d81027b766119a6e9241166b91de0aa6146836cea77e5121290e62e31b7a959407840fc57b33 )
2017-01-11 18:37:19 +08:00
elseif ( VAR MATCHES "7Z" )
set ( PROGNAME 7z )
2018-03-31 07:59:59 +08:00
set ( PATHS "${PROGRAM_FILES_PLATFORM_BITNESS}/7-Zip" "${PROGRAM_FILES_32_BIT}/7-Zip" "${DOWNLOADS}/tools/7z/Files/7-Zip" )
2019-07-02 04:31:17 +08:00
set ( URL "https://7-zip.org/a/7z1900.msi" )
set ( ARCHIVE "7z1900.msi" )
set ( HASH f73b04e2d9f29d4393fde572dcf3c3f0f6fa27e747e5df292294ab7536ae24c239bf917689d71eb10cc49f6b9a4ace26d7c122ee887d93cc935f268c404e9067 )
2017-02-04 00:16:13 +08:00
elseif ( VAR MATCHES "NINJA" )
set ( PROGNAME ninja )
2020-08-17 03:07:17 +08:00
set ( NINJA_VERSION 1.10.0 )
set ( SUBDIR "ninja-${NINJA_VERSION}" )
set ( _vfa_SUPPORTED ON )
2018-03-31 07:59:59 +08:00
if ( CMAKE_HOST_WIN32 )
2020-08-17 03:07:17 +08:00
set ( ARCHIVE "ninja-win-${NINJA_VERSION}.zip" )
2020-05-07 04:52:51 +08:00
set ( PATHS "${DOWNLOADS}/tools/${SUBDIR}-windows" )
list ( APPEND PATHS "${DOWNLOADS}/tools/ninja/${SUBDIR}" )
2020-08-17 03:07:17 +08:00
set ( URL "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-win.zip" )
set ( HASH a196e243c53daa1df9d287af658d6d38d6b830b614f2d5704e8c88ffc61f179a533ae71cdb6d0d383d1559d65dacccbaaab270fb2a33aa211e5dba42ff046f97 )
2018-04-25 07:04:14 +08:00
elseif ( CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" )
2020-08-17 03:07:17 +08:00
set ( ARCHIVE "ninja-mac-${NINJA_VERSION}.zip" )
set ( URL "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-mac.zip" )
2018-04-25 07:04:14 +08:00
set ( PATHS "${DOWNLOADS}/tools/${SUBDIR}-osx" )
2020-08-17 03:07:17 +08:00
set ( HASH 619a1924067a0b30fc5f8887f868d3ee5481838d2f0f158d031f7614a2a10b95a73d4a56b658d5d560283ebf809e2e536b968c6c01ff0108075c3f393f5780ba )
2019-01-08 08:03:35 +08:00
elseif ( CMAKE_HOST_SYSTEM_NAME STREQUAL "FreeBSD" )
set ( PATHS "${DOWNLOADS}/tools/${SUBDIR}-freebsd" )
2020-08-17 03:07:17 +08:00
set ( _vfa_SUPPORTED OFF )
2018-03-31 07:59:59 +08:00
else ( )
2020-08-17 03:07:17 +08:00
set ( ARCHIVE "ninja-linux-${NINJA_VERSION}.zip" )
set ( URL "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux.zip" )
2018-04-05 11:58:50 +08:00
set ( PATHS "${DOWNLOADS}/tools/${SUBDIR}-linux" )
2020-08-17 03:07:17 +08:00
set ( HASH ffb179ab8ea315167fcc99a8f13286e1363590185b18cf819cc73e09f2a7553790e9dc45fd1ccd0bd1d2dbf543aee3f6c0951cf9ce453a7168ffd2ac873cdd29 )
2018-03-31 07:59:59 +08:00
endif ( )
2020-08-17 03:07:17 +08:00
set ( VERSION_CMD --version )
2019-03-14 15:10:11 +08:00
elseif ( VAR MATCHES "NUGET" )
set ( PROGNAME nuget )
2020-07-01 05:02:26 +08:00
set ( SUBDIR "5.5.1" )
set ( PATHS "${DOWNLOADS}/tools/nuget/${SUBDIR}" )
2019-03-14 15:10:11 +08:00
set ( BREW_PACKAGE_NAME "nuget" )
2020-07-01 05:02:26 +08:00
set ( URL "https://dist.nuget.org/win-x86-commandline/v5.5.1/nuget.exe" )
set ( _vfa_RENAME "nuget.exe" )
set ( ARCHIVE "nuget.5.5.1.exe" )
2019-04-03 04:49:03 +08:00
set ( NOEXTRACT ON )
2020-07-01 05:02:26 +08:00
set ( HASH 22ea847d8017cd977664d0b13c889cfb13c89143212899a511be217345a4e243d4d8d4099700114a11d26a087e83eb1a3e2b03bdb5e0db48f10403184cd26619 )
2017-02-10 01:13:52 +08:00
elseif ( VAR MATCHES "MESON" )
2020-08-17 22:25:05 +08:00
set ( MESON_VERSION 0.55.1 )
set ( PROGNAME meson )
set ( REQUIRED_INTERPRETER PYTHON3 )
set ( APT_PACKAGE_NAME "meson" )
set ( BREW_PACKAGE_NAME "meson" )
set ( SCRIPTNAME meson meson.py )
set ( PATHS ${ DOWNLOADS } /tools/meson/meson- ${ MESON_VERSION } )
set ( URL "https://github.com/mesonbuild/meson/releases/download/${MESON_VERSION}/meson-${MESON_VERSION}.tar.gz" )
set ( ARCHIVE "meson-${MESON_VERSION}.tar.gz" )
set ( HASH 172b4de8c7474d709f172431b89bf2b2b1c2c38bc842039cccf6be075a45bd3509a1dab8512bc5b2ee025d65d8050d2f717dd15c1f9be17fca3b2e7da0d3e889 )
set ( _vfa_SUPPORTED ON )
set ( VERSION_CMD --version )
2020-07-14 04:43:39 +08:00
elseif ( VAR MATCHES "FLEX" OR VAR MATCHES "BISON" )
2018-11-07 09:03:59 +08:00
if ( CMAKE_HOST_WIN32 )
2020-07-14 04:43:39 +08:00
set ( SOURCEFORGE_ARGS
R E P O w i n f l e x b i s o n
F I L E N A M E w i n f l e x b i s o n - 2 . 5 . 1 6 . z i p
S H A 5 1 2 0 a 1 4 1 5 4 b f f 5 d 9 9 8 f e b 2 3 9 0 3 c 4 6 9 6 1 5 2 8 f 8 c c b 4 4 6 4 3 7 5 d 5 3 8 4 d b 8 c 4 a 7 d 2 3 0 c 0 c 5 9 9 d a 9 b 6 8 e 7 a 3 2 f 3 2 1 7 a 0 a 0 7 3 5 7 4 2 2 4 2 e a f 3 7 6 9 c b 4 f 0 3 e 0 0 9 3 1 a f 8 6 4 0 2 5 0 e 9 1 2 3
N O _ R E M O V E _ O N E _ L E V E L
W O R K I N G _ D I R E C T O R Y " $ { D O W N L O A D S } / t o o l s / w i n f l e x b i s o n "
)
if ( VAR MATCHES "FLEX" )
set ( PROGNAME win_flex )
else ( )
set ( PROGNAME win_bison )
endif ( )
set ( PATHS ${ DOWNLOADS } /tools/winflexbison/0a14154bff-a8cf65db07 )
2019-01-29 07:37:23 +08:00
if ( NOT EXISTS "${PATHS}/data/m4sugar/m4sugar.m4" )
2018-12-18 08:26:56 +08:00
file ( REMOVE_RECURSE "${PATHS}" )
endif ( )
2020-07-14 04:43:39 +08:00
elseif ( VAR MATCHES "FLEX" )
2018-08-23 05:04:20 +08:00
set ( PROGNAME flex )
set ( APT_PACKAGE_NAME flex )
set ( BREW_PACKAGE_NAME flex )
else ( )
set ( PROGNAME bison )
set ( APT_PACKAGE_NAME bison )
set ( BREW_PACKAGE_NAME bison )
2020-06-18 04:42:40 +08:00
if ( APPLE )
set ( PATHS /usr/local/opt/bison/bin )
endif ( )
2018-08-23 05:04:20 +08:00
endif ( )
2017-05-29 15:05:52 +08:00
elseif ( VAR MATCHES "GPERF" )
set ( PROGNAME gperf )
set ( PATHS ${ DOWNLOADS } /tools/gperf/bin )
set ( URL "https://sourceforge.net/projects/gnuwin32/files/gperf/3.0.1/gperf-3.0.1-bin.zip/download" )
set ( ARCHIVE "gperf-3.0.1-bin.zip" )
set ( HASH 3f2d3418304390ecd729b85f65240a9e4d204b218345f82ea466ca3d7467789f43d0d2129fcffc18eaad3513f49963e79775b10cc223979540fa2e502fe7d4d9 )
2017-06-18 02:30:03 +08:00
elseif ( VAR MATCHES "GASPREPROCESSOR" )
set ( NOEXTRACT true )
set ( PROGNAME gas-preprocessor )
2019-12-04 03:17:08 +08:00
set ( SUBDIR "b5ea3a50" )
2017-06-18 02:30:03 +08:00
set ( REQUIRED_INTERPRETER PERL )
set ( SCRIPTNAME "gas-preprocessor.pl" )
2019-12-04 03:17:08 +08:00
set ( PATHS ${ DOWNLOADS } /tools/gas-preprocessor/ ${ SUBDIR } )
set ( _vfa_RENAME "gas-preprocessor.pl" )
set ( URL "https://raw.githubusercontent.com/FFmpeg/gas-preprocessor/b5ea3a50ed991e6a3218e89402a8162c73f59cb2/gas-preprocessor.pl" )
set ( ARCHIVE "gas-preprocessor-${SUBDIR}.pl" )
set ( HASH 3a42a90dee09f3c8653d043d848057287f7460806a08f9471131d0c546ba541bdfa4efa3019e7ffc57a6c20538f1034f7a53b30ecaad9db5add7c71d8de35db9 )
2017-10-02 23:55:54 +08:00
elseif ( VAR MATCHES "DARK" )
set ( PROGNAME dark )
set ( SUBDIR "wix311-binaries" )
set ( PATHS ${ DOWNLOADS } /tools/dark/ ${ SUBDIR } )
set ( URL "https://github.com/wixtoolset/wix3/releases/download/wix311rtm/wix311-binaries.zip" )
set ( ARCHIVE "wix311-binaries.zip" )
set ( HASH 74f0fa29b5991ca655e34a9d1000d47d4272e071113fada86727ee943d913177ae96dc3d435eaf494d2158f37560cd4c2c5274176946ebdb17bf2354ced1c516 )
2017-11-19 19:42:52 +08:00
elseif ( VAR MATCHES "SCONS" )
set ( PROGNAME scons )
set ( REQUIRED_INTERPRETER PYTHON2 )
set ( SCRIPTNAME "scons.py" )
set ( PATHS ${ DOWNLOADS } /tools/scons )
set ( URL "https://sourceforge.net/projects/scons/files/scons-local-3.0.1.zip/download" )
set ( ARCHIVE "scons-local-3.0.1.zip" )
2020-08-03 06:49:20 +08:00
set ( HASH fe121b67b979a4e9580c7f62cfdbe0c243eba62a05b560d6d513ac7f35816d439b26d92fc2d7b7d7241c9ce2a49ea7949455a17587ef53c04a5f5125ac635727 )
elseif ( VAR MATCHES "SWIG" )
set ( VERSION 4.0.2 )
set ( PROGNAME swig )
if ( CMAKE_HOST_WIN32 )
set ( URL "https://sourceforge.net/projects/swig/files/swigwin/swigwin-${VERSION}/swigwin-${VERSION}.zip/download" )
set ( ARCHIVE "swigwin-${VERSION}.zip" )
set ( HASH b8f105f9b9db6acc1f6e3741990915b533cd1bc206eb9645fd6836457fd30789b7229d2e3219d8e35f2390605ade0fbca493ae162ec3b4bc4e428b57155db03d )
set ( SUBDIR "swigwin-${VERSION}" )
set ( PATHS "${DOWNLOADS}/tools/swig/${SUBDIR}/${SUBDIR}" )
else ( )
#Not used
set ( _vfa_SUPPORTED TRUE )
set ( URL https://sourceforge.net/projects/swig/files/swig/swig- ${ VERSION } /swig- ${ VERSION } .tar.gz/download )
set ( ARCHIVE "swig-${VERSION}.tar.gz" )
set ( HASH 05e7da70ce6d9a733b96c0bcfa3c1b82765bd859f48c74759bbf4bb1467acb1809caa310cba5e2b3280cd704fca249eaa0624821dffae1d2a75097c7f55d14ed )
set ( SUBDIR "swig-${VERSION}" )
set ( PATHS "${DOWNLOADS}/tools/swig/${SUBDIR}" )
endif ( )
set ( SOURCEFORGE_ARGS
R E P O s w i g
F I L E N A M E " $ { A R C H I V E } "
S H A 5 1 2 " $ { H A S H } "
N O _ R E M O V E _ O N E _ L E V E L
W O R K I N G _ D I R E C T O R Y " $ { D O W N L O A D S } / t o o l s / s w i g "
)
2018-02-24 16:00:51 +08:00
elseif ( VAR MATCHES "DOXYGEN" )
set ( PROGNAME doxygen )
2020-01-23 04:27:45 +08:00
set ( DOXYGEN_VERSION 1.8.17 )
2018-02-24 16:00:51 +08:00
set ( PATHS ${ DOWNLOADS } /tools/doxygen )
2020-01-23 04:27:45 +08:00
set ( URL
" h t t p : / / d o x y g e n . n l / f i l e s / d o x y g e n - $ { D O X Y G E N _ V E R S I O N } . w i n d o w s . b i n . z i p "
" h t t p s : / / s o u r c e f o r g e . n e t / p r o j e c t s / d o x y g e n / f i l e s / r e l - $ { D O X Y G E N _ V E R S I O N } / d o x y g e n - $ { D O X Y G E N _ V E R S I O N } . w i n d o w s . b i n . z i p " )
set ( ARCHIVE "doxygen-${DOXYGEN_VERSION}.windows.bin.zip" )
2020-01-16 08:48:26 +08:00
set ( HASH 6bac47ec552486783a70cc73b44cf86b4ceda12aba6b52835c2221712bd0a6c845cecec178c9ddaa88237f5a781f797add528f47e4ed017c7888eb1dd2bc0b4b )
2019-08-21 03:13:26 +08:00
elseif ( VAR MATCHES "BAZEL" )
set ( PROGNAME bazel )
set ( BAZEL_VERSION 0.25.2 )
set ( SUBDIR ${ BAZEL_VERSION } )
set ( PATHS ${ DOWNLOADS } /tools/bazel/ ${ SUBDIR } )
set ( _vfa_RENAME "bazel" )
if ( CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" )
set ( _vfa_SUPPORTED ON )
set ( URL "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-linux-x86_64" )
set ( ARCHIVE "bazel-${BAZEL_VERSION}-linux-x86_64" )
set ( NOEXTRACT ON )
set ( HASH db4a583cf2996aeb29fd008261b12fe39a4a5faf0fbf96f7124e6d3ffeccf6d9655d391378e68dd0915bc91c9e146a51fd9661963743857ca25179547feceab1 )
2020-03-06 06:17:08 +08:00
elseif ( CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" )
set ( _vfa_SUPPORTED ON )
2020-07-28 08:43:23 +08:00
set ( URL "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-darwin-x86_64" )
2020-03-06 06:17:08 +08:00
set ( ARCHIVE "bazel-${BAZEL_VERSION}-darwin-x86_64" )
set ( NOEXTRACT ON )
set ( HASH 420a37081e6ee76441b0d92ff26d1715ce647737ce888877980d0665197b5a619d6afe6102f2e7edfb5062c9b40630a10b2539585e35479b780074ada978d23c )
2019-08-21 03:13:26 +08:00
else ( )
2020-07-28 08:43:23 +08:00
set ( URL "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-windows-x86_64.zip" )
2019-08-21 03:13:26 +08:00
set ( ARCHIVE "bazel-${BAZEL_VERSION}-windows-x86_64.zip" )
set ( HASH 6482f99a0896f55ef65739e7b53452fd9c0adf597b599d0022a5e0c5fa4374f4a958d46f98e8ba25af4b065adacc578bfedced483d8c169ea5cb1777a99eea53 )
endif ( )
2018-03-07 17:57:16 +08:00
# Download Tools
elseif ( VAR MATCHES "ARIA2" )
set ( PROGNAME aria2c )
2019-07-02 04:31:17 +08:00
set ( PATHS ${ DOWNLOADS } /tools/aria2c/aria2-1.34.0-win-32bit-build1 )
set ( URL "https://github.com/aria2/aria2/releases/download/release-1.34.0/aria2-1.34.0-win-32bit-build1.zip" )
set ( ARCHIVE "aria2-1.34.0-win-32bit-build1.zip" )
set ( HASH 2a5480d503ac6e8203040c7e516a3395028520da05d0ebf3a2d56d5d24ba5d17630e8f318dd4e3cc2094cc4668b90108fb58e8b986b1ffebd429995058063c27 )
2016-09-19 11:50:08 +08:00
else ( )
message ( FATAL "unknown tool ${VAR} -- unable to acquire." )
endif ( )
2020-08-17 03:07:17 +08:00
macro ( do_version_check )
if ( VERSION_CMD )
_execute_process (
C O M M A N D $ { $ { V A R } } $ { V E R S I O N _ C M D }
W O R K I N G _ D I R E C T O R Y $ { D O W N L O A D S }
O U T P U T _ V A R I A B L E $ { V A R } _ V E R S I O N _ O U T P U T
)
string ( STRIP "${${VAR}_VERSION_OUTPUT}" ${ VAR } _VERSION_OUTPUT )
#TODO: REGEX MATCH case for more complex cases!
if ( NOT ${ VAR } _VERSION_OUTPUT VERSION_GREATER_EQUAL ${ VAR } _VERSION )
message ( STATUS "Found ${PROGNAME}('${${VAR}_VERSION_OUTPUT}') but at least version ${${VAR}_VERSION} is required! Trying to use internal version if possible!" )
set ( ${ VAR } "${VAR}-NOTFOUND" CACHE INTERNAL "" )
else ( )
message ( STATUS "Found external ${PROGNAME}('${${VAR}_VERSION_OUTPUT}')." )
endif ( )
endif ( )
endmacro ( )
2017-02-10 01:13:52 +08:00
macro ( do_find )
if ( NOT DEFINED REQUIRED_INTERPRETER )
2020-05-07 04:52:51 +08:00
find_program ( ${ VAR } ${ PROGNAME } PATHS ${ PATHS } NO_DEFAULT_PATH )
2020-08-17 03:07:17 +08:00
if ( NOT ${ VAR } )
find_program ( ${ VAR } ${ PROGNAME } )
if ( ${ VAR } AND NOT ${ VAR } _VERSION_CHECKED )
do_version_check ( )
set ( ${ VAR } _VERSION_CHECKED ON )
elseif ( ${ VAR } _VERSION_CHECKED )
message ( FATAL_ERROR "Unable to find ${PROGNAME} with min version of ${${VAR}_VERSION}" )
endif ( )
endif ( )
2017-02-10 01:13:52 +08:00
else ( )
vcpkg_find_acquire_program ( ${ REQUIRED_INTERPRETER } )
2020-08-17 22:25:05 +08:00
find_file ( SCRIPT_ ${ VAR } NAMES ${ SCRIPTNAME } PATHS ${ PATHS } NO_DEFAULT_PATH )
if ( NOT SCRIPT_ ${ VAR } )
find_file ( SCRIPT_ ${ VAR } NAMES ${ SCRIPTNAME } )
if ( SCRIPT_ ${ VAR } AND NOT ${ VAR } _VERSION_CHECKED )
set ( ${ VAR } ${ ${REQUIRED_INTERPRETER } } ${ SCRIPT_${VAR } } )
do_version_check ( )
set ( ${ VAR } _VERSION_CHECKED ON )
if ( NOT ${ VAR } )
unset ( SCRIPT_ ${ VAR } CACHE )
endif ( )
elseif ( ${ VAR } _VERSION_CHECKED )
message ( FATAL_ERROR "Unable to find ${PROGNAME} with min version of ${${VAR}_VERSION}" )
endif ( )
endif ( )
if ( SCRIPT_ ${ VAR } )
set ( ${ VAR } ${ ${REQUIRED_INTERPRETER } } ${ SCRIPT_${VAR } } )
endif ( )
2017-02-10 01:13:52 +08:00
endif ( )
endmacro ( )
do_find ( )
2020-08-17 22:25:05 +08:00
if ( NOT ${ VAR } )
2019-08-21 03:13:26 +08:00
if ( NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows" AND NOT _vfa_SUPPORTED )
2018-03-07 02:07:39 +08:00
set ( EXAMPLE "." )
if ( DEFINED BREW_PACKAGE_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" )
set ( EXAMPLE ":\n brew install ${BREW_PACKAGE_NAME}" )
elseif ( DEFINED APT_PACKAGE_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" )
set ( EXAMPLE ":\n sudo apt-get install ${APT_PACKAGE_NAME}" )
endif ( )
message ( FATAL_ERROR "Could not find ${PROGNAME}. Please install it via your package manager${EXAMPLE}" )
endif ( )
2020-07-14 04:43:39 +08:00
if ( DEFINED SOURCEFORGE_ARGS )
# Locally change editable to suppress re-extraction each time
set ( _VCPKG_EDITABLE 1 )
vcpkg_from_sourceforge ( OUT_SOURCE_PATH SFPATH ${ SOURCEFORGE_ARGS } )
unset ( _VCPKG_EDITABLE )
2016-09-19 11:50:08 +08:00
else ( )
2020-07-14 04:43:39 +08:00
vcpkg_download_distfile ( ARCHIVE_PATH
U R L S $ { U R L }
S H A 5 1 2 $ { H A S H }
F I L E N A M E $ { A R C H I V E }
)
set ( PROG_PATH_SUBDIR "${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR}" )
file ( MAKE_DIRECTORY ${ PROG_PATH_SUBDIR } )
if ( DEFINED NOEXTRACT )
if ( DEFINED _vfa_RENAME )
file ( INSTALL ${ ARCHIVE_PATH } DESTINATION ${ PROG_PATH_SUBDIR } RENAME ${ _vfa_RENAME } FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )
else ( )
file ( COPY ${ ARCHIVE_PATH } DESTINATION ${ PROG_PATH_SUBDIR } FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )
endif ( )
2017-01-11 18:37:19 +08:00
else ( )
2020-07-14 04:43:39 +08:00
get_filename_component ( ARCHIVE_EXTENSION ${ ARCHIVE } LAST_EXT )
string ( TOLOWER "${ARCHIVE_EXTENSION}" ARCHIVE_EXTENSION )
if ( ARCHIVE_EXTENSION STREQUAL ".msi" )
file ( TO_NATIVE_PATH "${ARCHIVE_PATH}" ARCHIVE_NATIVE_PATH )
file ( TO_NATIVE_PATH "${PROG_PATH_SUBDIR}" DESTINATION_NATIVE_PATH )
_execute_process (
C O M M A N D m s i e x e c / a $ { A R C H I V E _ N A T I V E _ P A T H } / q n T A R G E T D I R = $ { D E S T I N A T I O N _ N A T I V E _ P A T H }
W O R K I N G _ D I R E C T O R Y $ { D O W N L O A D S }
)
elseif ( "${ARCHIVE_PATH}" MATCHES ".7z.exe$" )
vcpkg_find_acquire_program ( 7Z )
_execute_process (
C O M M A N D $ { 7 Z } x " $ { A R C H I V E _ P A T H } " " - o $ { P R O G _ P A T H _ S U B D I R } " - y - b s o 0 - b s p 0
W O R K I N G _ D I R E C T O R Y $ { P R O G _ P A T H _ S U B D I R }
)
else ( )
_execute_process (
C O M M A N D $ { C M A K E _ C O M M A N D } - E t a r x z f $ { A R C H I V E _ P A T H }
W O R K I N G _ D I R E C T O R Y $ { P R O G _ P A T H _ S U B D I R }
)
endif ( )
2017-01-11 18:37:19 +08:00
endif ( )
2016-09-19 11:50:08 +08:00
endif ( )
2019-07-03 04:47:50 +08:00
if ( DEFINED POST_INSTALL_COMMAND )
vcpkg_execute_required_process (
2019-08-29 04:49:29 +08:00
A L L O W _ I N _ D O W N L O A D _ M O D E
2019-07-03 04:47:50 +08:00
C O M M A N D $ { P O S T _ I N S T A L L _ C O M M A N D }
W O R K I N G _ D I R E C T O R Y $ { P R O G _ P A T H _ S U B D I R }
L O G N A M E $ { V A R } - t o o l - p o s t - i n s t a l l
)
endif ( )
2020-08-17 03:07:17 +08:00
unset ( ${ VAR } CACHE )
2017-02-10 01:13:52 +08:00
do_find ( )
2020-08-17 03:07:17 +08:00
if ( NOT ${ VAR } )
message ( FATAL_ERROR "Unable to find ${VAR}" )
endif ( )
2016-09-19 11:50:08 +08:00
endif ( )
2017-10-13 02:54:47 +08:00
set ( ${ VAR } "${${VAR}}" PARENT_SCOPE )
2016-09-19 11:50:08 +08:00
endfunction ( )