Skip to content

Commit

Permalink
Update build/usage documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
cneben committed Nov 19, 2023
1 parent ac0e4b8 commit c310c88
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 51 deletions.
102 changes: 52 additions & 50 deletions doc/web/docs/installation.md
Original file line number Diff line number Diff line change
@@ -1,91 +1,93 @@
QuickQanava Quick Start
============================
# QuickQanava Quick Start

Dependencies
------------------
!!! note "Starting from version 2.4.0, QuickQanava is now a fully static library. It is recommended to install it from a Git submodule using CMake."

| Dependency | Mandatory | Included in source tree | Licence |
| --- | :---: | :---: | :---: |
| Google Test/Mock | No | No | Permissive |

- **Google Test** is optional only to build and run tests ![Google Test GitHub](https://github.com/google/googletest).
QuickQanava could be used with either _qmake_ or _CMake_ build configuration system:
- `qmake`: Only for Qt5, to be deprecated soon (20231119, version 2.4.0).
- `CMake`: For both Qt5 and Qt6, can be used trough `add_subdirectory()` or [ExternalProject_Add()](https://cmake.org/cmake/help/latest/module/ExternalProject.html)


## Using from external projects with CMake

Building from sources
------------------
The recommended way of using QuickQanava is to include the library directly as a GIT submodule in your project:

Get the latest QuickQanava sources:
```sh
# Install QuickQanava as a GIT submodule
$ git submodule add https://github.com/cneben/QuickQanava
* git submodule update
```

From your `CMakeLists.txt`:
```sh
git clone https://github.com/cneben/QuickQanava
cd QuickQanava
add_subdirectory(../../)

target_include_directories(my_project PUBLIC QuickQanava Qt${QT_VERSION_MAJOR}::QuickControls2)

target_link_libraries(sample_advanced
QuickQanava
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::QuickControls2
)
```

QuickQanava might also be included in CMake trough [ExternalProject_Add()](https://cmake.org/cmake/help/latest/module/ExternalProject.html) directly from GitHub.


## Using from external projects with qmake

From a `./QuickQanava` git submodule, library could be included directly in your main qmake `.pro` file with the following two #include statements:

```sh
#in your project main .pro qmake configuration file
include($$PWD/QuickQanava/src/quickqanava.pri)
```

QuickQanava could be used with either _qmake_ or _CMake_ build configuration system.

QuickQanava could be used with either _qmake_ or _CMake_ build configuration system.
## Building samples qmake / CMake (development)

| qmake | cmake |
| :---: | :---: |
| Static build, no QML module, all resources are linked statically trough QRC | Installable or embedable, QuickQanava is loaded using a QML module that need to be installed |
With Qt Creator:

Using qmake:
**Using qmake:**

1. Open _quickqanava.pro_ in QtCreator.

2. Select a kit, build and launch samples.

or (CMake > 3.5)
**Using CMake (CMake > 3.5):**

1. Open _CMakeLists.txt_ in QtCreator.

2. In 'Projects' panel, set DQUICK_QANAVA_BUILD_SAMPLES option to true in CMake configuration panel.
2. for testing purposes, in 'Projects' panel, set DQUICK_QANAVA_BUILD_SAMPLES option to true in CMake configuration panel.

3. Select a kit, build and launch samples.

Or manually using CMake:

Or build manually using CMake (CI):

```sh
$ cd QuickQanava
$ mkdir build
$ cd build

# IF QT_DIR IS CONFIGURED AND QMAKE IN PATH
$ cmake -DCMAKE_BUILD_TYPE=Release -DQUICK_QANAVA_BUILD_SAMPLES=TRUE ..
$ cmake -DCMAKE_BUILD_TYPE=Release -DQUICK_QANAVA_BUILD_SAMPLES=FALSE ..

# IF QT DIR IS NOT CONFIGURED, CONFIGURE KIT MANUALLY
$ cmake -DCMAKE_PREFIX_PATH="/home/b/Qt/5.11.0/gcc_64" -DQT_QMAKE_EXECUTABLE="/home/b/Qt/5.11.0/gcc_64/bin/qmake" -DQUICK_QANAVA_BUILD_SAMPLES=TRUE ../QuickQanava/
$ cmake -DCMAKE_PREFIX_PATH="/home/b/Qt/5.15.14/gcc_64" -DQT_QMAKE_EXECUTABLE="/home/b/Qt/5.15.14/gcc_64/bin/qmake" -DQUICK_QANAVA_BUILD_SAMPLES=FALSE ../QuickQanava/

$ cmake --build .
# Then run the samples in ./samples

# Eventually make install
```


Note that a previously installed "QML plugin" version of QuickQanava might interfere with a fully static build using direct .pri inclusion. Typical error message looks like:

```
QQmlApplicationEngine failed to load component
qrc:/nodes.qml:33 module "QuickQanava" plugin "quickqanavaplugin" not found
# There is no make install
```

QuickQanava and QuickContainers plugins directories could be removed manually from `$QTDIR\..\qml` to fix the problem (ex: rm -rf '~/Qt/5.11.1/gcc_64/qml/QuickQanava').
## Dependencies

| Dependency | Mandatory | Included in source tree | Licence |
| --- | :---: | :---: | :---: |
| Google Test/Mock | No | No | Permissive |

Using from external projects
------------------

The recommended way of using QuickQanava is to include the library directly as a GIT submodule in your project:

```sh
# Install QuickQanava as a GIT submodule
$ git submodule add https://github.com/cneben/QuickQanava
* git submodule update
```

Once GIT has finished downloading, QuickQanava project file could be included directly in your main qmake .pro file with the following two #include statements:
- **Google Test** is optional only to build and run tests ![Google Test GitHub](https://github.com/google/googletest).

```sh
#in your project main .pro qmake configuration file
include($$PWD/QuickQanava/src/quickqanava.pri)
```
2 changes: 1 addition & 1 deletion doc/web/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repo_name: 'GitHub'
repo_url: 'https://github.com/cneben/QuickQanava'
edit_uri: ""

copyright: 'Copyright © 2022 BA'
copyright: 'Copyright © 2023 BA'
use_directory_urls: false

theme:
Expand Down

0 comments on commit c310c88

Please sign in to comment.