zenviewer
en ro

Build ZenViewer

How to build ZenViewer 0.7.0 from its source code, on Linux and on Windows. If you only want to use it, the ready-made downloads are quicker.

Get the source

Either the release archive, or the latest code from GitHub with git. Then follow the steps for Linux or Windows below.

The release archive

$ curl -LO https://viewer.zenwa.re/downloads/zenviewer-0.7.0.tar.gz
$ tar xzf zenviewer-0.7.0.tar.gz
$ cd zenviewer

The same three commands work in a Windows Command Prompt or PowerShell: Windows 10 and 11 come with curl and tar. In PowerShell 5.1 type curl.exe, since curl there means something else.

With git latest code

Install git, if you don't have it

$ sudo apt install git            Debian, Ubuntu
$ sudo dnf install git            Fedora
$ sudo zypper install git         openSUSE
$ sudo pacman -S --needed git     Arch
> winget install --id Git.Git -e  Windows; open a new terminal afterwards

Get the code

$ git clone https://github.com/ThatOvidiu/zenviewer.git
$ cd zenviewer

The same two commands on Windows. Then build and install as described below.

Update it later

$ cd zenviewer
$ git pull                                   fetch the latest code
$ cmake --build --preset release             Linux: rebuild
$ sudo cmake --install linux/release/build   and install again
> .\windows\build.bat                        Windows: rebuild

The code on GitHub can be newer than the release archive and the downloads. Use --prefix ~/.local without sudo if you installed it only for you.

Linux

You need CMake 3.21 or newer, Ninja, a C++20 compiler and Qt 6.4 or newer. Ubuntu 24.04, Debian 12, Fedora, openSUSE and Arch have all of it. Ubuntu 22.04 only has Qt 6.2: use the bundle there instead.

1. Install what the build needs

Debian, Ubuntu

$ sudo apt install build-essential cmake ninja-build qt6-base-dev qt6-image-formats-plugins libqt6svg6

Fedora

$ sudo dnf install gcc-c++ cmake ninja-build qt6-qtbase-devel qt6-qtimageformats qt6-qtsvg

openSUSE

$ sudo zypper install gcc-c++ cmake ninja qt6-base-devel qt6-imageformats libQt6Svg6

Arch

$ sudo pacman -S --needed base-devel cmake ninja qt6-base qt6-imageformats qt6-svg

The image-format and SVG packages are what let ZenViewer open WebP, TIFF and SVG files. The build works without them, but those files won't open.

2. Build

$ cmake --preset release                           configure: -O3 and link-time optimization
$ cmake --build --preset release                   compile
$ ./linux/release/build/zenviewer path/to/images   try it before installing

Add -DZENVIEWER_LTO=OFF to the first command to build without link-time optimization.

3. Install

$ sudo cmake --install linux/release/build                for everyone, in /usr/local
$ cmake --install linux/release/build --prefix ~/.local   or only for you, without sudo

This installs the zenviewer command, the app menu entry and the icons. To remove them again: sudo xargs rm < linux/release/build/install_manifest.txt (without sudo for the ~/.local install).

Tested from a fresh system on Ubuntu 24.04, Debian 12, Fedora, openSUSE and Arch.

The bundle optional

$ linux/bundle/build.sh   needs Podman or Docker

Builds the same folder as the bundle download, with its own Qt, in an Ubuntu 22.04 container, so it also runs where Qt 6.4 isn't available. It needs Podman or Docker and a few GB of free disk space, but none of the packages from step 1. The first run compiles Qt, which takes a while. The result is linux/bundle/build/out/zenviewer-0.7.0-linux-x86_64.tar.gz.

Windows

For 64-bit Windows 10 or 11.

1. Install what the build needs

  1. Visual Studio Build Tools 2022 or 2026 (or Visual Studio Community) with the Desktop development with C++ workload. It brings the MSVC compiler, the Windows SDK, CMake and Ninja.
  2. Qt 6.5 or newer, from the Qt Online Installer. Under Qt → Qt 6.12.0 pick MSVC 2022 64-bit, and under Additional Libraries Qt Image Formats.

2. Build

> .\windows\build.bat   from the zenviewer folder

It finds Visual Studio and builds the app into windows\build: zenviewer.exe with the Qt and Microsoft DLLs in its dll folder. That folder is the whole app, apart from scripts: zip it without scripts, or copy it, to any 64-bit Windows 10 or 11 PC.

If Qt isn't in C:\Qt\6.12.0\msvc2022_64, run set QT_DIR=C:\path\to\Qt\6.x\msvc2022_64 first (in PowerShell: $env:QT_DIR = "C:\path\to\Qt\6.x\msvc2022_64"). .\windows\build.bat clean starts over.