Since this has been requested several times, here’s a tutorial There might be some typos etc, will fix when notified
So, you want to build and/or develop Natron on Windows? Let’s start.
Setup a MSYS2 environment
The first thing that is needed is MSYS2, note that we use a specific snapshot and custom packages. You must use the exact version and commands described or you may end up with a non-functional SDK installation.
- Download and extract msys2-base-x86_64-20180531.tar.xz
- Move the extracted
msys64
folder toC:\msys64-20180531
(Other locations are untested) - Run
C:\msys64-20180531\mingw64.exe
(this will trigger a setup script, wait until done) - When prompted close the MSYS2 window
Now start C:\msys64-20180531\mingw64.exe
, then run the following commands:
$ sed -i 's/SigLevel = Required DatabaseOptional/SigLevel = Never/' /etc/pacman.conf
$ echo "Server = https://downloads.sourceforge.net/project/openfx-arena/MINGW-packages/mingw64" > /etc/pacman.d/mirrorlist.mingw64
$ echo "Server = https://downloads.sourceforge.net/project/openfx-arena/MINGW-packages/msys" > /etc/pacman.d/mirrorlist.msys
This will setup a custom MSYS2 repository used by Natron, you only need to do this once. Now install the SDK:
$ pacman -Syu natron-sdk
This will install everything required to build Natron, the plug-ins and the SDK (if you need to rebuild or update anything).
You now have a working Natron SDK installation. Launch C:\msys64-20180531\mingw64.exe
when you need to build anything.
Setup a development environment (Qt Creator)
This part will document how to setup Qt Creator for building and developing Natron.
Qt debug-and-release
The default installation of Qt is release mode, to get a debug-and-release version download mingw-w64-x86_64-qt4-4.8.7-8-any.pkg.tar.xz, launch C:\msys64-20180531\mingw64.exe
and install it.
pacman -U /path/to/mingw-w64-x86_64-qt4-4.8.7-8-any.pkg.tar.xz
Setup
Start Qt Creator and go to Tools=>Options
.
Debuggers
Go to the Kits
menu and select Debuggers
, then add a new.
The path is C:\msys64-20180531\mingw64\bin\gdb.exe
.
Compilers
Go to the Kits
menu and select Compilers
, then add a new (MINGW=>C
).
The path is C:\msys64-20180531\mingw64\bin\cc.exe
.
Go to the Kits
menu and select Compilers
, then add a new (MINGW=>C++
).
The path is C:\msys64-20180531\mingw64\bin\c++.exe
.
Qt
Go to the Kits
menu and select Qt Versions
, then add a new.
The path is C:\msys64-20180531\mingw64\bin\qmake.exe
.
Kits
Go to the Kits
menu and select Kits
, then add a new.
Now select the GDB, GCC and Qt versions added previous.
Project
Clone the Natron source then start Qt Creator.
git clone https://github.com/NatronGitHub/Natron
cd Natron
git submodule update -i --recursive
wget https://github.com/NatronGitHub/OpenColorIO-Configs/archive/Natron-v2.1.tar.gz
tar xvf Natron-v2.1.tar.gz
mv OpenColorIO-Configs-Natron-v2.1 OpenColorIO-Configs
Open Project.pro
from the Natron git source folder and select the custom kit added previous. When done go to the Projects
tab and add a new environment variable PYTHONHOME
with the value C:\msys64-20180531\mingw64
.
That’s it! You should now be able to build and run release and debug versions of Natron directly from Qt Creator.
Setup a CI environment
With a working MSYS2 installation launch C:\msys64-20180531\mingw64.exe
and clone the build tools:
git clone https://github.com/NatronGitHub/Natron NatronCI
Now create a build script:
#!/bin/bash
# Build Natron Windows Snapshot
#
# Unit tests may freeze/stall several times, when/if that happens run : NR=`ps aux | grep NatronRenderer | awk '{print $1}'` && kill -9 $NR
#
export WORKSPACE=$HOME/NatronCI-snapshot
export UNIT_TESTS=true
export BUILD_NAME=snapshots
export BUILD_NUMBER=RB-2.3
export GIT_URL=https://github.com/NatronGitHub/Natron.git
export SNAPSHOT_BRANCH=RB-2.3
export GIT_BRANCH=RB-2.3
export NATRON_LICENSE=GPL
export NATRON_DEV_STATUS=SNAPSHOT
export NATRON_BUILD_NUMBER=1
export COMPILE_TYPE=relwithdebinfo
export BITS=64
export DISABLE_BREAKPAD=1
export DISABLE_PORTABLE_ARCHIVE=0
export REMOTE_URL=NO_URL
export REMOTE_USER=NO_USER
export REMOTE_PREFIX=NO_PREFIX
export MKJOBS=4
export LOCALAPPDATA="/c/Users/USERNAME/AppData/Local"
export MSYSTEM=MINGW64
export NOUPDATE=1
export GIT_URL_IS_NATRON=1
if [ ! -d "$WORKSPACE" ]; then
mkdir -p "$WORKSPACE"
fi
./launchBuildMain.sh
and save to $HOME/NatronCI/tools/jenkins/build-snapshot.sh
. Remember to change LOCALAPPDATA
to match your username, and MKJOBS
to match your CPU. You can disable unit tests with UNIT_TESTS=false
.
Now run the script (active internet connection needed):
cd $HOME/NatronCI/tools/jenkins
bash build-snapshot.sh
The result will be in $HOME/NatronCI-snapshot
.
This was just an example, see launchBuildMain.sh
for more information/options.