-
Notifications
You must be signed in to change notification settings - Fork 48
Compile guide for Windows (CMake, MSVC)
This guide is basically what I do to build the binary builds. I'll only document x64 Release build with VS2019 here. This should also work for x86 builds or older version of Visual Studio, just change things accordingly.
Some of these dependencies can be installed with vcpkg. See https://github.com/wangqr/Aegisub/wiki/Get-dependencies-using-vcpkg.
Download and install the official release from https://cmake.org/download/ . We use the win64-x64.msi
here.
Clone the official Windows binary repo: git clone https://github.com/ubawurinna/freetype-windows-binaries.git
Download the official release from unicode-org/icu. We use the Win64-MSVC2017.zip
build here. Extract the zip to some proper place.
Go to lib64/
, copy all icuXX.lib
to icuXXd.lib
.
Clone kiyolee fork: git clone https://github.com/kiyolee/libiconv-win-build.git
Go to libiconv-win-build\build-VS2019
, open libiconv.sln
in Visual Studio. Select Release
x64
build in the toolbar. Then build the dll/libiconv
project.
Copy libiconv-win-build\build-VS2019\x64\Release\libiconv.lib
to libiconv-win-build\lib\iconv.lib
.
Download the official release from harfbuzz/harfbuzz. We use the .tar.xz
source tarball here. Do not download the win32 build unless you are building x86 build. Extract the tarball to some proper place.
Create a build
directory (actually you can call it anything you like). Open CMake, set the source code directory to where you extracted the tarball, and the binary directory to the build directory you just created. Click "Configure" and select Visual Studio 16 2019 (x64)
as the toolchain. Check the Grouped
and Advanced
checkbox under the binary directory.
After the first configuration, expand the HB
group, check HB_HAVE_DIRECTWRITE
, HB_HAVE_FREETYPE
, HB_HAVE_GDI
, HB_HAVE_ICU
. Then click "Configure" again. It will show some error about missing library. We just need to manually specify them, and click "Configure" again until there is no more error.
-
FREETYPE_INCLUDE_DIR_freetype2
should beC:/path/to/freetype-windows-binaries/include/freetype
-
FREETYPE_INCLUDE_DIR_ft2build
should beC:/path/to/freetype-windows-binaries/include
-
FREETYPE_LIBRARY_DEBUG
can be left not found -
FREETYPE_LIBRARY_RELEASE
should beC:/path/to/freetype-windows-binaries/win64/freetype.lib
-
ICU_INCLUDE_DIR
should beC:/path/to/icu4c-xx_y-Win64-MSVC2017/include
-
ICU_LIBRARY
should beC:/path/to/icu4c-xx_y-Win64-MSVC2017/lib64/icuuc.lib
When there is no more error, click "Generate" and "Open Project". Select Release
x64
build in the toolbar. Then build the harfbuzz
project.
Download the official release from fribidi/fribidi. We use the .tar.xz
source tarball here. Extract the tarball to some proper place.
To build fribidi, we need meson. Download and install Python. Check the Add to PATH
during installation. After installed Python, run python -m pip install meson
.
Run x64 Native Tools Command Prompt for VS 2019
from start menu. Go to the source directory, and run meson setup build --buildtype=release --backend=vs2019
. This will create a directory called build
with the VS project. Open the fribidi.sln
project, select Release
x64
, build the lib/fribidi
project.
Clone jesec fork: git clone https://github.com/jesec/libass.git
Open the libass.sln
project, retarget the project if needed. Select Release
x64
. Right click libass
project, click Properties
. Go to C/C++
, edit the Additional Include Directories
, and add the following:
C:\path\to\freetype-windows-binaries\include
C:\path\to\fribidi-x.y.z\lib
C:\path\to\fribidi-x.y.z\build\lib
C:\path\to\harfbuzz-x.y.z\src
Go to Librarian
, edit the Additional dependencies
, and add the following:
C:\path\to\freetype-windows-binaries\win64\freetype.lib
C:\path\to\fribidi-x.y.z\build\lib\fribidi.lib
C:\path\to\harfbuzz-x.y.z\build\Release\harfbuzz.lib
Remove ass_fontconfig.c
from the project. It is not needed on Windows.
Then build the project.
Download the official release from wxWidgets/wxWidgets. We need headers.7z
, vc14x_Dev.7z
and vc14x_ReleaseDLL.7z
. Extract both zips to some proper place.
Download the official release from madler/zlib and extract. Open zlib-x.y.z\contrib\vstudio\vc14\zlibvc.sln
. Select Release
x64
and build zlibvc
.
Go to zlib-x.y.z\contrib\vstudio\vc14\x64\ZlibDllRelease
, copy the zlibwapi.lib
to same folder and rename to zlib.lib
. Open zlib-x.y.z\zlib.h
and add the following line to the beginning:
#define ZLIB_WINAPI
Download the official release from https://www.boost.org/users/download/ . Use the Windows archive, extract to some proper directory.
Run x64 Native Tools Command Prompt for VS 2019
from start menu. Go to the source directory, and run:
.\bootstrap.bat
set PATH=C:\path\to\zlib-x.y.z\contrib\vstudio\vc14\x64\ZlibDllRelease;C:\path\to\icu4c-xx_y-Win64-MSVC2017\bin64;C:\path\to\libiconv-win-build\build-VS2019\x64\Release;%PATH%
.\b2.exe boost.locale.iconv=on architecture=x86 address-model=64 link=shared -sICU_PATH="C:\path\to\icu4c-xx_y-Win64-MSVC2017" -sZLIB_INCLUDE="C:\path\to\zlib-x.y.z" -sZLIB_LIBPATH="C:\path\to\zlib-x.y.z\contrib\vstudio\vc14\x64\ZlibDllRelease" -sICONV_PATH=C:\path\to\libiconv-win-build -a -j8 install
Change the -j8
to your CPU core count. Make sure it found icu and zlib.
Open C:\Boost\include\boost-x_yy\boost\config\user.hpp
, uncomment the following line:
#define BOOST_ALL_DYN_LINK
Althogh FFMS2 is an optional dependency, it is strongly recommended that you enable it. It is the most common way Aegisub loads a media file.
Download the official release from FFMS/ffms2 and extract.
Download the official release from http://www.fftw.org/install/windows.html . Run x64 Native Tools Command Prompt for VS 2019
and follow the official guide to create necessary files:
lib /machine:x64 /def:libfftw3-3.def
lib /machine:x64 /def:libfftw3f-3.def
lib /machine:x64 /def:libfftw3l-3.def
Download the official release from hunspell/hunspell. Open msvc\Hunspell.sln
, select Release_dll
x64
and build libhunspell
.
Download the official release from https://www.freedesktop.org/software/uchardet/releases/ . Create a build
directory. Open CMake, set the source code directory and the binary directory. Click "Configure", "Generate" and "Open Project". Select Release
x64
and build libuchardet
.
Copy src/uchardet.h
to include/uchardet/uchardet.h
.
Download and install the official release from AviSynth/AviSynthPlus. During install, check the "Filter SDK" component.
Download the official release from https://www.nuget.org/packages/Microsoft.XAudio2.Redist/ . Extract to some proper directory.
To use XAudio2redist, set XAUDIO2_REDIST
to ON in CMake.
First, clone this repository:
git clone https://github.com/wangqr/Aegisub.git # No --recursive is needed
cd Aegisub
./build/version.sh . # This will generate build/git_version.h
Create a build-dir
directory (you can call it anything you like). Open CMake, set the source code directory and the binary directory. Click "Configure". Manually specify path of missing library, until there is no more errors. In the WITH
group, make sure all features you need is enabled.
Add /DUNICODE /D_UNICODE
to CMAKE_CXX_FLAGS
and CMAKE_C_FLAGS
to enable Unicode support. Add /MP
to CMAKE_CXX_FLAGS
and CMAKE_C_FLAGS
to enable parallel build for MSVC.
Click "Configure", "Generate". Select Release
x64
and build Aegisub
. When you run Aegisub after build, you'll see errors of missing dlls. They can be found in the corresponding dependency directories. Copy them to the same folder of Aegisub.exe
.