Building on Microsoft Windows

Requirements

Preparation

First choose a directory to work in, this is where the code will be checked out and built. This directory will be referred to as $DJV_BUILD in the rest of the documentation.

Append this to your PATH environment variable in the Windows control panel:

$DJV_BUILD/DJV-install-Debug/bin

Building FFmpeg

The following steps describe how to use the Windows Subsystem for Linux to cross-compile FFmpeg for Windows.

Enable the Windows Subsystem for Linux:

Start an Ubuntu shell and setup the environment:

$ sudo apt update
$ sudo apt install mingw-w64 yasm make unzip

Build FFmpeg:

$ wget https://ffmpeg.org/releases/ffmpeg-4.2.2.tar.bz2
$ tar xvf ffmpeg-4.2.2.tar.bz2
$ cd ffmpeg-4.2.2
$ ./configure \
      --disable-programs \
      --disable-doc \
      --disable-bzlib \
      --disable-iconv \
      --disable-lzma \
      --enable-pic \
      --arch=x86_64 \
      --cross-prefix=x86_64-w64-mingw32- \
      --target-os=mingw32 \
      --enable-cross-compile \
      --prefix=$DJV_BUILD \
      --enable-shared
$ make
$ make install

Building DJV

Open a Visual Studio x64 command prompt, go to the build directory, and clone the DJV repository:

> cd $BUILD_DIR
> git clone https://github.com/darbyjohnston/DJV.git

Build the third party dependencies:

> mkdir DJV-third-party-Debug
> cd DJV-third-party-Debug
> cmake ..\DJV\third-party -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../DJV-install-Debug
> cmake --build .
> cmake --build . --target install
> cd ..

Build DJV:

> mkdir DJV-Debug
> cd DJV-Debug
> cmake ..\DJV -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=../DJV-install-Debug -DCMAKE_INSTALL_PREFIX=../DJV-install-Debug
> cmake --build .

Try running the confidence tests to make sure everything is working OK:

> cmake --build . --target test

Run the djv player application:

> build\bin\djv

Packaging DJV

Create a release build:

> mkdir DJV-third-party-Release
> cd DJV-third-party-Release
> cmake ..\DJV\third-party -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../DJV-install-Release
> cmake --build .
> cmake --build . --target install
> cd ..
> mkdir DJV-Release
> cd DJV-Release
> cmake ..\DJV -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=../DJV-install-Release -DCMAKE_INSTALL_PREFIX=../DJV-install-Release
> cmake --build .

Build the packages:

> cmake ..\DJV -DDJV_THIRD_PARTY=TRUE
> cmake --build .
> cmake --build . --target package