GPAC Build Guide for Windows
To build on Windows, you'll need:
For a full build, other tools might be required, they will be mentioned at the time.
Build MP4Box only
To build only the MP4Box command line utility, you will need to:
- Get the source
git clone https://github.com/gpac/gpac gpac_public
- Open the "Developer Command Prompt for VS 2015" (or equivalent)
It might be called something else depending on your version of Visual Studio. The goal is to be able to run the
> cd gpac_public\build\msvc14 > msbuild.exe gpac.sln /maxcpucount /t:Rebuild /p:Configuration="Release - MP4Box_only" /p:Platform=x64 /p:PlatformToolset=v140 /p:WindowsTargetPlatformVersion=8.1
/p:Platform=x64: Change to
/p:Platform=Win32to get a 32 bits build
/p:WindowsTargetPlatformVersion=8.1: Change this depending on your Visual Studio version and the Windows SDK version you have installed.
You can find out what versions you have by opening the gpac.sln solution in Visual Studio, opening the property page of one the project, and checking the "Platform Toolset" and "Windows SDK Version" fields.
Alternatively, you can build with the Visual Studio GUI. If needed, use the "Retarget Solution" function (by right-clicking on the solution in the Solution Explorer) to adjust the Windows SDK version.
- The binary
bin\x64\Release - MP4Box_only
You can add this directory to your
PATH environment variable. Or move the binary to a destination in your
PATH. Or just use it locally.
Full GPAC build
To get a full build of the whole GPAC project, you will first need to build some dependencies, copy them over to the main gpac repo, and build it.
Let's take it step by step. To keep things clear, let's call your main working directory
Get the code
# get gpac source <GPAC_ROOT_DIR> > git clone https://github.com/gpac/gpac gpac_public # get dependencies <GPAC_ROOT_DIR> > git clone https://github.com/gpac/deps_windows <GPAC_ROOT_DIR> > cd deps_windows <GPAC_ROOT_DIR>\deps_windows > git submodule update --init --recursive --force --checkout
Naming the main gpac source repo
gpac_public is important because some subsequent scripts will have this name hard-coded. (If you don't want to do that, you can find instances of "gpac_public" in the deps_windows repo and replace them with whatever your set up is.)
Open the "Developer Command Prompt for VS 2015" (or equivalent in your install).
<GPAC_ROOT_DIR>\deps_windows > cd build\msvc <GPAC_ROOT_DIR>\deps_windows\build\msvc > msbuild.exe BuildAll_vc10.sln /maxcpucount /t:Build /p:Configuration=Release /p:Platform=x64 /p:PlatformToolset=v140 /p:WindowsTargetPlatformVersion=8.1
The OpenHEVC build on Windows is a bit tricky.
The easiest way is to use Cygwin to handle the configure/make scripts but still use the Visual Studio compiler to generate native binaries.
There might be other ways (like using MinGW/MSYS2), but the way explained here seem to be working pretty well. You can get more details about OpenHEVC at https://github.com/OpenHEVC/openHEVC.
- Install Cygwin
Make sure to have at least these cygwin packages installed:
yasm, pkg-config, make.
We'll assume that cygwin is installed in
C:\cygwin64. If you installed it elsewhere, update the next steps accordingly.
- From a windows command prompt (cmd), run:
<GPAC_ROOT_DIR>\deps_windows > build_openhevc.bat x64 "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" "C:\cygwin64\bin\bash.exe"
The arguments are, in order:
x64: for 32 or 64 bits build
<PATH_TO_VCVARSALL>: path to the "Developer Command Prompt" init script. You can get this path by checking the destination of "Developer Command Prompt" shortcut in windows. Some possible values:
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"for VS 2015
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"for VS 2017 Community
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"should also work with VS 2017
<PATH_TO_CYGWIN_BASH>: if the cygwin bash is in your PATH, you can remove this argument.
To run this script properly, you will have to have the
unzip commands available in your
You can get them here: http://gnuwin32.sourceforge.net/packages.html. Just download them and put them in a location reachable from the
<GPAC_ROOT_DIR>\deps_windows > CopyLibs2Public.bat all
Now that all dependencies have been set up, we can be build GPAC proper by simply running, inside a Developer Command Prompt:
<GPAC_ROOT_DIR>\gpac_public\build\msvc14 > msbuild.exe gpac.sln /maxcpucount /t:Rebuild /p:Configuration=Release /p:Platform=x64 /p:PlatformToolset=v140 /p:WindowsTargetPlatformVersion=8.1
Of course you can also open the
gpac.sln solution in the Visual Studio GUI and build/debug from there.
The binaries will be in
You can add this to your
PATH to run it from anywhere.
Packaging GPAC (optional)
If you want to generate your own GPAC installer, you will first need to install NSIS.
You can then run:
<GPAC_ROOT_DIR>\gpac_public > generate_installer.bat x64
If you want to generate an installer from uncommitted/unpushed changes, you might have to edit the script to remove this check.
This method is how the official GPAC builds are made. It might not work on all configurations/systems as is.
You can report building issues in the github issue tracker for GPAC.