![]() |
JKQTPlotter
an extensive Qt5 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
|
This page explains how to build JKQTPlotter and to use the results in your own Projects.
The preferred way to build JKQTPlotter is using CMake. You can find a detailed explanation of CMake at https://cliutils.gitlab.io/modern-cmake/. The CMake-build is defined in CMakeLists.txt
files, found in many of the directories of the code repository. Especially in the root directory and the two subdirectories ./lib/ and
./examples/ .
You can build JKQTPlotter (and also the examples) by either opening the file CMakeLists.txt in QTCreator (which has CMake integration), or by calling CMake
by hand. How to do this depends on your local system und build environment.
You can use (MinGW) Makefiles by calling:
For Visual Studio it could look like this:
Where <path_to_your_qt_sources> could be e.g.
C:/development/Qt5/5
.12.0/msvc2017_64 . This call results in a Visual Studio solution build/JKQTPlotter.sln
that you can load and compile from the Visual Studio IDE. Alternatively you can also build the solution directly calling:
Afterwards you can install the library by
The CMake build system offers several configuration variables that you may set/change to modify the outcome of the build:
CMAKE_PREFIX_PATH
: add the path to your Qt installatrion to this variable, so the find_package(Qt5...)
commands find the libraries you want to useJKQtPlotter_BUILD_SHARED_LIBS
: Build as shared library (default: ON
)JKQtPlotter_BUILD_STATIC_LIBS
: Build as static library (default: ON
)JKQtPlotter_BUILD_INCLUDE_XITS_FONTS
: Include XITS fonts as resources in library (default: ON
)JKQtPlotter_BUILD_DECORATE_LIBNAMES_WITH_BUILDTYPE
: If set, the build-type is appended to the library name (default: ON
)JKQtPlotter_BUILD_EXAMPLES
: Build examples (default: ON
)CMAKE_INSTALL_PREFIX
: Install directory for the libraryAfter building and installing JKQTPlotter you have all files that you need inside the instal directory:
<INSTALLDIR>/include contains all required header files
<INSTALLDIR>/bin contains the shared libraries
<INSTALLDIR>/lib contains the link libraries
<INSTALLDIR>/lib/cmake contains files necessary for CMake's find_package()
to workYou can find an example project that uses a complete cmake-build here: Example (JKQTPlotter): CMake Example (online: https://github.com/jkriege2/JKQtPlotter/blob/master/examples/cmake_link_example).
Here is the CMakeLists.txt
from that directory:
To build this example, you first need to make a subdirectory build
and then call CMake form that subdirectory:
The you can use the generated makefiles (e.g. load them in an editor, or build them jsing make
). In the last line above, you need to specify two directories:
<path_to_your_qt_sources> points to you Qt installation<path_to_lib/cmake_dir_of_JKQTPLOTTER>
points to the directory containing the XYZ.cmake
-files from the JKQTPlotter build. Typically this is
<JKQTPLOTTER_INSTALL_DIR>/lib/cmake , where
<JKQTPLOTTER_INSTALL_DIR> is the directory into which you installed JKQTPlotter.If you want to simply include the JKQTPlotter Source code into your projects, without build a shared or static library and linking against it, you can use one of these QMake-Include files:
In your QMake-projects it is then sufficient to add a line like:
There are several .PRO
-files, that can be used to build the full library, or a limited subsets of it as static link library:
They will produce a static link library that you can include into your projects, e.g. with the following QMake-snippet:
This snippet assumes that you built the libraries with the provided .PRO
-files. You can also add a second .pro
-file to your projects, which integrates both as subdirs. Such files are used for all examples in this project. Here is an example:
There are several .PRO
-files, that can be used to build the full library, or a limited subsets of it as shred library:
They will produce a dynamic link library that you can include into your projects, e.g. with the following QMake-snippet:
This snippet assumes that you built the libraries with the provided .PRO
-files. You can also add a second .pro
-file to your projects, which integrates both as subdirs. Such files are used for all examples in this project. Here is an example:
make install
before running your executable, so the shared libararies are actually copied to the output directory (see INSTALLS + ...
above).