MPC-HC 编译方法
官方原文:http://sourceforge.net/apps/trac/mpc-hc/wiki/How_to_compile_the_MPC
环境:
1.Visual Studio 2010
2.DirectX SDK (June 2010) ,正常安装即可。
3.http://xhmikosr.1f0.de/tools/MSYS_MinGW_GCC_470_x86-x64.7z,下载后解压到C:即可。也可到其他路径,但需相应修改改fstab。
进入 C:\MSYS\etc\ 目录,编辑或创建名称为 fstab 的文件以指定 MinGW 路径。在该文件中添加这一行:C:\MSYS\mingw \mingw。参照fstab.sample写法。
添加以下环境变量
变量名 | 变量值 |
MSYS | C:\MSYS |
MINGW32 | C:\MSYS\mingw |
MINGW64 | C:\MSYS\mingw |
修改环境变量“Path”,在其值的末尾添加:;%MINGW32%\bin;%MSYS%\bin
打开源码,编译链接即可。
Part A: Preparing the Visual Studio environment
Visual Studio 2010
1. Install Visual C++ 2010, part of Visual Studio 2010 Professional (Express won't work, other editions work fine).
2. Install Visual Studio 2010 Service Pack 1 -> http://www.microsoft.com/downloads/en/details.aspx?FamilyID=75568aa6-8107-475d-948a-ef22627e57a5&displaylang=en
3. Install the DirectX SDK (June 2010) -> http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=3021d52b-514e-41d3-ad02-438a3ba730ba
Part B: Preparing the GCC environment
NOTES:
* If you installed the MSYS/MinGW package in an other directory you will have to use that path in the following steps.
* If you don't use TortoiseSVN then the revision number will be a hard-coded one, like 1.6.2.0.
1. Download and extract MSYS_MinGW_GCC_470_x86-x64.7z to "C:\MSYS" -> http://xhmikosr.1f0.de/tools/MSYS_MinGW_GCC_470_x86-x64.7z
For the components and their version see: http://xhmikosr.1f0.de/tools/MSYS_MinGW_GCC_470_x86-x64_components.txt
2. Edit the "fstab" file in "C:\MSYS\etc" to specify your MinGW path.
Add this to it: C:\MSYS\mingw \mingw
Note the tab-space between "mingw" and "\mingw"
3. Create a file named "build.user.bat" in "C:\mpc-hc" containing the following entries, adapted for your system:
@ECHO OFF
SET "MPCHC_MSYS=C:\MSYS"
SET "MPCHC_MINGW32=%MPCHC_MSYS%\mingw"
SET "MPCHC_MINGW64=%MPCHC_MINGW32%"
Part C: Downloading and compiling the MPC-HC source
1. Use a subversion client to checkout MPC-HC's trunk to "C:\mpc-hc" (or anywhere else you like)
Repository URL: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk
The recommended SVN client is TortoiseSVN (grab it from http://tortoisesvn.net/downloads)
2. When using TortoiseSVN
a) Create an empty directory where you want to store the source files. e.g: "C:\mpc-hc"
b) Right-click on that directory and choose "SVN checkout".
c) Put "https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk" in "URL of Repository" and press OK.
d) Wait for the source tree to be downloaded.
3. Open the solution file "C:\mpc-hc\mpc-hc.sln"
Change the solution's configuration to "Release" (in the toolbar).
See Part D for libmingwex.a x64
4. Press F7 to build the solution.
5. You now have "mpc-hc.exe" under "C:\mpc-hc\bin\mpc-hc_x86"
6. Open the solution file "C:\mpc-hc\mpciconlib.sln"
7. Press F7 to build the solution.
8. You now have "mpciconlib.dll" under "C:\mpc-hc\bin\mpc-hc_x86"
9. Open the solution file "C:\mpc-hc\mpcresources.sln"
In Visual Studio go to Build->Batch Build->Press Select All->Press Build
10. You now have "mpcresources.XX.dll" under "C:\mpc-hc\bin\mpc-hc_x86\Lang"
Alternatively, you can use "build.bat" which can build everything for you
(run: build.bat help for more info)
Part D: Building FFmpeg x64 with GCC
Run "C:\mpc-hc\src\thirdparty\ffmpeg\gccbuild.bat" x64 libmingwex
After the compilation is done, "libgcc.a" and "libmingwex.a" will be placed in "C:\mpc-hc\lib64"
Now FFmpeg can be compiled from within the MPC-HC visual studio solution file, and everything will be linked correctly with the other components.
Part E: Building the installer
Download Inno Setup Unicode v5.5.0 or newer from: http://www.jrsoftware.org/isdl.php
Install everything and then go to "C:\mpc-hc\distrib", open "mpc-hc_setup.iss" with Inno Setup, read the first comments in the script and compile it.
Notes:
* "build.bat" can build the installer by using the "installer" or the "packages" switch.
* Use Inno Setup's built-in IDE if you want to edit the iss file.