Skip to content

Latest commit

 

History

History
199 lines (128 loc) · 6.54 KB

HowToBuild.md

File metadata and controls

199 lines (128 loc) · 6.54 KB

How to build

Since I was told before that it is hard to understand how to build from this source code, I wrote this document.

With GPLv 3, if you have cloned this source code, the freedom of building it yourself is guaranteed. So please build it if you are interested in this application.

If you have something you do not recognize or aware of by way of building, please send me an e-mail or open an issue in the project's page.

1. Setup

Set Up Qt SDK

You should install Qt SDK on your PC.

https://www.qt.io/download-open-source/

Set up the source

Clone the repo and submodules

$ git clone https://github.com/kanryu/quickviewer

$ cd quickviewer
$ git submodule init

$ git submodule update

2. Make a project to build

Note: For Linux builds linuxdeployqt and appimagetool are required.

For QtCreator

QuickViewer is developed with QtCreator. So you just need to have QtCreator to load the QVProject.pro.

If you have setup Qt SDK as 'msvc2015' or 'msvc2015_64', distribution package will be automatically generated by running "jom install".

Switch to the Projects tab, and select Add Build Step -> Make. Type "install" into Make arguments:.

For command line builders

$ cd ../
$ mkdir build
$ cd build
$ [QTSDK]/bin/qmake -o Makefile -recursive ../quickviewer/QVProject.pro

Makefile for compiler will be generated to build QuickViewer. All you have to do is build it with that Makefile.

MinGW

$ mingw32-make
$ mingw32-make install
(created QuickViewer distribution)

VisualStudio2015

You need nmake instead of MinGW make. Of course there are distinct versions: x86 / x64.

$ [amd64]/vsvars64.bat
$ nmake
$ nmake install
(created QuickViewer distribution)

For Visual Studio 2015

Normal project generation method consist of following steps:

  1. Install VisualStudio2015Community, QtSDK(msvc2015 or msvc2015_64), QtVSTools
  2. Select menu [Qt VS Tools] -> [Open Qt Project File(.pro)]
  3. Select QVProject.pro

However, I think it would be better to run qmake in the command line. With this method it is hard to make a mistake:

$ cd ../
$ mkdir build
$ cd build
$ [QTSDK]/bin/qmake  -tp vc ..\quickviewer\QVProject.pro -recursive QMAKE_INCDIR_QT=$(QTDIR)\include QMAKE_LIBDIR=$(QTDIR)\lib QMAKE_MOC
=$(QTDIR)\bin\moc.exe QMAKE_QMAKE=$(QTDIR)\bin\qmake.exe

If you debug the x64 version of QuickViewer, you may encounter an error that QtCored.dll is missing. In this case, drag and drop of the "QuickViewer.exe" which you built onto [QtSDK]/bin/windeployqt.exe will copy required DLLs.

3. Directory structure at time of build

You can find the directories in the build directory named e.g. 'build-QVproject-Desktop_Qt_5_7_1_MSVC2015_64bit-Debug' after building completed. (VisualStudio won't make [build])

  • bin
  • lib
  • (each sub projects)

lib has static libraries built from each subproject.

bin has executable programs built from each subproject.

To experience all the functions of QuickViewer, please do following:

$ cd [build]/bin
$ ln -s ../../quickviewer/QuickViewer/database database
$ ln -s ../../quickviewer/QuickViewer/shaders shaders
$ ln -s ../../quickviewer/QuickViewer/translations translations

4. Directory structure at runtime

For Windows

  • [database]
    • SQLite database which contains Catalogs and thumbnails
  • [shaders]
    • Fragment Shaders for image resizing (obsolete)
  • [translations]
    • multi-language qm files
  • QuickViewer.exe
    • Application main
  • AssociateFilesWithQuickViewer.exe
    • Set the association of image formats with UAC
  • quickviewer.ini
    • Main configuration file. Includes keyboard and mouse settings
  • progress.ini
    • Record the last displayed image in volume.

For Linux (.AppImage)

Note: For Linux builds linuxdeployqt and appimagetool are required.

  • [QuickViewer-XXX-AppDir]
    • Base directory making up AppImage    - It is extracted on /tmp at runtime
  • [AppDir/usr/bin]
    • Destination of executable installation
  • [AppDir/usr/lib]
    • Destination of shared libraries installation
  • [AppDir/translations]
    • Destination of multi-language qm files, and languages.ini
  • AppDir/QuickViewer.desktop
    • open desktop configulation
  • $HOME/.quickviewer/quickviewer.ini
    • Main configuration file. Includes keyboard and mouse settings
  • $HOME/.quickviewer/progress.ini
    • Record the last displayed image in volume
  • $HOME/.quickviewer/thumbnail.sqlite3.db
    • SQLite database which contains Catalogs and thumbnails.

AppDir/usr/bin/qt.conf is currently not used.

Successfully built example (not .AppImage) may be found here.

5. Selection of rendering method

QuickViewer renders images primarily in three ways:

  1. Standard rendering method of each OS
    • on Windows, it is Windows GDI
  2. OpenGL
  3. Direct2D

If you want to use QuickViewer with OpenGL, you need to comment out the QV_WITHOUT_OPENGL switch in QuickViewer.pro.

I read a document that Windows GDI doesn't use hardware acceleration in Windows Vista and later, but in bilinear interpolation drawing of 2D graphics, there is no difference from GPU and it is not necessary to transfer it to drawing texture, so it is even faster.

Direct2D is implemented as a QPA plugin, and rendering method is automatically changed when plug-in is enabled at application startup.

Although it was not tested yet, in other OSs it should be possible to change the drawing method by other QPAs.

6. Portable or System Standards

There will be different opinions whether an application should be able to start on any PC from your USB flash drive or as a part of the system of the PC.

In QuickViewer, QV_PORTABLE in QVproject.pri makes possible to select these two policies.

When QV_PORTABLE is defined, it becomes an application that can copy to your USB flash drive. Would you like to store data files such as .ini files and .DBs in the same drive as much as possible? For Linux and Mac, they are output as .AppImage, .dmg respectively.

If not, QuickViewer will be built as an application embedded in the system. On Windows it will be installed into "C:\Program FIles". On Linux it will be /usr/local/bin. That may be executed with the system-specific shared libraries (e.g. 7z).

Enjoy! :)