來源:http://roxlu.com/2016/057/compiling-x264-on-windows-with-msvcgit
1. Download and msys2github
Go to msys2.github.io and download the 64 bit installer. On their website they have a pretty good how-to that you can follow. You select the destination and click next a couple of times. It will install all base files, but you still need to do some steps after clicking next a couple of times. Make sure you tick the [x] Run MSYS2-64 bit now
. In the msys window type (also described on their website) the following command. Note that you may need to close and then open (via the windows menu) msys2 again during any of these steps. If there is no "msys2" in your start menu (which happened to me), you can executed the msys2_shell.cmd
from the install directory. Next execute the following to update the packages.web
$ pacman -Sy pacman $ pacman -Syu $ pacman -Su
2. Install dependenciesshell
Click on the msys2_shell.cmd
file from the install directory and install some more dependencies:windows
$ pacman -S yasm $ pacman -S make
3. Get x264 sourcesbash
Next, because installing git with pacman in the msys shell failed, I cloned x264 using the git-bash I had installed already. So open your git-bash and clone x264.app
$ cd /some/dir $ git clone http://git.videolan.org/git/x264.git
4. Compileide
Now press your windows key and type vs2015
(and of course make sure you have installed Visual Studio 2015 Express Edition), and select the VS2015 x64 Native Tools Command Prompt
this
Using this VS2015 x264 Native Tools Command Prompt
go to your msys2 directory and type:code
$ msys2_shell.cmd -mingw64 -full-path
This will open a new msys2
shell, in which the correct environment variables have been set, which allows you to compile x264 with VS2015. Now, go to your x264 directory and execute:
$ cd /to/your/x264/source $ CC=cl ./configure --enable-static --prefix=${PWD}/installed $ make $ make install