从源码编译UE4,加快Setup.bat下载文件的环节

之前很傻,每次运行这个setup.bat都要等很久很久才能把4g多的东西下载完成,知道有一天突然发现了世外桃源……

从命令行运行setup.bat -help,可以看到参数的说明(没错,参数可选,之前一直以为bat都是拿来双击的……):

Usage:
   GitDependencies [options]

Options:
   --all                         Sync all folders
   --include=<X>                 Include binaries in folders called <X>
   --exclude=<X>                 Exclude binaries in folders called <X>
   --prompt                      Prompt before overwriting modified files
   --force                       Always overwrite modified files
   --root=<PATH>                 Set the repository directory to be sync
   --threads=<N>                 Use N threads when downloading new files
   --dry-run                     Print a list of outdated files and exit
   --max-retries                 Override maximum number of retries per file
   --proxy=<user:password@url>   Sets the HTTP proxy address and credentials
   --cache=<PATH>                Specifies a custom path for the download cache
   --cache-size-multiplier=<N>   Cache size as multiplier of current download
   --cache-days=<N>              Number of days to keep entries in the cache
   --no-cache                    Disable caching of downloaded files

Detected settings:
   Excluded folders: Mac, Android, Linux
   Proxy server: none
   Download cache: disabled

Default arguments can be set through the UE4_GITDEPS_ARGS environment variable.
Installing prerequisites...

我们的优化都是围绕这些参数来的:

  1. --exclude=<XXX> (这些选项前的双横线也可以用单横线)
    非常有用,减少不必要的文件下载。可以排除掉自己不需要的平台和VS版本,例如: setup.bat -exclude=Linux -exclude=IOS -exclude=HTML5  -exclude=Android -exclude=VS2013
    平台可选的参数:Win32Win64osx32,osx64LinuxAndroidIOSHTML5
    VS版本可选参数:VS2012,VS2013,VS2015
    警告: 不要排除Win32 和 VS2012, 不然后期编译会遇到问题
  2. --threads=<N>
    可以多线程下载,速度倍增。例如:setup.bat --threads=20
  3. --cache=<PATH>
    可以把下载的内容缓存在指定的目录,这样如果有多人需要,就可以只下载一次,然后分享给大家,例如:setup.bat --cache=D:\Temp
  4. --proxy=<user:password@url>
    可以使用代理下载
posted @ 2017-06-08 19:38  Ken_An  阅读(7564)  评论(0编辑  收藏  举报