Skip to content
Dovydas Girdvainis edited this page Apr 23, 2020 · 3 revisions

Cmake configuration

Since open62541 project has a vast array of CMake Options that control the compiled features developers need a way to easily set them without interfacing with the console each time a change to CMake configuration is required, their are multiple ways of achieving this, we will cover a few of them here.

Using Settings.json

Still documenting

Using Tasks.json

Still documenting

Using CMake Variants

Requirements

Download the file cmake-variants.yaml and save it in your project under .vscode/ directory. Then use your Command Pallet to call a new task CMake: Select Variant, this will prompt you to choose a configuration from a list. To narrow down the selections, you can type the chosen settings.

CMake Variant Support for Visual Studio Code

Supported options

Due to limitations with CMake Tools Variant we reduced the available options to the following:

  • buildType
    • Debug - sets UA_DEBUG, UA_BUILD_UNIT_TESTS, UA_ENABLE_COVERAGE, UA_ENABLE_DETERMINISTIC_RNG, UA_ENABLE_UNIT_TESTS_MEMCHECK
    • RelWithDebInfo
    • Release
    • MinSizeRel
  • historization
    • noHistory
    • Simple-History - UA_ENABLE_HISTORIZING
    • Expmntl-History - UA_ENABLE_EXPERIMENTAL_HISTORIZING
  • subscription
    • Subs - UA_ENABLE_SUBSCRIPTIONS
    • Subs-And-Events - UA_ENABLE_SUBSCRIPTIONS, UA_ENABLE_SUBSCRIPTIONS_EVENTS
    • noSubs
  • multithreading
    • Singlethread
    • Multithread - UA_ENABLE_MULTITHREADING
    • Multithread-Immutable - UA_ENABLE_MULTITHREADING, UA_ENABLE_IMMUTABLE_NODES *discovery
    • LDS - UA_ENABLE_DISCOVERY
    • LDS-ME - UA_ENABLE_DISCOVERY, UA_ENABLE_DISCOVERY_MULTICAST
    • noDiscovery
  • encription
    • noEncript
    • mbedTLS - UA_ENABLE_ENCRYPTION, UA_ENABLE_ENCRYPTION_MBEDTLS
    • openssl - UA_ENABLE_ENCRYPTION, UA_ENABLE_ENCRYPTION_OPENSSL
  • pub_sub
    • No-Pub/Sub
    • Eth-Pub/Sub - UA_ENABLE_PUBSUB, UA_ENABLE_PUBSUB_ETH_UADP
    • EthXDP-Pub/Sub - UA_ENABLE_PUBSUB, UA_ENABLE_PUBSUB_ETH_UADP_XDP
    • EthETF-Pub/Sub - UA_ENABLE_PUBSUB, UA_ENABLE_PUBSUB_ETH_UADP_ETF
    • MQTT-Pub/Sub - UA_ENABLE_PUBSUB, UA_ENABLE_PUBSUB_MQTT
  • namespace_zero
    • Minimal
    • Reduced
    • Full
    • micro_emb_profile - UA_NAMESPACE_ZERO="FULL", UA_ENABLE_MICRO_EMB_DEV_PROFILE

Development/Maintenance

It is always possible to expand the given .vscode/cmake-variants.yaml file and add options as needed, however as of current CMake Tools Variant Implementation, we would not recommend it, since already there are 19440 different variations. Furthermore this file is prone to breaking, when the options defined inside CMakeLists.txt are changed, specifically their naming, please make sure that all of he options in this file are defined as it is inside CMakeLists.txt