Skip to content

Latest commit

 

History

History
242 lines (169 loc) · 7.34 KB

build.md

File metadata and controls

242 lines (169 loc) · 7.34 KB

Table of Contents

Build options

You can choose to install the library as a CMake Package or embed it into your project as a git submodule.

Standalone (CMake package)

Get the libVDA5050++ source code

Clone the libVDA5050++ Project

git clone git@git.openlogisticsfoundation.org:silicon-economy/libraries/vda5050/libvda5050pp.git

Checkout dev branch in "libvda5050pp" folder if you want to continue with development, otherwise skip this step and continue with master branch

git checkout dev 

Configuring the build

The libVDA505++ comes with some extra components (see extra/ directory). These components can be enabled/disabled at will.

The default configuration is achieved by running the following command inside of the libVDA5050++ project root:

cmake -Bbuild -DCMAKE_BUILD_TYPE=Release \ 
      -DCMAKE_CXX_COMPILER=/usr/bin/clang++-10 \
      -DBUILD_DOCS=ON \ # enable documentation
      -DBUILD_TESTING=ON  # enable testing

If paho was installed in a non-default location, you need to specify it's install path with -DCMAKE_PREFIX_PATH=<path>. Optionally setup a custom install path with -DCMAKE_INSTALL_PREFIX=<path>.

Available extra components can be enabled via:

  • MQTTConnector (needs JSON_MODEL): -DUSE_EXTRA_MQTT_CONNECTOR=ON
  • JSON_MODEL: -DUSE_EXTRA_JSON_MODEL=ON
  • LoggerUtils: -DUSE_EXTRA_LOGGER_UTILS=ON

Building/Installing

Build:

cmake --build build --target all

Test:

Run the following command from inside of the build/ directory:

ctest

Install

(may need to be run as privileged user)

cmake --build build --target install

Build the documentation

cmake --build build --target mkdocs

view it by running mkdocs serve inside of the build/ directory.

Include the library from within your CMake project

Once installed, you can locate the library via CMake's find_package command:

find_package(libvda5050++ "1.0" REQUIRED COMPONENTS
  # uncomment the desired components
  # since mqtt_connector depends on json_model, make sure to import put json_model before

  # json_model
  # mqtt_connector
  # logger_utils
)

All exported targets are prefixed with the libvda5050++:: namespace:

  • libvda5050++::vda5050++ the main library
  • libvda5050++::mqtt_connector extra component
  • libvda5050++::json_model extra component
  • libvda5050++::logger_utils extra component

Your CMakeLists.txt may contain the following lines:

find_package(libvda5050++ "1.0" REQUIRED COMPONENTS
  json_model
  mqtt_connector
)
add_executable(MY_APP main.cpp)
target_link_libraries(MY_APP PUBLIC
  libvda5050++::vda5050++
  libvda5050++::mqtt_connector
)

Integration into an existing project (Git Submodule)

Setup the Git Submodule

In this tutorial we assume you have a third party folder for third party software you use in your project. If you have another file structure replace the third_party folder in the commands with your file structure.

To add the libVDA5050++ as a submodule to your project execute the following command. Notice that your project must already be a git project!

git submodule add git@git.openlogisticsfoundation.org:silicon-economy/libraries/vda5050/libvda5050pp.git third_party

To download the added submodule to your project execute the following command:

git submodule update --init --recursive

For more information about git submodules visit the official Git Submodule Documentation.

To Process how to integrate the submodule to your Cmake Project is described in the Quick Start Guide

Configuring CMakeLists.txt

Select components

The libVDA505++ comes with some extra components (see extra/ directory). These components can be enabled/disabled at will. To enable some extra targets, you need to add a selection of the following lines to your top-level CMakeLists.txt before the add_subdirectory command in the next step.

set(USE_EXTRA_MQTT_CONNECTOR ON) # enable mqtt_connector target
set(USE_EXTRA_JSON_MODEL ON) # enable json_model target
set(USE_EXTRA_LOGGER_UTILS ON) # enable logger_utils target

Include the subdirectory

Add the following cmake commands to your top-level CMakeLists.txt:

With CMake, you can directly include the libvda5050++ directory like this:

## Add libvda5050++ subdirectory
add_subdirectory(third_party/libvda5050pp)

Link targets

To link the library with your AGV project, you can depend on the vda5050++ target:

target_link_libraries(${PROJECT_NAME} PUBLIC
  vda5050++
)

NOTE: When including the library as a CMake subdirectory, all targets are not prefixed with libvda5050++::.

Direct build (not recommended)

If you can not include the project via CMake, you can still build it directly.

To build libVDA5050++ together with your project, you need to add the libvda5050pp/include and libvda5050pp/third_party/SimplePTN/include folder to your include path. All sources in libvda5050pp/src have to be built. For the main sources, the only library used is the STL (c++17). Note: the project requires c++17 language features.

Documentation

For viewing the documentation inside your browser, it's necessary to install mkdocs.

Without Code Documentation

Inside of the project root folder run:

mkdocs serve

You can now view the documentation in your browser.

To recompile the diagrams, run docs/diagrams/generate.sh

With Code Documentation

Install mkdocs and doxygen, then run the mkdocs build target inside of the build folder:

cmake --build build --target mkdocs

Make sure the build was configured with BUILD_DOCS=ON. See Configuring the build.

PROJECT_ROOT/build/site now contains the documentation. After building, the documentation can be served by running the following command inside the build folder:

mkdocs serve

You can now view the documentation in your browser.