- C++11 compiler which is supported by the Qt SDK.
- Qt tools such as
moc
and the resource packer. CMake
orQmake
to generate the build scripts. For builds I recommend CMake, and Qmake is mainly used as a Qt Creator project.- SDK for
Qt5
orQt6
. Note that with Qt6 you need an additionalCore5Compat
module. - The CHMLib library for handling chm files. You can choose dynamic or static linking. In the first case, you need a library and headers for development. In the second case you need to download the repository submodule and specify
USE_STATIC_CHMLIB
flag when generating the build script. - The libzip library and headers for software development. When building this library from source you will need the zlib library.
- I recommend using Git to retrieve the source code. Although you can download and unpack the archive with the sources, this option is not covered here. Also, Git is more convenient if you want to use a submodule with CHMLib.
- GNU Gettext is required to translate the user interface.
- KDELibs4Support and ECM to build with KDE support.
Use the git clone
command to retrieve the sources. If you need static linking to CHMLib, use --recursive
options to download the CHMLib submodule.
# Getting the repository together with the submodule
# and switching to the release branch
git clone --recursive https://github.com/eBookProjects/uChmViewer
A modern cmake generates an build system script and also can be used as a build and installation driver.
# Generate build system
cmake [<options>] ../
# Bbilding mode
cmake --build . [<options>]
# Installation mode
cmake --install . [<options>]
-
-G
- specifies a build system generator. This option is not necessary when using the default toolkit. -
--install-prefix <prefix>
- specifies a root folder for install application. By defaults to/usr/local
on UNIX andc:/Program Files/uchmviewer
on Windows. Note, that the installation prefix can be overridden when CMake is run in installation mode (cmake --install
) with the--prefix
option. Cpack ignores the installation prefix. -
-D <var>=<value>
- specifies the initial value of the CMake script variable.Project-specific variables
USE_KF5=<ON | OFF>
- build application with KDE support.USE_STATIC_CHMLIB=<ON | OFF>
- choosing static linking with CHMLib, default isOFF
. For static linking, the library is compiled from source in thelib/CHMLib
folder. This folder can be obtained along with the sources of the application using the commandgit clone --recursive
.USE_WEBENGINE=<ON | OFF>
- choosing WebEngine instead of WebKit, default isOFF
. WebEngine requires Qt version 5.9 or higher.USE_GETTEXT=<ON | OFF>
- enabling translation of the application, default isON
. If Gettext is not available, this option will be ignored.USE_DEPLOY_RUNTIME=<ON | OFF>
- copying runtime dependencies for deployment, default isOFF
.USE_MACOS_BUNDLE=<ON | OFF>
- install as macOS bundle, default isON
.USE_MAC_APP=<ON | OFF>
- use derived QApplication, default toON
on macOS.USE_DBUS=<ON | OFF>
- use D-Bus integration, default toON
on Linux.chmlib_ROOT=<path/to/chmlib>
- specifies an additional folder to look up the library and headers for CHMLib. Thechm_lib.h
file is expected either in the root folder or theinclude
folder. Thechm
library must be either in the root folder or in thelib
folder.libzip_ROOT=<path/to/libzip>
- specifies an additional folder to look up the library and headers for libzip. Thezip.h
file is expected either in the root folder or theinclude
folder. Thezip
library must be either in the root folder or in thelib
folder.
CMake-specific variables
CMAKE_PREFIX_PATH=<path/to/qt>
is the path to the Qt development package if it is simply unpacked or builds without installation. In my case, Qt version 5.5 is in /home/user/Qt and I use-DCMAKE_PREFIX_PATH=~/Qt/5.5/gcc
.CMAKE_BUILD_TYPE=<Debug | Release | RelWithDebInfo | MinSizeRel>
For example, configure cmake to build which Qt 5.15 and WebEngine
cmake -DCMAKE_PREFIX_PATH=~/Qt/5.15/gcc -DUSE_WEBENGINE=ON ../
CMake comes with a cpack
utility for generating installers. The build scripts have basic cpack
support, but in some cases additional options and variables may need to be specified. The generator must be specified in any case.
In GNU/Linux with package manager DEB-based you need the following packages and their dependencies:
build-essential
cmake
git
libzip-dev
libqt5webkit5-dev
orqtwebengine5-dev
libkf5kdelibs4support-dev
if you choose build with KDE support.libchm-dev
gettext
apt install build-essential cmake git libzip-dev libchm-dev\
gettext libqt5webkit5-dev
git clone --recursive https://github.com/eBookProjects/uChmViewer
mkdir uchmviewer/build
cd uchmviewer/build
cmake -DCMAKE_BUILD_TYPE=Release ../
cmake --build . --config Release
# Optional generate package
cpack -G DEB -DCPACK_DEBIAN_PACKAGE_SHLIBDEPS=ON
apt install build-essential cmake git libzip-dev libchm-dev\
gettext qtwebengine5-dev
git clone --recursive https://github.com/eBookProjects/uChmViewer
mkdir uchmviewer/build
cd uchmviewer/build
cmake -DCMAKE_BUILD_TYPE=Release -DUSE_WEBENGINE=ON ../
cmake --build . --config Release
# Optional generate package
cpack -G DEB -DCPACK_DEBIAN_PACKAGE_SHLIBDEPS=ON
apt install build-essential cmake git libzip-dev libchm-dev\
gettext libqt5webkit5-dev libkf5kdelibs4support-dev
git clone --recursive https://github.com/eBookProjects/uChmViewer
mkdir uchmviewer/build
cd uchmviewer/build
cmake -DCMAKE_BUILD_TYPE=Release -DUSE_KF5=ON ../
cmake --build . --config Release
# Optional generate package
cpack -G DEB -DCPACK_DEBIAN_PACKAGE_SHLIBDEPS=ON
The project options for qmake are the similar to those for cmake.
USE_STATIC_CHMLIB=1
if defined, use static CHMLib from git submodule.USE_WEBENGINE=1
if defined, use QtWebEngine.CHMLIB_ROOT=<path/to/chmlib>
folder to look up the library and headers for CHMLib.LIBZIP_ROOT=<path/to/libzip>
folder to look up the library and headers for libzip.