Build
If you are a Gnu/Linux user I strongly recommend to install QJson using your package manager. QJson packages are available for all the major distributions.
OSX users can install QJson using mac ports or homebrew.
QJson source code can be downloaded from its Github page.
Requirements
QJson requires:
- Qt 4.0 or greater
- cmake 2.6 or greater
Some possible cmake options:
-DCMAKE_BUILD_TYPE=DEBUG
: enables some debug output (other than making easier to debug the code)-DQJSON_BUILD_TESTS=yes
or-DKDE4_BUILD_TESTS=yes
: builds the unit tests-DCMAKE_INSTALL_PREFIX=${HOME}/testinstall
: install qjson in a custom directory-DCMAKE_INCLUDE_PATH=${HOME}/testinstall/include
: include a custom include directory-DCMAKE_LIBRARY_PATH=${HOME}/testinstall/lib
: include a custom library directory-DLIB_DESTINATION=lib64
: if you have a 64 bit system with separate libraries for 64 bit libraries-DQJSON_VERBOSE_DEBUG_OUTPUT:BOOL=ON
: more debugging statements are generated by the parser. It’s useful only if you are trying to fix the bison grammar.
Unix
For Unix/Linux/Mac:
1 2 3 4 5 6 |
|
Windows
Note well: these instructions can be outdated, I do not have a Windows machine and I’m not really into Windows development.
Patches and documentation related to Windows are welcome.
This guide assumes you are using MinGW.
The CLI way
After having installed both Qt and cmake add the following line at the end of
qtenv.bat
(it can be found under C:\Qt\qt_version\bin
):
1
|
|
Open the “Qt Command Prompt”, go to the directory containing QJson’s sources and do:
1 2 3 4 5 |
|
Now you will find libqjson.dll
under the build\lib
directory.
The GUI way
The Qt Creator IDE can handle cmake-based projects.
In addition to the Qt Windows SDK you have to download and install the Qt Creator IDE.
Then follow these steps:
- Start Qt Creator.
- Select: File → Open file or project.
- Go to the directory containing QJson’s sources.
- Open the
CMakeLists.txt
file. - Open the Projects tab and ensure the build directory points to the path where qjson source code is located.
- Select: Build → Build all.
At the end of the build you will find the .dll file under the lib folder.
Symbian
Let’s face the truth: Symbian is a dead platform. I know someone succeeded in building QJson on Symbian, but he never provided a detailed guide.
I have no experience with Symbian, hence I cannot offer help/support.
As usual patches and documentation are welcome.
QMake
Sometimes ago I created a bunch of .pro
files that allowed to build QJson using qmake.
This revealed to be a poor choice, since I had to support two build systems.
Moreover these .pro
files were being used only by Windows developers who didn’t
want to install cmake.
These .pro
files have been removed from git with commit
66d10c44dd3b21.
You can always retrieve them from git history if you miss them; just keep in mind
I won’t provide support.