Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.11)
cmake_minimum_required(VERSION 3.13)

cmake_policy(SET CMP0077 NEW) # new in 3.13. The NEW behavior of this policy is that option() keeps a normal variable set by the parent project, such as BUILD_SHARED_LIBS.
cmake_policy(SET CMP0072 NEW) # new in 3.11. The NEW behavior for this policy is to set OpenGL_GL_PREFERENCE to GLVND.
cmake_policy(SET CMP0068 NEW) # new in 3.9. The NEW behavior of this policy is to ignore the RPATH settings for install_name on macOS.

Expand Down
5 changes: 4 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Dependencies
------------

* Qt >5.15
* CMake 3.11
* CMake 3.13
* Catch2


Expand Down Expand Up @@ -128,6 +128,9 @@ For building a static lib use:

cmake .. -DBUILD_SHARED_LIBS=off

See the "Shared and static library" section of the installation docs
(``docs/getting-started/installation.rst``) for what the library defines and what to avoid.

Linux
-----

Expand Down
6 changes: 6 additions & 0 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ Ensure you're using the correct build type:
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release

**Error "Cannot link against shared and static simultaneously"**

Your target defines ``NODE_EDITOR_STATIC`` or ``NODE_EDITOR_SHARED`` by hand. QtNodes already
defines the right one for you. Remove your definition and choose the type with
``BUILD_SHARED_LIBS``. See :doc:`getting-started/installation`.

Performance Questions
---------------------

Expand Down
42 changes: 36 additions & 6 deletions docs/getting-started/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Requirements

- **Qt** 5.15+ or Qt 6.x
- **Qt SVG module** (for processing status icons)
- **CMake** 3.11+
- **CMake** 3.13+
- **C++ Compiler** with C++17 support (GCC 7+, Clang 5+, MSVC 2019+)
- **Catch2** (optional, for running tests)

Expand Down Expand Up @@ -58,13 +58,15 @@ CMake Options
- Build with Qt6. Set to ``OFF`` for Qt5.
* - ``BUILD_SHARED_LIBS``
- ``ON``
- Build as shared library. Set to ``OFF`` for static.
- Build as shared library. Set to ``OFF`` for static. See
`Shared and static library`_.
* - ``BUILD_TESTING``
- ``ON``
- Build unit tests. Requires Catch2.
- ``ON`` or ``OFF``
- Build unit tests. Requires Catch2. ``ON`` when QtNodes is the top-level project, ``OFF``
when it is added with ``add_subdirectory``.
* - ``BUILD_EXAMPLES``
- ``ON``
- Build example applications.
- ``ON`` or ``OFF``
- Build example applications. Same default as ``BUILD_TESTING``.

**Examples:**

Expand All @@ -79,6 +81,32 @@ CMake Options
# Skip tests (if Catch2 not installed)
cmake .. -DBUILD_TESTING=OFF

Shared and static library
-------------------------

Choose the library type with ``BUILD_SHARED_LIBS``. The default is ``ON`` (shared).

.. code-block:: bash

cmake .. -DBUILD_SHARED_LIBS=OFF

- QtNodes defines ``NODE_EDITOR_SHARED`` or ``NODE_EDITOR_STATIC`` for you. The definition is
public, so your target gets it when you link ``QtNodes::QtNodes``. This works with
``add_subdirectory`` and with ``find_package``. In an installed package the choice is fixed
by the build that you installed.
- Do not define ``NODE_EDITOR_SHARED``, ``NODE_EDITOR_STATIC`` or ``NODE_EDITOR_EXPORTS``
yourself. If both ``SHARED`` and ``STATIC`` are defined, the compiler stops with
``Cannot link against shared and static simultaneously.``
- A static QtNodes does not make Qt static. QtNodes links Qt ``Core``, ``Widgets``, ``Gui`` and
``OpenGL`` publicly, so your application still needs Qt.
- With ``add_subdirectory`` or ``FetchContent``, set ``BUILD_SHARED_LIBS`` before QtNodes is
added. A plain ``set()`` works. The cache form and ``-DBUILD_SHARED_LIBS=OFF`` work too.

.. code-block:: cmake

set(BUILD_SHARED_LIBS OFF)
add_subdirectory(external/nodeeditor)

Using vcpkg
-----------

Expand Down Expand Up @@ -109,6 +137,8 @@ After running ``cmake --install .``:
find_package(QtNodes REQUIRED)
target_link_libraries(your_app QtNodes::QtNodes)

If you installed to a custom prefix, pass it with ``-DCMAKE_PREFIX_PATH=<prefix>``.

Verifying Installation
----------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ Tests are built automatically when ``BUILD_TESTING`` is enabled (default).
**Prerequisites:**
- Catch2 testing framework
- Qt6 (or Qt5 with appropriate configuration)
- CMake 3.8+
- CMake 3.13+

**Configuration:**

Expand Down
Loading