Search code examples
visual-c++buildninjameson-build

Build libdav1d using Microsoft Visual C++?


I've managed to build it using MinGW.

Is there a way to build it using Microsoft Visual C++?

I want to use it with FFmpeg. My FFmpeg and all its dependencies are compiled using Visual C++, so I'm trying to avoid possible problems caused by mixing MinGW and Visual C++ libraries.


Solution

  • It seems I've found a working solution.

    1. Install Meson (https://github.com/mesonbuild/meson/releases)
    2. Install NASM (https://www.nasm.us/)
    3. Add both Meson and NASM to system PATH variable
    4. Open x64 Native Tools Command Prompt for Visual Studio (to build x64 version)
    5. Apply the following commands:

    git clone https://code.videolan.org/videolan/dav1d.git

    cd dav1d

    meson build

    cd build

    meson configure -Dbuildtype=release

    meson configure -Ddefault_library=static

    ninja

    But for an unknown reason it generates static libraries with .a extension instead of .lib. I think it's just a typo and it's safe to just rename the generated lib.

    To generate shared library use meson configure -Ddefault_library=shared.