diff --git a/.azure-pipelines/azure-pipelines-dist.yml b/.azure-pipelines/azure-pipelines-dist.yml
index de12655b011..9b07fb6b54c 100644
--- a/.azure-pipelines/azure-pipelines-dist.yml
+++ b/.azure-pipelines/azure-pipelines-dist.yml
@@ -5,7 +5,7 @@ jobs:
- job: 'dist_debian'
displayName: 'Dist (debian)'
pool:
- vmImage: 'ubuntu-18.04'
+ vmImage: 'ubuntu-20.04'
steps:
- checkout: self
submodules: recursive
diff --git a/.azure-pipelines/azure-pipelines-linux.yml b/.azure-pipelines/azure-pipelines-linux.yml
index 4240cfcae6d..6625754ea2f 100644
--- a/.azure-pipelines/azure-pipelines-linux.yml
+++ b/.azure-pipelines/azure-pipelines-linux.yml
@@ -5,7 +5,7 @@ jobs:
- job: 'cross_freeRTOS'
displayName: 'Arch (freeRTOS)'
pool:
- vmImage: 'ubuntu-18.04'
+ vmImage: 'ubuntu-20.04'
variables:
IDF_PATH: $(Build.BinariesDirectory)/esp-idf
steps:
diff --git a/.azure-pipelines/azure-pipelines-win.yml b/.azure-pipelines/azure-pipelines-win.yml
index cb1882b5d26..30f5acd8c5f 100644
--- a/.azure-pipelines/azure-pipelines-win.yml
+++ b/.azure-pipelines/azure-pipelines-win.yml
@@ -11,26 +11,13 @@ jobs:
CC_SHORTNAME: VS2019
GENERATOR: Visual Studio 16 2019
FORCE_CXX: OFF
- vcpkg_cache: C:/vcpkg/installed
steps:
- checkout: self
submodules: recursive
- - task: CacheBeta@0
- inputs:
- key: $(Build.SourcesDirectory)/tools/azure-devops/win/install.ps1
- path: $(vcpkg_cache)
- displayName: Cache vcpkg
- powershell: ./tools/azure-devops/win/install.ps1
displayName: Install Requirements
- powershell: ./tools/azure-devops/win/build.ps1
displayName: "Build: $(CC_NAME)"
- - task: PublishBuildArtifacts@1
- inputs:
- PathtoPublish: '$(Build.ArtifactStagingDirectory)'
- ArtifactName: open62541-$(CC_SHORTNAME)
- # publishing artifacts from PRs from a fork is currently blocked
- condition: succeeded()
- displayName: "Publish Artifact: open62541-$(CC_SHORTNAME)"
- job: 'win_msys64'
displayName: 'Windows (msys64)'
@@ -51,13 +38,6 @@ jobs:
- powershell: ./tools/azure-devops/win/build.ps1
displayName: "Build: $(CC_NAME)"
errorActionPreference: continue # If set to Stop, we only get a truncated exception message. Error is handled by checking exit code
- - task: PublishBuildArtifacts@1
- inputs:
- PathtoPublish: '$(Build.ArtifactStagingDirectory)'
- ArtifactName: open62541-$(CC_SHORTNAME)
- # publishing artifacts from PRs from a fork is currently blocked
- condition: succeeded()
- displayName: "Publish Artifact: open62541-$(CC_SHORTNAME)"
- job: 'win_clang'
displayName: 'Windows (clang)'
@@ -78,10 +58,3 @@ jobs:
- powershell: ./tools/azure-devops/win/build.ps1
displayName: "Build: $(CC_NAME)"
errorActionPreference: continue # If set to Stop, we only get a truncated exception message. Error is handled by checking exit code
- - task: PublishBuildArtifacts@1
- inputs:
- PathtoPublish: '$(Build.ArtifactStagingDirectory)'
- ArtifactName: open62541-$(CC_SHORTNAME)
- # publishing artifacts from PRs from a fork is currently blocked
- condition: succeeded()
- displayName: "Publish Artifact: open62541-$(CC_SHORTNAME)"
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 6c905a63a0b..008631185d2 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -9,3 +9,7 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
+ - package-ecosystem: pip
+ directory: /doc
+ schedule:
+ interval: "weekly"
diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml
index 50201b43225..86dea91e0ba 100644
--- a/.github/workflows/build_linux.yml
+++ b/.github/workflows/build_linux.yml
@@ -7,53 +7,103 @@ jobs:
strategy:
fail-fast: false
matrix:
- include:
- - build_name: "Debug Build & Unit Tests (gcc)"
- cmd_deps: sudo apt-get install -y -qq mosquitto
+ os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
+ build:
+ - name: "Debug Build & Unit Tests (gcc)"
cmd_action: unit_tests
- - build_name: "Debug Build & Unit Tests without Subscriptions (gcc)"
- cmd_deps: ""
+
+ - name: "Debug Build & Unit Tests (gcc, 32bit)"
+ cmd_deps: |
+ sudo dpkg --add-architecture i386
+ sudo apt-get update
+ sudo apt-get install -y -qq gcc-multilib libsubunit-dev:i386 check:i386 libxml2-dev:i386
+ cmd_action: unit_tests_32
+
+ - name: "Debug Build & Unit Tests without Subscriptions (gcc)"
cmd_action: unit_tests_nosub
- - build_name: "Debug Build & Unit Tests with Diagnostics (gcc)"
- cmd_deps: ""
+
+ - name: "Debug Build & Unit Tests with Diagnostics (gcc)"
cmd_action: unit_tests_diag
- - build_name: "Debug Build & Unit Tests with multithreading (gcc)"
- cmd_deps: ""
+
+ - name: "Debug Build & Unit Tests with multithreading (gcc)"
cmd_action: unit_tests_mt
- - build_name: "Debug Build & Unit Tests with Alarms&Conditions (gcc)"
- cmd_deps: ""
+
+ - name: "Debug Build & Unit Tests with Alarms&Conditions (gcc)"
cmd_action: unit_tests_alarms
- - build_name: "Debug Build & Unit Tests (clang)"
- cmd_deps: sudo apt-get install -y -qq clang-11 clang-tools-11 mosquitto
- cmd_action: CC=clang-11 CXX=clang++-11 unit_tests
- - build_name: "Debug Build & Unit Tests (tcc)"
- cmd_deps: sudo apt-get install -y -qq tcc mosquitto
+
+ - name: "Debug Build & Unit Tests (tcc)"
+ cmd_deps: sudo apt-get install -y -qq tcc
cmd_action: CC=tcc unit_tests
- - build_name: "Encryption (MbedTLS) Build & Unit Tests (gcc)"
+
+ - name: "Encryption (MbedTLS) Build & Unit Tests (gcc)"
cmd_deps: sudo apt-get install -y -qq libmbedtls-dev
cmd_action: unit_tests_encryption MBEDTLS
- - build_name: "PubSub Encryption (MbedTLS) Build & Unit Tests (gcc)"
+
+ - name: "PubSub Encryption (MbedTLS) Build & Unit Tests (gcc)"
cmd_deps: sudo apt-get install -y -qq libmbedtls-dev
cmd_action: unit_tests_encryption_mbedtls_pubsub
- - build_name: "Encryption (OpenSSL) Build & Unit Tests (gcc)"
+
+ - name: "PubSub SKS Build & Unit Tests (gcc)"
+ cmd_deps: sudo apt-get install -y -qq valgrind libmbedtls-dev
+ cmd_action: unit_tests_pubsub_sks
+
+ - name: "Encryption (OpenSSL) Build & Unit Tests (gcc)"
cmd_deps: sudo apt-get install -y -qq openssl
cmd_action: unit_tests_encryption OPENSSL
- - build_name: "Encryption (LibreSSL) Build & Unit Tests (gcc)"
+
+ - name: "Encryption (LibreSSL) Build & Unit Tests (gcc)"
cmd_deps: |
- sudo apt-get install -y -qq curl
- curl https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.4.2.tar.gz --output libressl.tar.gz
- tar -xvz -f libressl.tar.gz
- cd libressl-3.4.2
- ./configure
- sudo make install
+ sudo apt-get install -y -qq curl
+ curl https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.9.2.tar.gz --output libressl.tar.gz
+ tar -xvz -f libressl.tar.gz
+ cd libressl-3.9.2
+ ./configure
+ sudo make install
cmd_action: unit_tests_encryption LIBRESSL
- - build_name: "TPM Tool Build"
- cmd_deps: |
- sudo apt-get install -y -qq acl autoconf autoconf-archive automake build-essential cmake doxygen gcc git iproute2 libcurl4-openssl-dev libjson-c-dev libcmocka0 libcmocka-dev libgcrypt20-dev libglib2.0-dev libini-config-dev libmbedtls-dev libssl-dev libsqlite3-dev libtool libyaml-dev pkg-config procps python3-pip sqlite3 udev uthash-dev
+
+ - name: "Release Build"
+ cmd_deps: sudo apt-get install -y -qq libmbedtls-dev
+ cmd_action: build_release
+
+ - name: "Amalgamation Build"
+ cmd_action: build_amalgamation
+
+ - name: "Amalgamation Build with Multithreading"
+ cmd_action: build_amalgamation_mt
+
+ - name: "Build All Companion Specifications"
+ cmd_action: build_all_companion_specs
+
+ include:
+ # Clang builds for specific Ubuntu versions
+ - os: ubuntu-20.04
+ build:
+ name: "Debug Build & Unit Tests (clang-11)"
+ cmd_deps: sudo apt-get install -y -qq clang-11 clang-tools-11
+ cmd_action: CC=clang-11 CXX=clang++-11 unit_tests
+
+ - os: ubuntu-22.04
+ build:
+ name: "Debug Build & Unit Tests (clang-15)"
+ cmd_deps: sudo apt-get install -y -qq clang-15 clang-tools-15 && sudo sysctl -w vm.mmap_rnd_bits=28
+ cmd_action: CC=clang-15 CXX=clang++-15 unit_tests
+
+ - os: ubuntu-24.04
+ build:
+ name: "Debug Build & Unit Tests (clang-18)"
+ cmd_deps: sudo apt-get install -y -qq clang-18 clang-tools-18 && sudo sysctl -w vm.mmap_rnd_bits=28
+ cmd_action: CC=clang-18 CXX=clang++-18 unit_tests
+
+ # TPM Tool Builds for specific Ubuntu versions
+ - os: ubuntu-20.04
+ build:
+ name: "TPM Tool Build ubuntu-20.04"
+ cmd_deps: |
+ sudo apt-get install -y -qq acl autoconf autoconf-archive automake doxygen iproute2 libcurl4-openssl-dev libjson-c-dev libcmocka0 libcmocka-dev libgcrypt20-dev libglib2.0-dev libini-config-dev libmbedtls-dev libsqlite3-dev libtool libyaml-dev procps python3-pip sqlite3 udev uthash-dev
cd ${HOME}
git clone https://github.com/tpm2-software/tpm2-tss.git
cd ${HOME}/tpm2-tss
- git checkout 2.4.6
+ git checkout 3.2.3
./bootstrap && ./configure --with-udevrulesdir=/etc/udev/rules.d --with-udevrulesprefix=70-
make -j$(nproc)
sudo make install
@@ -63,7 +113,7 @@ jobs:
cd ${HOME}
git clone https://github.com/tpm2-software/tpm2-pkcs11.git
cd ${HOME}/tpm2-pkcs11
- git checkout 1.6.0
+ git checkout 1.7.0
./bootstrap && ./configure
make -j$(nproc)
sudo make install
@@ -72,44 +122,135 @@ jobs:
cd ${HOME}/tpm2-pkcs11/tools/
sudo pip3 install pyasn1_modules
pip3 install .
- cmd_action: build_tpm_tool
- - build_name: "Release Build"
- cmd_deps: sudo apt-get install -y -qq libmbedtls-dev
- cmd_action: build_release
- - build_name: Amalgamation Build
- cmd_deps: ""
- cmd_action: build_amalgamation
- - build_name: Amalgamation Build with Multithreading
- cmd_deps: ""
- cmd_action: build_amalgamation_mt
- - build_name: "Valgrind Unit Tests with MbedTLS (gcc)"
- cmd_deps: sudo apt-get install -y -qq valgrind libmbedtls-dev
- cmd_action: unit_tests_valgrind MBEDTLS
- - build_name: "Valgrind Unit Tests with OpenSSL (gcc)"
- cmd_deps: sudo apt-get install -y -qq valgrind openssl
- cmd_action: unit_tests_valgrind OPENSSL
- - build_name: "Valgrind Examples with MbedTLS (gcc)"
- cmd_deps: sudo apt-get install -y -qq valgrind libmbedtls-dev
- cmd_action: examples_valgrind MBEDTLS
- - build_name: "Valgrind Examples with OpenSSL (gcc)"
- cmd_deps: sudo apt-get install -y -qq valgrind openssl
- cmd_action: examples_valgrind OPENSSL
- - build_name: "Clang Static Analyzer"
- cmd_deps: sudo apt-get install -y -qq clang-11 clang-tools-11 libmbedtls-dev
- cmd_action: build_clang_analyzer
- name: ${{matrix.build_name}}
- runs-on: ubuntu-20.04
+ cmd_action: build_tpm_tool
+ - os: ubuntu-22.04
+ build:
+ name: "TPM Tool Build ubuntu-22.04"
+ cmd_deps: |
+ sudo apt-get install -y -qq acl autoconf autoconf-archive automake doxygen iproute2 libcurl4-openssl-dev libjson-c-dev libcmocka0 libcmocka-dev libgcrypt20-dev libglib2.0-dev libini-config-dev libmbedtls-dev libsqlite3-dev libtool libyaml-dev procps python3-pip sqlite3 udev uthash-dev
+ cd ${HOME}
+ git clone https://github.com/tpm2-software/tpm2-tss.git
+ cd ${HOME}/tpm2-tss
+ git checkout 3.2.3
+ ./bootstrap && ./configure --with-udevrulesdir=/etc/udev/rules.d --with-udevrulesprefix=70-
+ make -j$(nproc)
+ sudo make install
+ sudo ldconfig
+ sudo udevadm control --reload-rules && sudo udevadm trigger
+ sudo apt-get install -y -qq tpm2-tools opensc
+ cd ${HOME}
+ git clone https://github.com/tpm2-software/tpm2-pkcs11.git
+ cd ${HOME}/tpm2-pkcs11
+ git checkout 1.7.0
+ ./bootstrap && ./configure
+ make -j$(nproc)
+ sudo make install
+ sudo ldconfig
+ sudo cp ${HOME}/tpm2-pkcs11/src/pkcs11.h /usr/include
+ cd ${HOME}/tpm2-pkcs11/tools/
+ sudo pip3 install pyasn1_modules
+ pip3 install .
+ cmd_action: build_tpm_tool
+ - os: ubuntu-24.04
+ build:
+ name: "TPM Tool Build ubuntu-24.04"
+ cmd_deps: |
+ sudo apt-get install -y -qq acl autoconf autoconf-archive automake doxygen iproute2 libcurl4-openssl-dev libjson-c-dev libcmocka0 libcmocka-dev libgcrypt20-dev libglib2.0-dev libini-config-dev libmbedtls-dev libsqlite3-dev libtool libyaml-dev procps python3-pip sqlite3 udev uthash-dev libltdl-dev python3-pyasn1-modules
+ cd ${HOME}
+ git clone https://github.com/tpm2-software/tpm2-tss.git
+ cd ${HOME}/tpm2-tss
+ git checkout 4.1.3
+ ./bootstrap && ./configure --with-udevrulesdir=/etc/udev/rules.d --with-udevrulesprefix=70-
+ make -j$(nproc)
+ sudo make install
+ sudo ldconfig
+ sudo udevadm control --reload-rules && sudo udevadm trigger
+ sudo apt-get install -y -qq tpm2-tools python3-tpm2-pytss opensc
+ cd ${HOME}
+ git clone https://github.com/tpm2-software/tpm2-pkcs11.git
+ cd ${HOME}/tpm2-pkcs11
+ git checkout 1.9.1
+ ./bootstrap && ./configure
+ make -j$(nproc)
+ sudo make install
+ sudo ldconfig
+ sudo cp ${HOME}/tpm2-pkcs11/src/pkcs11.h /usr/include
+ cd ${HOME}/tpm2-pkcs11/tools/
+ pip3 install --break-system-packages .
+ cmd_action: build_tpm_tool
+
+ # Valgrind tests for specific Ubuntu versions
+ - os: ubuntu-24.04
+ build:
+ name: "Valgrind Build & Unit Tests with MbedTLS (gcc)"
+ cmd_deps: sudo apt-get install -y -qq valgrind libmbedtls-dev
+ cmd_action: unit_tests_valgrind MBEDTLS
+ - os: ubuntu-24.04
+ build:
+ name: "Valgrind Build & Unit Tests with OpenSSL (gcc)"
+ cmd_deps: sudo apt-get install -y -qq valgrind openssl
+ cmd_action: unit_tests_valgrind OPENSSL
+ - os: ubuntu-24.04
+ build:
+ name: "Valgrind Examples with MbedTLS and mDNSD (gcc)"
+ cmd_deps: sudo apt-get install -y -qq valgrind libmbedtls-dev python3-netifaces
+ cmd_action: examples_valgrind MBEDTLS MDNSD
+ - os: ubuntu-24.04
+ build:
+ name: "Valgrind Examples with OpenSSL and avahi-mdns(gcc)"
+ cmd_deps: sudo apt-get install -y -qq valgrind openssl libmbedtls-dev python3-netifaces libavahi-client-dev libavahi-common-dev
+ cmd_action: examples_valgrind OPENSSL AVAHI
+
+ # Clang Static Analyzer Builds
+ - os: ubuntu-20.04
+ build:
+ name: "Clang Static Analyzer (clang11)"
+ cmd_deps: sudo apt-get install -y -qq clang-11 clang-tools-11 libmbedtls-dev
+ cmd_action: CC=clang-11 CXX=clang++-11 build_clang_analyzer 11
+ - os: ubuntu-22.04
+ build:
+ name: "Clang Static Analyzer (clang15)"
+ cmd_deps: sudo apt-get install -y -qq clang-15 clang-tools-15 libmbedtls-dev
+ cmd_action: CC=clang-15 CXX=clang++-15 build_clang_analyzer 15
+ - os: ubuntu-24.04
+ build:
+ name: "Clang Static Analyzer (clang18)"
+ cmd_deps: sudo apt-get install -y -qq clang-18 clang-tools-18 libmbedtls-dev
+ cmd_action: CC=clang-18 CXX=clang++-18 build_clang_analyzer 18
+
+ name: ${{ matrix.os }}-${{ matrix.build.name }}
+ runs-on: ubuntu-latest
+ container:
+ image: ghcr.io/open62541/open62541-ci:${{ matrix.os }}
+ options: --privileged
+ services:
+ mosquitto:
+ image: eclipse-mosquitto:1.6-openssl
+ env:
+ OPEN62541_TEST_MQTT_BROKER: opc.mqtt://mosquitto:1883
steps:
- - uses: actions/checkout@v2
- with:
- submodules: true
- - name: Install Dependencies
- run: |
- sudo apt-get update
- sudo apt-get install -y -qq python3-sphinx graphviz check
- ${{ matrix.cmd_deps }}
- - name: ${{matrix.build_name}}
- run: source tools/ci.sh && ${{matrix.cmd_action}}
- env:
- ETHERNET_INTERFACE: eth0
+ - name: Work around disabled ipv6 on actions container networks
+ run: |
+ IPV6="$(cat /proc/sys/net/ipv6/conf/eth0/disable_ipv6)"
+ echo "Current IPv6 status on eth0: $IPV6"
+ [ "$IPV6" = "1" ] || exit
+ echo 0 | sudo tee /proc/sys/net/ipv6/conf/eth0/disable_ipv6 > /dev/null
+ IPV6="$(cat /proc/sys/net/ipv6/conf/eth0/disable_ipv6)"
+ echo "New IPv6 status on eth0: $IPV6"
+ [ "$IPV6" = "0" ] || { echo "Failed to enable IPv6 on eth0"; exit 1; }
+ - uses: actions/checkout@v4
+ if: matrix.build.os == '' || matrix.build.os == matrix.os
+ with:
+ submodules: true
+ - name: Install Dependencies
+ if: matrix.build.os == '' || matrix.build.os == matrix.os
+ run: |
+ sudo apt-get update
+ ${{ matrix.build.cmd_deps }}
+ - name: ${{ matrix.build.name }}
+ if: matrix.build.os == '' || matrix.build.os == matrix.os
+ shell: bash
+ run: source tools/ci.sh && ${{ matrix.build.cmd_action }}
+ env:
+ ETHERNET_INTERFACE: eth0
diff --git a/.github/workflows/build_ubuntu2204.yml b/.github/workflows/build_ubuntu2204.yml
index 216c0665c08..1b3982bdd20 100644
--- a/.github/workflows/build_ubuntu2204.yml
+++ b/.github/workflows/build_ubuntu2204.yml
@@ -12,17 +12,31 @@ jobs:
cmd_deps: sudo apt-get install -y -qq openssl
cmd_action: unit_tests_encryption OPENSSL
name: ${{matrix.build_name}}
- runs-on: ubuntu-22.04
+ runs-on: ubuntu-latest
+ container:
+ image: ghcr.io/marwinglaser/ci:ubuntu-22.04
+ options: --privileged
steps:
- - uses: actions/checkout@v2
+ - name: Work around disabled ipv6 on actions container networks
+ run: |
+ IPV6="$(cat /proc/sys/net/ipv6/conf/eth0/disable_ipv6)"
+ echo "Current IPv6 status on eth0: $IPV6"
+ [ "$IPV6" = "1" ] || exit
+
+ echo 0 | sudo tee /proc/sys/net/ipv6/conf/eth0/disable_ipv6 > /dev/null
+ IPV6="$(cat /proc/sys/net/ipv6/conf/eth0/disable_ipv6)"
+ echo "New IPv6 status on eth0: $IPV6"
+ [ "$IPV6" = "0" ] || { echo "Failed to enable IPv6 on eth0"; exit 1; }
+ - uses: actions/checkout@v4
with:
submodules: true
- name: Install Dependencies
run: |
sudo apt-get update
- sudo apt-get install -y -qq python3-sphinx graphviz check
+ sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq cmake pkg-config libcap2-bin libssl-dev python3-sphinx graphviz check
${{ matrix.cmd_deps }}
- name: ${{matrix.build_name}}
+ shell: bash
run: source tools/ci.sh && ${{matrix.cmd_action}}
env:
ETHERNET_INTERFACE: eth0
diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml
new file mode 100644
index 00000000000..bfa4f4452e3
--- /dev/null
+++ b/.github/workflows/cifuzz.yml
@@ -0,0 +1,24 @@
+name: CIFuzz
+on: [pull_request]
+jobs:
+ Fuzzing:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Build Fuzzers
+ id: build
+ uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
+ with:
+ oss-fuzz-project-name: 'open62541'
+ dry-run: false
+ - name: Run Fuzzers
+ uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
+ with:
+ oss-fuzz-project-name: 'open62541'
+ fuzz-seconds: 600
+ dry-run: false
+ - name: Upload Crash
+ uses: actions/upload-artifact@v4
+ if: failure() && steps.build.outcome == 'success'
+ with:
+ name: artifacts
+ path: ./out/artifacts
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
index 117924cf2bb..b7a95c8ebcf 100644
--- a/.github/workflows/codeql.yml
+++ b/.github/workflows/codeql.yml
@@ -27,7 +27,7 @@ jobs:
steps:
- name: Checkout open62541
- uses: actions/checkout@v2
+ uses: actions/checkout@v4
with:
submodules: recursive
@@ -35,11 +35,11 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y -qq python3-sphinx graphviz check
- sudo apt-get install -y -qq tcc clang-11 clang-tools-11 valgrind
+ sudo apt-get install -y -qq tcc clang-11 clang-tools-11 valgrind mosquitto
sudo apt-get install -y -qq libmbedtls-dev openssl
- name: Initialize CodeQL
- uses: github/codeql-action/init@v1
+ uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
@@ -49,4 +49,4 @@ jobs:
ETHERNET_INTERFACE: eth0
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v1
+ uses: github/codeql-action/analyze@v3
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
new file mode 100644
index 00000000000..1548d87bbe7
--- /dev/null
+++ b/.github/workflows/coverage.yml
@@ -0,0 +1,30 @@
+name: "Coverage Test"
+on:
+ push:
+ branches: [ main, master, 1.* ]
+ tags:
+ - v1.*
+ pull_request:
+ branches: [ main, master, 1.* ]
+
+jobs:
+ run:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Install Dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y -qq python3-sphinx graphviz check libmbedtls-dev mosquitto
+ - name: Fetch
+ uses: actions/checkout@v2
+ with:
+ submodules: true
+ - name: Execute Tests
+ run: source tools/ci.sh && unit_tests_with_coverage
+ env:
+ ETHERNET_INTERFACE: eth0
+ - name: Debug print
+ run: |
+ tree .
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v4
diff --git a/.github/workflows/debian_packing.yml b/.github/workflows/debian_packing.yml
index 345a7519e25..c32d0cdffbb 100644
--- a/.github/workflows/debian_packing.yml
+++ b/.github/workflows/debian_packing.yml
@@ -4,16 +4,17 @@ on:
push:
branches: [ main, master ]
tags:
- - v1.*
+ - 'v1.*'
+ - 'v1.*.*'
jobs:
Debian-Package-Branch-Preperation:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
with:
submodules: true
- - uses: actions/setup-python@v2
+ - uses: actions/setup-python@v5
with:
python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
diff --git a/.github/workflows/doc_upload.yml b/.github/workflows/doc_upload.yml
index 86bff64703a..11ae5522105 100644
--- a/.github/workflows/doc_upload.yml
+++ b/.github/workflows/doc_upload.yml
@@ -10,25 +10,26 @@ jobs:
Documentation-Generation-And-Upload:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
with:
persist-credentials: false
- - uses: actions/setup-python@v2
+ - uses: actions/setup-python@v5
with:
python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
- name: Install Dependencies
run: |
sudo apt-get update
- sudo apt-get install -y -qq python3-sphinx graphviz python-six texlive-fonts-recommended texlive-latex-extra texlive-plain-generic texlive-latex-recommended latexmk
- pip install sphinx-rtd-theme
+ sudo apt-get install -y -qq graphviz texlive-fonts-recommended texlive-latex-extra texlive-plain-generic texlive-latex-recommended latexmk texlive-fonts-extra
+ pip install -r doc/requirements.txt
- name: Build Documentation
run: source tools/ci.sh && build_docs_pdf
- name: Checkout Website Repository
- uses: actions/checkout@v2
+ uses: actions/checkout@v4
with:
repository: open62541/open62541-www
path: open62541-www
+ ref: main
persist-credentials: false
- name: Get the current branch name
shell: bash
diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml
index 9025bf48284..31c972c91dc 100644
--- a/.github/workflows/rebase.yml
+++ b/.github/workflows/rebase.yml
@@ -8,11 +8,11 @@ jobs:
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@master
+ - uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Automatic Rebase
- uses: cirrus-actions/rebase@1.2
+ uses: cirrus-actions/rebase@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# https://github.community/t5/GitHub-Actions/Workflow-is-failing-if-no-job-can-be-ran-due-to-condition/m-p/38186#M3250
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 00000000000..9821174bb0d
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,20 @@
+name: Build Release Artifacts
+
+on:
+ push:
+ release:
+ types: [published]
+
+jobs:
+ build:
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: true
+ - run: sudo apt-get install -y -qq libmbedtls-dev
+ - run: source tools/ci.sh && build_release_amalgamation
+ - run: gh release upload ${{ github.ref_name }} build/open62541.{c,h}
+ env:
+ GH_TOKEN: ${{ github.token }}
+ if: github.event_name == 'release'
diff --git a/.gitignore b/.gitignore
index 7f5abbc35fa..bfaa5138f0f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -78,13 +78,16 @@ Makefile
/exampleClient
/exampleClient_legacy
/src_generated/
-/build
-/.idea
+**/build
/cmake-build*
/tools/certs/certs/*
Pipfile
Pipfile.lock
.vscode
+/.vs
+**/libxml2
+debian/*
+/CMakeSettings.json
# clangd cache
.cache/
diff --git a/.gitmodules b/.gitmodules
index c4b2135f84c..8671b223e09 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,11 +1,15 @@
[submodule "deps/mdnsd"]
path = deps/mdnsd
- url = https://github.com/Pro/mdnsd.git
+ url = https://github.com/troglobit/mdnsd.git
[submodule "deps/ua-nodeset"]
path = deps/ua-nodeset
url = https://github.com/OPCFoundation/UA-Nodeset
- branch = v1.04
+ branch = latest
[submodule "deps/mqtt-c"]
path = deps/mqtt-c
url = https://github.com/LiamBindle/MQTT-C.git
branch = master
+[submodule "deps/nodesetLoader"]
+ path = deps/nodesetLoader
+ url = https://github.com/open62541/nodesetLoader
+ branch = master
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 00000000000..13566b81b01
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 00000000000..8e53702d295
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 00000000000..79ee123c2b2
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/csv-plugin.xml b/.idea/csv-plugin.xml
new file mode 100644
index 00000000000..a875089f079
--- /dev/null
+++ b/.idea/csv-plugin.xml
@@ -0,0 +1,72 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/deployment.xml b/.idea/deployment.xml
new file mode 100644
index 00000000000..c63b895e1fc
--- /dev/null
+++ b/.idea/deployment.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 00000000000..97470699605
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 00000000000..2e2b5d56c99
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/open62541.iml b/.idea/open62541.iml
new file mode 100644
index 00000000000..f08604bb65b
--- /dev/null
+++ b/.idea/open62541.iml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/.idea/open625412.iml b/.idea/open625412.iml
new file mode 100644
index 00000000000..f08604bb65b
--- /dev/null
+++ b/.idea/open625412.iml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 00000000000..a431a2f69e5
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CHANGELOG b/CHANGELOG
index 3e05be6f115..3361721d49a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,126 +1,135 @@
-This changelog reports changes to the public API. Internal refactorings and bug
+This changelog reports changes visible through the public API. Internal refactorings and bug
fixes are not reported here.
-2018-02-05 pro
+2025-02-18 Andreas Eckerstorfer
- * Also pass client to monitoredItem/Events callback
+ * PubSub beforeWrite callback
- The UA_MonitoredItemHandlingFunction and UA_MonitoredEventHandlingFunction
- did not include a reference to the corresponding client used for the call of
- processPublishResponse.
- This now also allows to get the client context within the monitored item
- handling function.
+ A misleading comment about the content of the variable
+ externalDataValue in the PubSub beforeWrite callback has been
+ removed. Please review your beforeWrite callback implementation.
+ The beforeWrite callback is called with the data pointer
+ containing the data before the update. It may be used for a
+ double buffer implementation.
+ The original code change was done with commit
+ 06da5d07bd9a653d32e7a6ed06deae994d29953c.
- The API changes are detected by the type-matching in the compiler. So there
- is little risk for bugs due to unaligned implementations.
+2023-07-02 Jonas Green
-2017-09-07 jpfr
+ * Decoding variant with array of structure
- * Make Client Highlevel Interface consistent
+ When decoding an array of structures the extension objects that
+ each structure is wrapped into is now unwrapped if the array
+ contains only a single type. Previously the decoding API returned
+ an array of extension objects. If the array of extension objects
+ has more than one type the decoding result will be an array of
+ extension objects.
- Two methods in the client highlevel interface were not conformant with the
- API convention that array sizes are given before the array pointer. This
- changes the signature of UA_Client_writeArrayDimensionsAttribute and
- UA_Client_readArrayDimensionsAttribute.
+2022-12-03 Julius Pfrommer
- The API changes are detected by the type-matching in the compiler. So there
- is little risk for bugs due to unaligned implementations.
+ * KeyValueMap in PubSub configuration
-2017-08-16 jpfr
+ The UA_KeyValueMap structure is used everywhere instead of raw
+ arrays of UA_KeyValuePair.
- * Default Attribute Values for Node Attributes
+2022-11-19 Julius Pfrommer
- The AddNodes service takes a structure with the attributes of the new node as
- input. We began checking the consistency of the attributes more closely. You
- can now use constant global definitions with default values as a starting
- point. For example UA_VariableAttributes_default for adding a variable node.
+ * Thread-safe client
- * All nodes have a context pointer
+ A large portion of the client API is now marked UA_THREADSAFE. For
+ those methods, if multithreading is enabled, an internal mutex
+ protects the client.
- All nodes now carry a context pointer. The context pointer is initially set
- to a user-defined memory location. The context pointer is passed to all
- user-visible callbacks involving the node.
+2022-08-04 Robert Mak
- * Global and node-type constructor/destructor
+ * Saving unknown client certificates
- The constructors are fine-grained mechanisms to control the instantiation and
- deletion of nodes. Constructors receive the node context pointer and can also
- replace it.
+ 'UA_CertificateVerification_CertFolders()' has been extended with
+ an additional parameter - path to the folder where the rejected
+ certificate should be stored. This change applies if
+ `UA_ENABLE_CERT_REJECTED_DIR` is set.
-2017-08-13 Infinity95
+ The change was done with pull request #5260.
- * New/Delete methods for the server configuration
+2022-08-07 Julius Pfrommer
- The default server configuration is no longer a constant global variable.
- Instead, it is now handled with a pair of new/delete methods. This enables
- the use of malloced members of the server configuration. With this change,
- the endpoint descriptions are no longer generated in the server but are
- created as part of the server configuration. See the example server
- implementations on how to use the configuration generation. The change is a
- precursor to the encryption implementation that ties into the generation of
- endpoint descriptions in the server config.
+ * JSON decoding based on JSON5
- The generation of the default server configuration is implemented as a
- "plugin". So it comes with CC0 licensing and can be freely adjusted by users.
+ The JSON decoding can parse the official encoding from the OPC UA
+ specification. It now further allows the following extensions:
- The TCP port in the default configuration is 4840. This is the recommended
- port for OPC UA and now used throughout all examples.
+ - The strict JSON format is relaxed to also allow the JSON5 extensions
+ (https://json5.org/). This allows for more human-readable encoding
+ and adds convenience features such as trailing commas in arrays and
+ comments within JSON documents.
+ - If `UA_ENABLE_PARSING` is set, NodeIds and ExpandedNodeIds can be given in
+ the string encoding (see `UA_NodeId_parse`). The standard encoding is to
+ express NodeIds as JSON objects.
-2017-07-04 jpfr
+ These extensions are not intended to be used for the OPC UA protocol on the
+ network. They were rather added to allow more convenient configuration file
+ formats that also include data in the OPC UA type system.
- * Return partially overlapping ranges
+2022-07-14 Jannis Voelker
- Test the integrity of the range and compute the max index used for every
- dimension. The standard says in Part 4, Section 7.22:
+ * LocaleId support in the server
- When reading a value, the indexes may not speify a range that is within
- the bounds of the array. The Server shall return a partial result if some
- elements exist within the range.
+ The server now supports that descriptions and display names for
+ different locales are written to a node. The server selects a
+ suitable localization depending on the locale ids that are set for
+ the current session.
-2017-07-03 jpfr
+ Locales are added simply by writing a LocalizedText value with a
+ different locale. A locale can be removed by writing a
+ LocalizedText value of the corresponding locale and with an empty
+ text.
- * Implement asynchronous service calls for the client
+ The change was done with pull request #4165.
- All OPC UA services are asynchronous in nature. So several service calls can
- be made without waiting for a response first. Responess may come in a
- different ordering. The client takes a method pointer and a data pointer to
- perform an asynchronous callback on the request response.
+2022-07-07 Andreas Eckerstorfer
- Synchronous service calls are still supported in the client. Asynchronous
- responses are processed in the background until the synchronous response (the
- client is waiting for) returns the control flow back to the user.
+ * PubSub publisher id types
-2017-06-26 janitza-thbe
+ The union for the PubSub publisher id 'UA_PublisherId' and
+ the enumeration for the PubSub publisher type 'UA_PublisherIdType'
+ have been changed to support all specified publisher id types.
- * Enable IPv6 in the networklayer plugin
+ The change was done with pull request #5223.
- The server networklayer listens on several sockets for available networks and
- IP versions. IPv4 connections are still supported.
+2022-06-09 Andreas Eckerstorfer
- The OPC Foundation ANSI C Stack before 2016 does not fully support IPv6. On
- Windows, the 'localhost' target is resolved to IPv6 by default. Old
- applications (e.g. the Conformance Testing Tools) need to connect to
- 127.0.0.1 instead of 'localhost' to force IPv4.
+ * PubSub state change functions
-2017-06-16 jpfr
+ The following functions in ua_pubsub.h have been extended with
+ an additional parameter for the cause of the state change.
+ Moreover the parameter order has been changed.
+ UA_DataSetWriter_setPubSubState
+ UA_WriterGroup_setPubSubState
+ UA_DataSetReader_setPubSubState
+ UA_ReaderGroup_setPubSubState
- * Require the AccessLevel bit UA_ACCESSLEVELMASK_READ for reading
+ The change was done with pull request #5162.
- Set the bit by default when adding nodes for a smooth transition to the new
- API. This will change at a later point with an additional node settings
- argument for the AddNodes methods.
+2022-05-04 Julius Pfrommer
-2017-05-03 pro
+ * Server port and hostname configuration
- * Array dimensions are UInt32 also for the highlevel client read service
+ Instead of configuring the port number in the server's
+ "NetworkLayer", the server configuration now takes a list of
+ ServerURLs like `opc.tcp://my-server:4840` or
+ `opc.wss://localhost:443`. The URLs are used both for discovery
+ and to set up the server sockets based on the defined hostnames
+ (and ports).
-2017-04-16 jpfr
+ The default is to listen on all interfaces with port 4840 for
+ incoming TCP connections.
- * Refactor UA_parseEndpointUrl to work with UA_String
+2022-01-12 Mark Giraud
- The output hostname and path now point into the original endpointUrl with an
- appropriate length.
+ * Empty arrays always match the array dimensions
-2017-04-14 jpfr
-
- * Auto-instantiate only child nodes marked as mandatory (fixes #1004)
+ We consider empty arrays (also null-arrays) to have implied array
+ dimensions [0,0,...]. So they always match the array dimensions
+ defined in the variable. With this, the initialization of
+ variables without a defined value has been simplified.
+ We now create a null array if one is required.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6c26c72a5c2..ccee162f96c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.0...3.12)
+cmake_minimum_required(VERSION 3.13)
if(UA_BUILD_FUZZING OR UA_BUILD_OSS_FUZZ OR UA_BUILD_FUZZING_CORPUS)
project(open62541) # We need to have C++ support configured for fuzzing
else()
@@ -12,19 +12,16 @@ endif()
string(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE_LOWER_CASE)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/tools/cmake")
+if(${CMAKE_VERSION} VERSION_LESS 3.12)
+ set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${PROJECT_SOURCE_DIR}/tools/cmake3.12")
+endif()
+
find_package(Python3 REQUIRED)
-set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
+
find_package(Git)
include(AssignSourceGroup)
include(GNUInstallDirs)
-
-# Set when installed via make install
-set(open62541_TOOLS_DIR ${PROJECT_SOURCE_DIR}/tools)
-set(open62541_NODESET_DIR ${PROJECT_SOURCE_DIR}/deps/ua-nodeset)
-set(open62541_MQTT_DIR ${PROJECT_SOURCE_DIR}/deps/mqtt-c)
-
-include(macros_internal)
-include(macros_public)
+include(open62541Macros)
#############################
# Compiled binaries folders #
@@ -42,8 +39,8 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# number from the latest release plus the "-undefined" label. Will be
# overwritten with more detailed information if git is available.
set(OPEN62541_VER_MAJOR 1)
-set(OPEN62541_VER_MINOR 3)
-set(OPEN62541_VER_PATCH 9)
+set(OPEN62541_VER_MINOR 4)
+set(OPEN62541_VER_PATCH 18)
set(OPEN62541_VER_LABEL "-undefined") # like "-rc1" or "-g4538abcd" or "-g4538abcd-dirty"
set(OPEN62541_VER_COMMIT "unknown-commit")
@@ -61,36 +58,15 @@ set_open62541_version()
set(OPEN62541_VERSION "v${OPEN62541_VER_MAJOR}.${OPEN62541_VER_MINOR}.${OPEN62541_VER_PATCH}${OPEN62541_VER_LABEL}")
MESSAGE(STATUS "open62541 Version: ${OPEN62541_VERSION}")
-#################
-# Build Options #
-#################
-
-# Set default build type.
-if(NOT CMAKE_BUILD_TYPE)
- message(STATUS "CMAKE_BUILD_TYPE not given; setting to 'Debug'")
- set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build" FORCE)
-endif()
-
-option(UA_ENABLE_AMALGAMATION "Concatenate the library to a single file open62541.h/.c" OFF)
-set(UA_AMALGAMATION_ARCHITECTURES "" CACHE STRING "List of architectures to include in amalgamation")
-mark_as_advanced(UA_AMALGAMATION_ARCHITECTURES)
+################
+# Architecture #
+################
-# Platform. This is at the beginning in case the architecture changes some UA options
-set(UA_ARCHITECTURE "None" CACHE STRING "Architecture to build open62541 on")
+set(UA_ARCHITECTURES "none" "posix" "win32")
+set(UA_ARCHITECTURE "" CACHE STRING "Architecture to build open62541 for")
+SET_PROPERTY(CACHE UA_ARCHITECTURE PROPERTY STRINGS "" ${UA_ARCHITECTURES})
-if(UA_ENABLE_AMALGAMATION)
- if("${UA_AMALGAMATION_ARCHITECTURES}" STREQUAL "")
- if(NOT "${UA_ARCHITECTURE}" STREQUAL "None")
- set(UA_AMALGAMATION_ARCHITECTURES "${UA_ARCHITECTURE}")
- else()
- # select some default architectures which should be included
- set(UA_AMALGAMATION_ARCHITECTURES "win32;posix")
- endif()
- endif()
- message(STATUS "Architectures included in amalgamation: ${UA_AMALGAMATION_ARCHITECTURES}")
-endif()
-
-if("${UA_ARCHITECTURE}" STREQUAL "None")
+if("${UA_ARCHITECTURE}" STREQUAL "")
if(UNIX)
set(UA_ARCHITECTURE "posix" CACHE STRING "" FORCE)
elseif(WIN32)
@@ -98,66 +74,56 @@ if("${UA_ARCHITECTURE}" STREQUAL "None")
endif(UNIX)
endif()
-message(STATUS "The selected architecture is: ${UA_ARCHITECTURE}")
-string(TOUPPER ${UA_ARCHITECTURE} UA_ARCHITECTURE_UPPER)
-add_definitions(-DUA_ARCHITECTURE_${UA_ARCHITECTURE_UPPER})
-
-add_subdirectory(arch)
-
-GET_PROPERTY(architectures GLOBAL PROPERTY UA_ARCHITECTURES)
-list(SORT architectures)
-set_property(CACHE UA_ARCHITECTURE PROPERTY STRINGS None ${architectures})
-
-GET_PROPERTY(ua_architecture_directories_to_include GLOBAL PROPERTY UA_INCLUDE_DIRECTORIES)
+if (NOT UA_ENABLE_AMALGAMATION OR (UA_ENABLE_AMALGAMATION AND NOT UA_AMALGAMATION_MULTIARCH))
+ message(STATUS "The selected architecture is: ${UA_ARCHITECTURE}")
-GET_PROPERTY(ua_architecture_headers GLOBAL PROPERTY UA_ARCHITECTURE_HEADERS)
-
-GET_PROPERTY(ua_architecture_headers_beginning GLOBAL PROPERTY UA_ARCHITECTURE_HEADERS_BEGINNING)
-
-GET_PROPERTY(ua_architecture_sources GLOBAL PROPERTY UA_ARCHITECTURE_SOURCES)
-
-set(ua_architecture_sources ${ua_architecture_sources}
- ${PROJECT_SOURCE_DIR}/arch/network_tcp.c
-)
-
-set(ua_architecture_headers ${ua_architecture_headers}
- ${PROJECT_SOURCE_DIR}/include/open62541/network_tcp.h
- ${PROJECT_SOURCE_DIR}/include/open62541/architecture_functions.h
-)
-
-if(UA_ENABLE_WEBSOCKET_SERVER)
- set(ua_architecture_sources ${ua_architecture_sources}
- ${PROJECT_SOURCE_DIR}/arch/network_ws.c)
-
- set(ua_architecture_headers ${ua_architecture_headers}
- ${PROJECT_SOURCE_DIR}/include/open62541/network_ws.h)
+ if("${UA_ARCHITECTURE}" STREQUAL "posix")
+ set(UA_ARCHITECTURE_POSIX 1)
+ elseif("${UA_ARCHITECTURE}" STREQUAL "win32")
+ set(UA_ARCHITECTURE_WIN32 1)
+ endif()
endif()
-if(${UA_ARCHITECTURE} STREQUAL "None")
- message(FATAL_ERROR "No architecture was selected. Please select the architecture of your target platform")
-endif(${UA_ARCHITECTURE} STREQUAL "None")
+#################
+# Build Options #
+#################
-# Create a list of ifdefs for all the architectures.
-# This is needed to enable a default architecture if none is selected through gcc compiler def.
-# Especially if someone is using the amalgamated file on Linux/Windows he should not need to define an architecture.
-set(UA_ARCHITECTURES_NODEF "1 ") #to make it easier to append later the && symbol
-foreach(arch_ ${architectures})
- string(TOUPPER ${arch_} UA_ARCHITECTURE_UPPER_)
- set(UA_ARCHITECTURES_NODEF "${UA_ARCHITECTURES_NODEF} && !defined(UA_ARCHITECTURE_${UA_ARCHITECTURE_UPPER_})")
-endforeach(arch_ ${architectures})
+# Set default build type.
+if(NOT CMAKE_BUILD_TYPE)
+ message(STATUS "CMAKE_BUILD_TYPE not given; setting to 'Debug'")
+ set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build" FORCE)
+endif()
-# Options
+option(UA_ENABLE_AMALGAMATION "Concatenate the library to a single file open62541.h/.c" OFF)
+option(UA_AMALGAMATION_MULTIARCH "Create an architecture-independent amalgamation if UA_ENABLE_AMALGAMATION is ON" OFF)
option(BUILD_SHARED_LIBS "Enable building of shared libraries (dll/so)" OFF)
-set(UA_LOGLEVEL 300 CACHE STRING "Level at which logs shall be reported")
-set(UA_MULTITHREADING 0 CACHE STRING "Level of multithreading (0-99: No Multithreading, >=100: Thread-Safe API")
-option(UA_ENABLE_DIAGNOSTICS "Enable diagnostics information exposed by the server" OFF)
+set(UA_LOGLEVEL 100 CACHE STRING "Minimal level for logs (in addition to the log plugin settings) (100=TRACE, 200=DEBUG, 300=INFO, 400=WARNING, 500=ERROR, 600=FATAL)")
+option(UA_ENABLE_DIAGNOSTICS "Enable diagnostics information exposed by the server" ON)
option(UA_ENABLE_METHODCALLS "Enable the Method service set" ON)
option(UA_ENABLE_SUBSCRIPTIONS "Enable subscriptions support" ON)
option(UA_ENABLE_SUBSCRIPTIONS_EVENTS "Enable event monitoring" ON)
option(UA_ENABLE_DA "Enable OPC UA DataAccess (Part 8) definitions" ON)
-option(UA_ENABLE_HISTORIZING "Enable basic support for historical access (client and server)" OFF)
-option(UA_ENABLE_DISCOVERY "Enable Discovery Service (LDS)" OFF)
-option(UA_ENABLE_JSON_ENCODING "Enable JSON encoding" OFF)
+option(UA_ENABLE_HISTORIZING "Enable basic support for historical access (client and server)" ON)
+option(UA_ENABLE_DISCOVERY "Enable Discovery Service (LDS)" ON)
+option(UA_ENABLE_JSON_ENCODING "Enable JSON encoding" ON)
+option(UA_ENABLE_XML_ENCODING "Enable XML encoding (EXPERIMENTAL)" OFF)
+option(UA_ENABLE_NODESETLOADER "Enable nodesetLoader public API" OFF)
+option(UA_ENABLE_DATATYPES_ALL "Generate all datatypes for namespace zero (uses more binary space)" ON)
+
+if(UA_INFORMATION_MODEL_AUTOLOAD AND NOT UA_ENABLE_NODESETLOADER AND NOT UA_BUILD_FUZZING)
+ set(UA_ENABLE_NODESET_INJECTOR ON)
+endif()
+
+set(MULTITHREADING_DEFAULT 0)
+if(WIN32 OR UNIX)
+ # Enable multithreading by default on Windows and POSIX-like (Unix) systems
+ set(MULTITHREADING_DEFAULT 100)
+endif()
+set(UA_MULTITHREADING ${MULTITHREADING_DEFAULT} CACHE STRING
+ "Multithreading support (<100: No multithreading support, >=100: Thread-safety enabled (internal mutexes)")
+
+option(UA_ENABLE_ALLOW_REUSEADDR "Enable reuseaddr (only for tests)" OFF)
+mark_as_advanced(UA_ENABLE_ALLOW_REUSEADDR)
option(UA_ENABLE_SUBSCRIPTIONS_ALARMS_CONDITIONS "Enable the use of A&C. (EXPERIMENTAL)" OFF)
mark_as_advanced(UA_ENABLE_SUBSCRIPTIONS_ALARMS_CONDITIONS)
@@ -168,21 +134,24 @@ mark_as_advanced(UA_ENABLE_NODEMANAGEMENT)
option(UA_ENABLE_PARSING "Utility functions that require parsing (e.g. NodeId expressions)" ON)
mark_as_advanced(UA_ENABLE_PARSING)
+option(UA_ENABLE_INLINABLE_EXPORT "Export 'static inline' methods as regular API" OFF)
+mark_as_advanced(UA_ENABLE_INLINABLE_EXPORT)
+
option(UA_ENABLE_DISCOVERY_MULTICAST "Enable Discovery Service with multicast support (LDS-ME)" OFF)
mark_as_advanced(UA_ENABLE_DISCOVERY_MULTICAST)
-option(UA_ENABLE_WEBSOCKET_SERVER "Enable websocket support (uses libwebsockets)" OFF)
-mark_as_advanced(UA_ENABLE_WEBSOCKET_SERVER)
-
# security provider
set(UA_ENCRYPTION_PLUGINS "MBEDTLS" "OPENSSL" "LIBRESSL")
-set(UA_ENABLE_ENCRYPTION "OFF" CACHE STRING "Encryption support (Libressl EXPERIMENTAL)")
+set(UA_ENABLE_ENCRYPTION "OFF" CACHE STRING "Encryption support (LibreSSL EXPERIMENTAL)")
SET_PROPERTY(CACHE UA_ENABLE_ENCRYPTION PROPERTY STRINGS "OFF" ${UA_ENCRYPTION_PLUGINS})
option(UA_ENABLE_ENCRYPTION_OPENSSL "Deprecated: Enable encryption support (uses openssl)" OFF)
mark_as_advanced(UA_ENABLE_ENCRYPTION_OPENSSL)
option(UA_ENABLE_ENCRYPTION_MBEDTLS "Deprecated: Enable encryption support (uses mbedTLS)" OFF)
mark_as_advanced(UA_ENABLE_ENCRYPTION_MBEDTLS)
+option(UA_ENABLE_CERT_REJECTED_DIR "Enable specifying directory for rejected certificates (with mbedTLS)" OFF)
+mark_as_advanced(UA_ENABLE_CERT_REJECTED_DIR)
+
list (FIND UA_ENCRYPTION_PLUGINS ${UA_ENABLE_ENCRYPTION} _tmp)
if(UA_ENABLE_ENCRYPTION STREQUAL "OFF" OR ${_tmp} GREATER -1)
set(UA_ENABLE_ENCRYPTION_OPENSSL OFF)
@@ -249,8 +218,8 @@ if(UA_ENABLE_TPM2_KEYSTORE)
endif()
# Namespace Zero
-set(UA_NAMESPACE_ZERO "REDUCED" CACHE STRING "Completeness of the generated namespace zero (minimal/reduced/full/latest_1_05)")
-SET_PROPERTY(CACHE UA_NAMESPACE_ZERO PROPERTY STRINGS "MINIMAL" "REDUCED" "FULL" "LATEST_1_05")
+set(UA_NAMESPACE_ZERO "REDUCED" CACHE STRING "Completeness of the generated namespace zero (minimal/reduced/full)")
+SET_PROPERTY(CACHE UA_NAMESPACE_ZERO PROPERTY STRINGS "MINIMAL" "REDUCED" "FULL")
if(UA_NAMESPACE_ZERO STREQUAL "MINIMAL")
set(UA_GENERATED_NAMESPACE_ZERO OFF)
else()
@@ -263,12 +232,6 @@ else()
set(UA_GENERATED_NAMESPACE_ZERO_FULL OFF)
endif()
-if(UA_NAMESPACE_ZERO STREQUAL "LATEST_1_05")
- set(UA_GENERATED_NAMESPACE_ZERO_LATEST_1_05 ON)
-else()
- set(UA_GENERATED_NAMESPACE_ZERO_LATEST_1_05 OFF)
-endif()
-
if(MSVC AND UA_NAMESPACE_ZERO STREQUAL "FULL")
# For the full NS0 we need a stack size of 8MB (as it is default on linux)
# See https://github.com/open62541/open62541/issues/1326
@@ -298,14 +261,15 @@ if((UA_ENABLE_SUBSCRIPTIONS_ALARMS_CONDITIONS) AND (NOT (UA_ENABLE_SUBSCRIPTIONS
endif()
if(UA_ENABLE_COVERAGE)
- set(CMAKE_BUILD_TYPE DEBUG)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
+ # We are using the scripts provided at for coverage testing: https://github.com/RWTH-HPC/CMake-codecov
+ set(ENABLE_COVERAGE ON)
+ find_package(codecov REQUIRED)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
endif()
if(UA_ENABLE_CLANG_COV)
- if(NOT "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang")
+ if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
message(FATAL_ERROR "Compiler must be clang when compiling for llvm-cov")
endif()
if(UA_ENABLE_COVERAGE)
@@ -333,57 +297,30 @@ mark_as_advanced(UA_ENABLE_QUERY)
option(UA_ENABLE_IMMUTABLE_NODES "Nodes in the information model are not edited but copied and replaced" OFF)
mark_as_advanced(UA_ENABLE_IMMUTABLE_NODES)
-option(UA_ENABLE_EXPERIMENTAL_HISTORIZING "Enable support for experimental historical access features (client)" OFF)
-mark_as_advanced(UA_ENABLE_EXPERIMENTAL_HISTORIZING)
-
option(UA_FORCE_32BIT "Force compilation as 32-bit executable" OFF)
mark_as_advanced(UA_FORCE_32BIT)
-option(UA_FORCE_CPP "Force compilation with a C++ compiler" OFF)
-mark_as_advanced(UA_FORCE_CPP)
-if(UA_FORCE_CPP)
- enable_language(CXX)
- add_definitions(-D__STDC_CONSTANT_MACROS) # We need the UINT32_C define
-endif()
+option(UA_FORCE_WERROR "Force compilation with -Werror (or /WX on MSVC)" OFF)
-option(UA_FORCE_WERROR "Force compilation with -Werror (or /WX on MSVC)" ON)
+option(UA_ENABLE_DEBUG_SANITIZER "Use sanitizer in debug mode" ON)
+mark_as_advanced(UA_ENABLE_DEBUG_SANITIZER)
-#General PubSub setup
-option(UA_ENABLE_PUBSUB "Enable the PubSub protocol" OFF)
+# General PubSub setup
+option(UA_ENABLE_PUBSUB "Enable the PubSub protocol" ON)
option(UA_ENABLE_PUBSUB_ENCRYPTION "Enable encryption of the PubSub payload" OFF)
mark_as_advanced(UA_ENABLE_PUBSUB_ENCRYPTION)
-option(UA_ENABLE_PUBSUB_INFORMATIONMODEL "Enable PubSub information model twin" OFF)
-
-option(UA_ENABLE_PUBSUB_INFORMATIONMODEL_METHODS "Enable PubSub informationmodel methods" OFF)
-
-option(UA_ENABLE_PUBSUB_DELTAFRAMES "Enable sending of delta frames with only the changes" OFF)
-
-option(UA_ENABLE_PUBSUB_FILE_CONFIG "Enable loading PubSub Config from file extension" OFF)
-mark_as_advanced(UA_ENABLE_PUBSUB_FILE_CONFIG)
-
-option(UA_ENABLE_PUBSUB_MONITORING "Enable monitoring of PubSub components (e.g. MessageReceiveTimeout)" OFF)
-mark_as_advanced(UA_ENABLE_PUBSUB_MONITORING)
-
-option(UA_ENABLE_PUBSUB_BUFMALLOC "Enable allocation with static memory buffer for time critical PubSub parts" OFF)
-mark_as_advanced(UA_ENABLE_PUBSUB_BUFMALLOC)
-
-#RT and Transport PubSub settings
-option(UA_ENABLE_PUBSUB_ETH_UADP "Enable publish/subscribe UADP over Ethernet" OFF)
-
-if(UA_ENABLE_PUBSUB_ETH_UADP)
- if(NOT CMAKE_SYSTEM MATCHES "Linux")
- message(FATAL_ERROR "UADP over Ethernet is only available on Linux.")
- endif()
-endif()
-
-if(UA_ENABLE_PUBSUB_INFORMATIONMODEL_METHODS)
- if(NOT UA_ENABLE_PUBSUB_INFORMATIONMODEL)
- message(FATAL_ERROR "PubSub information model methods cannot be used with disabled PubSub information model.")
+option(UA_ENABLE_PUBSUB_SKS "Enable Security Key Service support for publisher and subscriber" OFF)
+mark_as_advanced(UA_ENABLE_PUBSUB_SKS)
+if(UA_ENABLE_PUBSUB_SKS)
+ message(WARNING "The PubSub SKS feature is under development and not yet ready.")
+ if(NOT UA_ENABLE_PUBSUB_ENCRYPTION)
+ message(FATAL_ERROR "PubSub SKS cannot be used with disabled UA_ENABLE_PUBSUB_ENCRYPTION")
endif()
endif()
+option(UA_ENABLE_PUBSUB_INFORMATIONMODEL "Enable PubSub information model twin" ON)
if(UA_ENABLE_PUBSUB_INFORMATIONMODEL)
if(NOT UA_ENABLE_PUBSUB)
message(FATAL_ERROR "PubSub information model representation cannot be used with disabled PubSub function.")
@@ -393,22 +330,24 @@ if(UA_ENABLE_PUBSUB_INFORMATIONMODEL)
endif()
endif()
-if(UA_ENABLE_PUBSUB AND UA_MULTITHREADING GREATER_EQUAL 100)
- MESSAGE(WARNING "PubSub is not thread-safe for the 1.3 releases. Switch to a more current release for this feature.")
-endif()
-
+option(UA_ENABLE_PUBSUB_FILE_CONFIG "Enable loading PubSub Config from file extension" OFF)
+mark_as_advanced(UA_ENABLE_PUBSUB_FILE_CONFIG)
if(UA_ENABLE_PUBSUB_FILE_CONFIG)
if(NOT UA_ENABLE_PUBSUB)
- message(FATAL_ERROR "PubSub needs to be enabled")
+ message(FATAL_ERROR "For UA_ENABLE_PUBSUB_FILE_CONFIG PubSub needs to be enabled")
endif()
endif()
+option(UA_ENABLE_PUBSUB_MONITORING "Enable monitoring of PubSub components (e.g. MessageReceiveTimeout)" OFF)
+mark_as_advanced(UA_ENABLE_PUBSUB_MONITORING)
if(UA_ENABLE_PUBSUB_MONITORING)
if(NOT UA_ENABLE_PUBSUB)
message(FATAL_ERROR "PubSub monitoring cannot be used with PubSub function disabled")
endif()
endif()
+option(UA_ENABLE_PUBSUB_BUFMALLOC "Enable allocation with static memory buffer for time critical PubSub parts" OFF)
+mark_as_advanced(UA_ENABLE_PUBSUB_BUFMALLOC)
if(UA_ENABLE_PUBSUB_BUFMALLOC)
if(NOT UA_ENABLE_PUBSUB)
message(FATAL_ERROR "PubSub buffer allocation cannot be used with PubSub function disabled")
@@ -416,54 +355,25 @@ if(UA_ENABLE_PUBSUB_BUFMALLOC)
if(NOT UA_ENABLE_MALLOC_SINGLETON)
message(FATAL_ERROR "PubSub buffer allocation cannot be used without 'UA_ENABLE_MALLOC_SINGLETON' enabled")
endif()
+ if(UA_ENABLE_PUBSUB_MONITORING)
+ message(WARNING "PubSub monitoring option 'UA_ENABLE_PUBSUB_MONITORING' can only be used with option 'UA_ENABLE_PUBSUB_BUFMALLOC' if "
+ "a custom monitoring interface is provided, which does not allocate/deallocate memory at start/stopMonitoring callback. "
+ "It can't be used with the built-in ua_timer implementation, because this leads to memory deallocation problems.")
+ endif()
endif()
-option(UA_ENABLE_PUBSUB_MQTT "Enable publish/subscribe with mqtt (experimental)" OFF)
-mark_as_advanced(UA_ENABLE_PUBSUB_MQTT)
-if(UA_ENABLE_PUBSUB_MQTT)
- if(NOT UA_FILE_MQTT)
- set(UA_FILE_MQTT ${open62541_MQTT_DIR}/src/mqtt.c)
- endif()
+option(UA_ENABLE_MQTT "Enable MQTT connections for the EventLoop" OFF)
+mark_as_advanced(UA_ENABLE_MQTT)
+if(UA_ENABLE_MQTT)
if(NOT EXISTS "${UA_FILE_MQTT}")
- message(FATAL_ERROR "File ${UA_FILE_MQTT} not found.You probably need to initialize the git submodule for deps/mqtt-c.Therefore execute the following command \ngit submodule update --init --recursive")
- else()
- # Warn if run in Windows
- if(WIN32)
- MESSAGE(WARNING "Multithreading is enabled in MQTT plugin. This feature is under development and marked as EXPERIMENTAL")
- endif()
- if(NOT UA_ENABLE_PUBSUB)
- message(FATAL_ERROR "Mqtt cannot be used with disabled PubSub function.")
+ message(STATUS "Submodule update")
+ execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
+ RESULT_VARIABLE GIT_SUBMOD_RESULT)
+ if(NOT GIT_SUBMOD_RESULT EQUAL "0")
+ message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}")
endif()
- configure_file(${PROJECT_SOURCE_DIR}/deps/mqtt-c/include/mqtt.h "${PROJECT_BINARY_DIR}/src_generated/mqtt.h" COPYONLY)
- configure_file(${PROJECT_SOURCE_DIR}/deps/mqtt-c/include/mqtt_pal.h "${PROJECT_BINARY_DIR}/src_generated/mqtt_pal.h" COPYONLY)
- configure_file(${PROJECT_SOURCE_DIR}/plugins/mqtt/templates/posix_sockets.h "${PROJECT_BINARY_DIR}/src_generated/posix_sockets.h" COPYONLY)
- endif()
-endif()
-
-option(UA_ENABLE_MQTT_TLS_OPENSSL "Enable TLS support for publish/subscribe with mqtt (use OpenSSL)" OFF)
-mark_as_advanced(UA_ENABLE_MQTT_TLS_OPENSSL)
-option(UA_ENABLE_MQTT_TLS_MBEDTLS "Enable TLS support for publish/subscribe with mqtt (use MBEDTLS)" OFF)
-mark_as_advanced(UA_ENABLE_MQTT_TLS_MBEDTLS)
-
-option(UA_ENABLE_MQTT_TLS "Enable TLS support for publish/subscribe with mqtt" OFF)
-mark_as_advanced(UA_ENABLE_MQTT_TLS)
-if(UA_ENABLE_MQTT_TLS)
- if(NOT UA_ENABLE_PUBSUB_MQTT)
- message(FATAL_ERROR "Mqtt with TLS cannot be used without UA_ENABLE_PUBSUB_MQTT.")
- endif()
- if(NOT UA_ENABLE_ENCRYPTION)
- message(FATAL_ERROR "Mqtt with TLS cannot be used without UA_ENABLE_ENCRYPTION.")
- elseif(UA_ENABLE_ENCRYPTION STREQUAL "OPENSSL")
- set(UA_ENABLE_MQTT_TLS_OPENSSL ON)
- add_definitions(-DMQTT_USE_BIO)
- configure_file(${PROJECT_SOURCE_DIR}/plugins/mqtt/templates/openssl_sockets.h "${PROJECT_BINARY_DIR}/src_generated/openssl_sockets.h" COPYONLY)
- elseif(UA_ENABLE_ENCRYPTION STREQUAL "MBEDTLS")
- set(UA_ENABLE_MQTT_TLS_MBEDTLS ON)
- add_definitions(-DMQTT_USE_MBEDTLS)
- configure_file(${PROJECT_SOURCE_DIR}/plugins/mqtt/templates/mbedtls_sockets.h "${PROJECT_BINARY_DIR}/src_generated/mbedtls_sockets.h" COPYONLY)
- else()
- message(FATAL_ERROR "UA_ENABLE_ENCRYPTION is set to an undefined value")
endif()
+ include_directories("${PROJECT_SOURCE_DIR}/deps/mqtt-c/include")
endif()
option(UA_ENABLE_STATUSCODE_DESCRIPTIONS "Enable conversion of StatusCode to human-readable error message" ON)
@@ -482,9 +392,6 @@ option(UA_ENABLE_MALLOC_SINGLETON
"Use a global variable pointer for malloc (and free, ...) that can be switched at runtime" OFF)
mark_as_advanced(UA_ENABLE_MALLOC_SINGLETON)
-option(UA_ENABLE_VALGRIND_INTERACTIVE "Enable dumping valgrind every iteration. CAUTION! SLOWDOWN!" OFF)
-mark_as_advanced(UA_ENABLE_VALGRIND_INTERACTIVE)
-
option(UA_MSVC_FORCE_STATIC_CRT "Force linking with the static C-runtime library when compiling to static library with MSVC" ON)
mark_as_advanced(UA_MSVC_FORCE_STATIC_CRT)
@@ -506,13 +413,6 @@ mark_as_advanced(UA_ENABLE_DISCOVERY_SEMAPHORE)
option(UA_ENABLE_UNIT_TESTS_MEMCHECK "Use Valgrind (Linux) or DrMemory (Windows) to detect memory leaks when running the unit tests" OFF)
mark_as_advanced(UA_ENABLE_UNIT_TESTS_MEMCHECK)
-option(UA_ENABLE_UNIT_TEST_FAILURE_HOOKS
- "Add hooks to force failure modes for additional unit tests. Not for production use!" OFF)
-mark_as_advanced(UA_ENABLE_UNIT_TEST_FAILURE_HOOKS)
-
-set(UA_VALGRIND_INTERACTIVE_INTERVAL 1000 CACHE STRING "The number of iterations to wait before creating the next dump")
-mark_as_advanced(UA_VALGRIND_INTERACTIVE_INTERVAL)
-
# Build options for debugging
option(UA_DEBUG "Enable assertions and additional functionality that should not be included in release builds" OFF)
mark_as_advanced(UA_DEBUG)
@@ -550,12 +450,6 @@ if(UA_BUILD_FUZZING)
add_definitions(-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
endif()
-if(UA_ENABLE_EXPERIMENTAL_HISTORIZING)
- if(NOT UA_ENABLE_HISTORIZING)
- message(FATAL_ERROR "UA_ENABLE_EXPERIMENTAL_HISTORIZING cannot be used with disabled UA_ENABLE_HISTORIZING.")
- endif()
-endif()
-
option(UA_BUILD_FUZZING_CORPUS "Build the fuzzing corpus" OFF)
mark_as_advanced(UA_BUILD_FUZZING_CORPUS)
if(UA_BUILD_FUZZING_CORPUS)
@@ -567,9 +461,9 @@ endif()
option(UA_BUILD_OSS_FUZZ "Special build switch used in oss-fuzz" OFF)
mark_as_advanced(UA_BUILD_OSS_FUZZ)
-# Advanced Build Targets
-option(UA_PACK_DEBIAN "Special build switch used in .deb packaging" OFF)
-mark_as_advanced(UA_PACK_DEBIAN)
+##########################
+# Advanced Build Targets #
+##########################
# Building shared libs (dll, so). This option is written into ua_config.h.
set(UA_DYNAMIC_LINKING OFF)
@@ -589,32 +483,54 @@ if(UA_ENABLE_SUBSCRIPTIONS_EVENTS AND (NOT UA_ENABLE_SUBSCRIPTIONS))
set(UA_ENABLE_SUBSCRIPTIONS_EVENTS OFF)
endif()
-########################
-# Linting during build #
-########################
-set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
-include(linting_build)
+if(UA_ENABLE_HISTORIZING AND (NOT UA_ENABLE_SUBSCRIPTIONS))
+ MESSAGE(FATAL_ERROR "UA_ENABLE_HISTORIZING needs Subscriptions enabled")
+endif()
######################
# External Libraries #
######################
-list(APPEND open62541_LIBRARIES "")
+set(open62541_LIBRARIES "")
+set(open62541_PUBLIC_LIBRARIES "")
+set(pkgcfg_libsprivate "")
+set(pkgcfg_requiresprivate "")
+if("${UA_ARCHITECTURE}" STREQUAL "posix")
+ list(APPEND open62541_LIBRARIES "m")
+ list(APPEND pkgcfg_libsprivate "-lm")
+ if(UA_MULTITHREADING GREATER_EQUAL 100 OR UA_BUILD_UNIT_TESTS)
+ list(APPEND open62541_PUBLIC_LIBRARIES "pthread")
+ list(APPEND pkgcfg_libsprivate "-lpthread")
+ endif()
+ if(NOT APPLE AND (NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD"))
+ list(APPEND open62541_LIBRARIES "rt")
+ list(APPEND pkgcfg_libsprivate "-lrt")
+ endif()
+elseif("${UA_ARCHITECTURE}" STREQUAL "win32")
+ list(APPEND open62541_LIBRARIES "ws2_32")
+ list(APPEND open62541_LIBRARIES "iphlpapi")
+endif()
-if(UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_MQTT_TLS_OPENSSL)
+if(UA_ENABLE_ENCRYPTION_OPENSSL)
# use the OpenSSL encryption library
- # https://cmake.org/cmake/help/v3.0/module/FindOpenSSL.html
+ # https://cmake.org/cmake/help/v3.13/module/FindOpenSSL.html
find_package(OpenSSL REQUIRED)
- list(APPEND open62541_LIBRARIES ${OPENSSL_LIBRARIES})
- endif ()
+ list(APPEND open62541_LIBRARIES "${OPENSSL_LIBRARIES}")
+ list(APPEND pkgcfg_requiresprivate "openssl")
+ if(WIN32)
+ # Add bestcrypt for windows systems
+ list(APPEND open62541_LIBRARIES bcrypt)
+ endif()
+endif()
if(UA_ENABLE_ENCRYPTION_LIBRESSL)
# See https://github.com/libressl-portable/portable/blob/master/FindLibreSSL.cmake
find_package(LibreSSL REQUIRED)
list(APPEND open62541_LIBRARIES ${LIBRESSL_LIBRARIES})
+ list(APPEND pkgcfg_requiresprivate "openssl")
if(WIN32)
- # Add bestcrypt for random generator
- list(APPEND open62541_LIBRARIES bcrypt)
+ # Add bestcrypt for random generator and ws2_32 for crypto
+ list(APPEND open62541_LIBRARIES ws2_32 bcrypt)
endif()
endif()
@@ -624,26 +540,21 @@ if(UA_ENABLE_ENCRYPTION_MBEDTLS OR UA_ENABLE_PUBSUB_ENCRYPTION)
# defined in /tools/cmake/FindMbedTLS.cmake.
find_package(MbedTLS REQUIRED)
list(APPEND open62541_LIBRARIES ${MBEDTLS_LIBRARIES})
+ list(APPEND pkgcfg_requiresprivate "mbedtls")
+ if(WIN32)
+ # Add bestcrypt for windows systems
+ list(APPEND open62541_LIBRARIES bcrypt)
+ endif()
endif()
if(UA_ENABLE_TPM2_SECURITY)
list(APPEND open62541_LIBRARIES ${TPM2_LIB})
-endif()
-
-if(UA_ENABLE_WEBSOCKET_SERVER)
- # The recommended way is to install libwebsockets via the OS package manager. If
- # that is not possible, manually compile libwebsockets and set the cmake variables
- # defined in /tools/cmake/Findlibwebsockets.cmake
- find_package(libwebsockets REQUIRED)
- list(APPEND open62541_LIBRARIES ${LIBWEBSOCKETS_LIBRARIES})
-
- set(ua_architecture_directories_to_include ${ua_architecture_directories_to_include}
- ${LIBWEBSOCKETS_INCLUDE_DIR})
+ list(APPEND pkgcfg_requiresprivate "tpm2-pkcs11")
endif()
if(MINGW)
# GCC stack protector support
- list(APPEND open62541_LIBRARIES ssp)
+ list(APPEND open62541_LIBRARIES ws2_32 ssp)
endif()
if(WIN32)
@@ -672,29 +583,43 @@ function(check_add_cc_flag CC_FLAG)
message(STATUS "Test CC flag ${CC_FLAG}")
check_c_compiler_flag("${CC_FLAG}" flag_supported)
if(flag_supported)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CC_FLAG}" PARENT_SCOPE)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CC_FLAG}" CACHE INTERNAL "C Compiler Flags")
endif()
unset(flag_supported CACHE)
endif()
endfunction()
+function(add_cc_flag CC_FLAG)
+ string(FIND "${CMAKE_C_FLAGS}" "${CC_FLAG}" flag_already_set)
+ if(flag_already_set EQUAL -1)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CC_FLAG}" CACHE INTERNAL "C Compiler Flags")
+ endif()
+endfunction()
-if(NOT UA_FORCE_CPP AND (CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang"))
+if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
check_add_cc_flag("-std=c99") # C99 mode
check_add_cc_flag("-pipe") # Avoid writing temporary files (for compiler speed)
check_add_cc_flag("-Wall") # Warnings
check_add_cc_flag("-Wextra") # More warnings
check_add_cc_flag("-Wpedantic") # Standard compliance
if(UA_FORCE_WERROR)
- check_add_cc_flag("-Werror") # All warnings are errors
+ check_add_cc_flag("-Werror") # All warnings are errors
+ check_add_cc_flag("-Wunused-command-line-argument") # Warning for command line args instead of error
endif()
check_add_cc_flag("-Wno-static-in-inline") # Clang doesn't like the use of static inline methods inside static inline methods
check_add_cc_flag("-Wno-overlength-strings") # May happen in the nodeset compiler when complex values are directly encoded
check_add_cc_flag("-Wno-unused-parameter") # some methods may require unused arguments to cast to a method pointer
+ check_add_cc_flag("-Wno-maybe-uninitialized") # too many false positives
# Use a strict subset of the C and C++ languages
check_add_cc_flag("-Wc++-compat")
+ # Wc++-compat enables additional goto/jump restrictions.
+ # But modern compilers do a detailed analysis of values
+ # are actually used uninitialized after a jump:
+ # TODO: The following flag should not be required
+ check_add_cc_flag("-Wno-jump-misses-init")
+
# Check that format strings (printf/scanf) are sane
check_add_cc_flag("-Wformat")
check_add_cc_flag("-Wformat-security")
@@ -717,37 +642,33 @@ if(NOT UA_FORCE_CPP AND (CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID}" ST
# Generate position-independent code for shared libraries (adds a performance penalty)
if(BUILD_SHARED_LIBS)
- check_add_cc_flag("-fPIC")
+ add_cc_flag("-fPIC")
+ endif()
+
+ if(UA_MULTITHREADING GREATER_EQUAL 100 AND NOT WIN32)
+ check_add_cc_flag("-pthread")
endif()
# Force 32bit build
if(UA_FORCE_32BIT)
- check_add_cc_flag("-m32")
- endif()
-
- if(NOT MINGW AND NOT UA_BUILD_OSS_FUZZ)
- if(UA_ENABLE_HARDENING)
- check_add_cc_flag("-fstack-protector-strong") # more performant stack protector, available since gcc 4.9
- check_add_cc_flag("-fstack-clash-protection") # increased reliability of stack overflow detection, available since gcc 8
- # future use (control flow integrity protection)
- if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
- check_add_cc_flag("-mcet")
- check_add_cc_flag("-fcf-protection")
- endif()
+ if(MSVC)
+ message(FATAL_ERROR "Select the 32bit (cross-) compiler instead of forcing compiler options")
endif()
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32") # GCC and Clang, possibly more
+ endif()
- # IPO requires too much memory for unit tests
- # GCC docu recommends to compile all files with the same options, therefore ignore it completely
- if(NOT UA_BUILD_UNIT_TESTS AND NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION)
- # needed to check if IPO is supported (check needs cmake > 3.9)
- if("${CMAKE_VERSION}" VERSION_GREATER 3.9)
- cmake_policy(SET CMP0069 NEW) # needed as long as required cmake < 3.9
- include(CheckIPOSupported)
- check_ipo_supported(RESULT CC_HAS_IPO) # Inter Procedural Optimization / Link Time Optimization (should be same as -flto)
- if(CC_HAS_IPO)
- set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
- endif()
- endif()
+ if(UA_ENABLE_HARDENING)
+ check_add_cc_flag("-fhardened") # See the GCC docs on which precise flags this enables
+ endif()
+
+ # Inter Procedural Optimization / Link Time Optimization (should be same as -flto)
+ # IPO requires too much memory for unit tests
+ # GCC docu recommends to compile all files with the same options, therefore ignore it completely
+ if(NOT UA_BUILD_UNIT_TESTS AND NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION)
+ include(CheckIPOSupported)
+ check_ipo_supported(RESULT CC_HAS_IPO)
+ if(CC_HAS_IPO)
+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
endif()
endif()
@@ -755,31 +676,23 @@ if(NOT UA_FORCE_CPP AND (CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID}" ST
add_definitions(-Wno-unused-function)
endif()
- if(UA_PACK_DEBIAN)
- remove_definitions(-Wno-static-in-inline)
- endif()
-
# Linker
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # cmake sets -rdynamic by default
# Debug
- if(BUILD_TYPE_LOWER_CASE STREQUAL "debug" AND UNIX AND NOT UA_BUILD_OSS_FUZZ AND
- "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang" AND NOT UA_ENABLE_UNIT_TESTS_MEMCHECK)
+ if(UA_ENABLE_DEBUG_SANITIZER AND BUILD_TYPE_LOWER_CASE STREQUAL "debug" AND UNIX AND NOT UA_BUILD_OSS_FUZZ AND
+ CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT UA_ENABLE_UNIT_TESTS_MEMCHECK)
# Add default sanitizer settings when using clang and Debug build.
# This allows e.g. CLion to find memory locations for SegFaults
message(STATUS "Sanitizer enabled")
set(SANITIZER_FLAGS "-g -fno-omit-frame-pointer -gline-tables-only -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=leak -fsanitize=undefined")
- if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
+ if(CMAKE_CXX_COMPILER_VERSION AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
set(SANITIZER_FLAGS "${SANITIZER_FLAGS} -fsanitize-coverage=trace-pc-guard")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER_FLAGS}")
endif()
- if(NOT MINGW AND UA_ENABLE_HARDENING AND ((CMAKE_BUILD_TYPE STREQUAL "Release") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")))
- check_add_cc_flag("-D_FORTIFY_SOURCE=2") # run-time buffer overflow detection (needs at least -O1)
- endif()
-
# Strip release builds
if(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" OR CMAKE_BUILD_TYPE STREQUAL "Release")
check_add_cc_flag("-ffunction-sections")
@@ -848,51 +761,8 @@ file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/src_generated")
# Generate the config.h
configure_file(include/open62541/config.h.in ${PROJECT_BINARY_DIR}/src_generated/open62541/config.h)
-# Generate a .pc file for pkg-config
-configure_file(tools/open62541.pc.in ${PROJECT_BINARY_DIR}/src_generated/open62541.pc @ONLY)
-
-if(UA_ENABLE_DISCOVERY_MULTICAST)
- include(GenerateExportHeader)
- set(MDNSD_LOGLEVEL 300 CACHE STRING "Level at which logs shall be reported" FORCE)
- # create a "fake" empty library to generate the export header macros
- add_library(libmdnsd ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/mdnsd.h)
- if (UA_FORCE_CPP)
- set_property(TARGET libmdnsd PROPERTY LINKER_LANGUAGE CXX)
- else()
- set_property(TARGET libmdnsd PROPERTY LINKER_LANGUAGE C)
- endif()
- set_property(TARGET libmdnsd PROPERTY DEFINE_SYMBOL "MDNSD_DYNAMIC_LINKING_EXPORT")
- configure_file("deps/mdnsd/libmdnsd/mdnsd_config_extra.in"
- "${PROJECT_BINARY_DIR}/src_generated/mdnsd_config_extra")
- file(READ "${PROJECT_BINARY_DIR}/src_generated/mdnsd_config_extra" MDNSD_CONFIG_EXTRA)
- generate_export_header(libmdnsd
- EXPORT_FILE_NAME "${PROJECT_BINARY_DIR}/src_generated/mdnsd_config.h"
- BASE_NAME MDNSD
- DEFINE_NO_DEPRECATED
- CUSTOM_CONTENT_FROM_VARIABLE MDNSD_CONFIG_EXTRA)
-endif()
-
-set(exported_headers ${ua_architecture_headers_beginning})
-
-if(NOT "${UA_AMALGAMATION_ARCHITECTURES}" STREQUAL "")
- foreach(arch ${UA_AMALGAMATION_ARCHITECTURES})
- list(APPEND exported_headers ${PROJECT_SOURCE_DIR}/arch/${arch}/ua_architecture.h)
- endforeach()
-else()
- list(APPEND exported_headers ${PROJECT_SOURCE_DIR}/arch/${UA_ARCHITECTURE}/ua_architecture.h)
-endif()
-
-
-if(UA_ENABLE_HISTORIZING)
- # Historizing needs to be included before server.h
- set(historizing_exported_headers
- ${PROJECT_SOURCE_DIR}/include/open62541/plugin/historydatabase.h)
-endif()
-
+# Exported headers
set(exported_headers ${PROJECT_BINARY_DIR}/src_generated/open62541/config.h
- ${PROJECT_SOURCE_DIR}/deps/ms_stdint.h
- ${PROJECT_SOURCE_DIR}/include/open62541/architecture_definitions.h
- ${exported_headers}
${PROJECT_BINARY_DIR}/src_generated/open62541/statuscodes.h
${PROJECT_BINARY_DIR}/src_generated/open62541/nodeids.h
${PROJECT_SOURCE_DIR}/include/open62541/common.h
@@ -901,57 +771,54 @@ set(exported_headers ${PROJECT_BINARY_DIR}/src_generated/open62541/config.h
${PROJECT_BINARY_DIR}/src_generated/open62541/types_generated_handling.h
${PROJECT_SOURCE_DIR}/include/open62541/util.h
${PROJECT_SOURCE_DIR}/include/open62541/plugin/log.h
- ${PROJECT_SOURCE_DIR}/include/open62541/plugin/network.h
${PROJECT_SOURCE_DIR}/include/open62541/plugin/accesscontrol.h
${PROJECT_SOURCE_DIR}/include/open62541/plugin/pki.h
${PROJECT_SOURCE_DIR}/include/open62541/plugin/securitypolicy.h
- ${PROJECT_SOURCE_DIR}/include/open62541/plugin/pubsub.h
- ${PROJECT_SOURCE_DIR}/deps/ziptree.h
- ${PROJECT_SOURCE_DIR}/deps/aa_tree.h
+ ${PROJECT_SOURCE_DIR}/include/open62541/plugin/eventloop.h
${PROJECT_SOURCE_DIR}/include/open62541/plugin/nodestore.h
- ${historizing_exported_headers}
+ ${PROJECT_SOURCE_DIR}/include/open62541/plugin/historydatabase.h
${PROJECT_SOURCE_DIR}/include/open62541/server_pubsub.h
- ${PROJECT_SOURCE_DIR}/include/open62541/server.h
${PROJECT_SOURCE_DIR}/include/open62541/client.h
+ ${PROJECT_SOURCE_DIR}/include/open62541/server.h
${PROJECT_SOURCE_DIR}/include/open62541/client_highlevel.h
${PROJECT_SOURCE_DIR}/include/open62541/client_subscriptions.h
${PROJECT_SOURCE_DIR}/include/open62541/client_highlevel_async.h)
-set(internal_headers ${PROJECT_SOURCE_DIR}/deps/open62541_queue.h
- ${PROJECT_SOURCE_DIR}/deps/pcg_basic.h
- ${PROJECT_SOURCE_DIR}/deps/libc_time.h
- ${PROJECT_SOURCE_DIR}/deps/base64.h
- ${PROJECT_SOURCE_DIR}/src/ua_types_encoding_binary.h
- ${PROJECT_SOURCE_DIR}/src/ua_util_internal.h
- ${PROJECT_BINARY_DIR}/src_generated/open62541/transport_generated.h
- ${PROJECT_BINARY_DIR}/src_generated/open62541/transport_generated_handling.h
- ${PROJECT_SOURCE_DIR}/src/ua_connection_internal.h
- ${PROJECT_SOURCE_DIR}/src/ua_securechannel.h
- ${PROJECT_SOURCE_DIR}/src/ua_timer.h
- ${PROJECT_SOURCE_DIR}/src/server/ua_session.h
- ${PROJECT_SOURCE_DIR}/src/server/ua_subscription.h
- ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_networkmessage.h
- ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub.h
- ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_manager.h
- ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_ns0.h
- ${PROJECT_SOURCE_DIR}/src/server/ua_server_async.h
- ${PROJECT_SOURCE_DIR}/src/server/ua_server_internal.h
- ${PROJECT_SOURCE_DIR}/src/server/ua_services.h
- ${PROJECT_SOURCE_DIR}/src/client/ua_client_internal.h
- ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_config.h)
-
-# TODO: make client optional
+# Main Library
+
+set(lib_headers ${PROJECT_SOURCE_DIR}/deps/open62541_queue.h
+ ${PROJECT_SOURCE_DIR}/deps/pcg_basic.h
+ ${PROJECT_SOURCE_DIR}/deps/libc_time.h
+ ${PROJECT_SOURCE_DIR}/deps/base64.h
+ ${PROJECT_SOURCE_DIR}/deps/dtoa.h
+ ${PROJECT_SOURCE_DIR}/deps/mp_printf.h
+ ${PROJECT_SOURCE_DIR}/deps/itoa.h
+ ${PROJECT_SOURCE_DIR}/deps/ziptree.h
+ ${PROJECT_SOURCE_DIR}/src/ua_types_encoding_binary.h
+ ${PROJECT_SOURCE_DIR}/src/ua_util_internal.h
+ ${PROJECT_BINARY_DIR}/src_generated/open62541/transport_generated.h
+ ${PROJECT_BINARY_DIR}/src_generated/open62541/transport_generated_handling.h
+ ${PROJECT_SOURCE_DIR}/src/ua_securechannel.h
+ ${PROJECT_SOURCE_DIR}/src/server/ua_session.h
+ ${PROJECT_SOURCE_DIR}/src/server/ua_subscription.h
+ ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_networkmessage.h
+ ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub.h
+ ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_ns0.h
+ ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_keystorage.h
+ ${PROJECT_SOURCE_DIR}/src/server/ua_server_async.h
+ ${PROJECT_SOURCE_DIR}/src/server/ua_server_internal.h
+ ${PROJECT_SOURCE_DIR}/src/server/ua_services.h
+ ${PROJECT_SOURCE_DIR}/src/client/ua_client_internal.h)
+
set(lib_sources ${PROJECT_SOURCE_DIR}/src/ua_types.c
${PROJECT_SOURCE_DIR}/src/ua_types_encoding_binary.c
- ${PROJECT_SOURCE_DIR}/src/ua_types_print.c
${PROJECT_BINARY_DIR}/src_generated/open62541/types_generated.c
${PROJECT_BINARY_DIR}/src_generated/open62541/transport_generated.c
${PROJECT_BINARY_DIR}/src_generated/open62541/statuscodes.c
${PROJECT_SOURCE_DIR}/src/ua_util.c
- ${PROJECT_SOURCE_DIR}/src/ua_timer.c
- ${PROJECT_SOURCE_DIR}/src/ua_connection.c
${PROJECT_SOURCE_DIR}/src/ua_securechannel.c
${PROJECT_SOURCE_DIR}/src/ua_securechannel_crypto.c
+ # server
${PROJECT_SOURCE_DIR}/src/server/ua_session.c
${PROJECT_SOURCE_DIR}/src/server/ua_nodes.c
${PROJECT_SOURCE_DIR}/src/server/ua_server.c
@@ -960,16 +827,7 @@ set(lib_sources ${PROJECT_SOURCE_DIR}/src/ua_types.c
${PROJECT_SOURCE_DIR}/src/server/ua_server_config.c
${PROJECT_SOURCE_DIR}/src/server/ua_server_binary.c
${PROJECT_SOURCE_DIR}/src/server/ua_server_utils.c
- ${PROJECT_SOURCE_DIR}/src/server/ua_server_discovery.c
${PROJECT_SOURCE_DIR}/src/server/ua_server_async.c
- ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_networkmessage.c
- ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_writer.c
- ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_writergroup.c
- ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_reader.c
- ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_readergroup.c
- ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_manager.c
- ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_ns0.c
- # services
${PROJECT_SOURCE_DIR}/src/server/ua_services_view.c
${PROJECT_SOURCE_DIR}/src/server/ua_services_method.c
${PROJECT_SOURCE_DIR}/src/server/ua_services_session.c
@@ -979,95 +837,318 @@ set(lib_sources ${PROJECT_SOURCE_DIR}/src/ua_types.c
${PROJECT_SOURCE_DIR}/src/server/ua_services_monitoreditem.c
${PROJECT_SOURCE_DIR}/src/server/ua_services_securechannel.c
${PROJECT_SOURCE_DIR}/src/server/ua_services_nodemanagement.c
- ${PROJECT_SOURCE_DIR}/src/server/ua_services_discovery_multicast.c
+ # pubsub
+ ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_networkmessage.c
+ ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_eventloop.c
+ ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_connection.c
+ ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_dataset.c
+ ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_writer.c
+ ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_writergroup.c
+ ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_reader.c
+ ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_readergroup.c
+ ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_manager.c
+ ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_ns0.c
+ ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_keystorage.c
+ ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_securitygroup.c
+ ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_config.c
# client
${PROJECT_SOURCE_DIR}/src/client/ua_client.c
${PROJECT_SOURCE_DIR}/src/client/ua_client_connect.c
${PROJECT_SOURCE_DIR}/src/client/ua_client_discovery.c
${PROJECT_SOURCE_DIR}/src/client/ua_client_highlevel.c
${PROJECT_SOURCE_DIR}/src/client/ua_client_subscriptions.c
-
# dependencies
${PROJECT_SOURCE_DIR}/deps/libc_time.c
${PROJECT_SOURCE_DIR}/deps/pcg_basic.c
${PROJECT_SOURCE_DIR}/deps/base64.c
- ${PROJECT_SOURCE_DIR}/deps/aa_tree.c
- ${PROJECT_SOURCE_DIR}/deps/ziptree.c
-
- ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_config.c)
-
-set(default_plugin_headers ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/accesscontrol_default.h
- ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/pki_default.h
- ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/log_stdout.h
- ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/nodestore_default.h
- ${PROJECT_SOURCE_DIR}/plugins/include/open62541/server_config_default.h
- ${PROJECT_SOURCE_DIR}/plugins/include/open62541/client_config_default.h
- ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/securitypolicy_default.h
-)
-
-set(default_plugin_sources ${PROJECT_SOURCE_DIR}/plugins/ua_log_stdout.c
- ${PROJECT_SOURCE_DIR}/plugins/ua_accesscontrol_default.c
- ${PROJECT_SOURCE_DIR}/plugins/ua_nodestore_ziptree.c
- ${PROJECT_SOURCE_DIR}/plugins/ua_nodestore_hashmap.c
- ${PROJECT_SOURCE_DIR}/plugins/ua_config_default.c
- ${PROJECT_SOURCE_DIR}/plugins/crypto/ua_pki_none.c
- ${PROJECT_SOURCE_DIR}/plugins/crypto/ua_securitypolicy_none.c
-)
-
-# Syslog-logging on Linux and Unices
-if(UNIX)
- list(APPEND default_plugin_headers
- ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/log_syslog.h)
- list(APPEND default_plugin_sources ${PROJECT_SOURCE_DIR}/plugins/ua_log_syslog.c)
-endif()
+ ${PROJECT_SOURCE_DIR}/deps/dtoa.c
+ ${PROJECT_SOURCE_DIR}/deps/mp_printf.c
+ ${PROJECT_SOURCE_DIR}/deps/itoa.c
+ ${PROJECT_SOURCE_DIR}/deps/ziptree.c)
if(UA_GENERATED_NAMESPACE_ZERO)
- list(APPEND internal_headers ${PROJECT_BINARY_DIR}/src_generated/open62541/namespace0_generated.h)
+ list(APPEND lib_headers ${PROJECT_BINARY_DIR}/src_generated/open62541/namespace0_generated.h)
list(APPEND lib_sources ${PROJECT_BINARY_DIR}/src_generated/open62541/namespace0_generated.c)
endif()
+if (NOT "${UA_ARCHITECTURE}" STREQUAL "none")
+ list(PREPEND lib_headers ${PROJECT_SOURCE_DIR}/arch/posix/ua_architecture.h)
+ list(PREPEND lib_headers ${PROJECT_SOURCE_DIR}/arch/win32/ua_architecture.h)
+endif()
+
if(UA_ENABLE_PARSING)
list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/ua_types_lex.c)
endif()
+if(UA_ENABLE_PUBSUB)
+ if(UA_ENABLE_MALLOC_SINGLETON AND UA_ENABLE_PUBSUB_BUFMALLOC)
+ list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_bufmalloc.c)
+ list(APPEND lib_headers ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_bufmalloc.h)
+ endif()
+ if(UA_ENABLE_PUBSUB_ENCRYPTION)
+ list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_security.c)
+ endif()
+endif()
+
+if(UA_ENABLE_JSON_ENCODING)
+ if(UA_ENABLE_PUBSUB_ENCRYPTION)
+ MESSAGE(WARNING "Payload encryption with JSON encoding is not possible according to the specification. The message security is only defined for the UADP message mapping.")
+ endif()
+ if(UA_ENABLE_PUBSUB)
+ list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_networkmessage_json.c)
+ endif()
+ list(APPEND lib_headers ${PROJECT_SOURCE_DIR}/deps/cj5.h
+ ${PROJECT_SOURCE_DIR}/deps/parse_num.h
+ ${PROJECT_SOURCE_DIR}/src/ua_types_encoding_json.h)
+ list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/deps/cj5.c
+ ${PROJECT_SOURCE_DIR}/deps/parse_num.c
+ ${PROJECT_SOURCE_DIR}/src/ua_types_encoding_json.c)
+endif()
+
+if(UA_ENABLE_XML_ENCODING)
+ if(NOT UA_ENABLE_JSON_ENCODING)
+ list(APPEND lib_headers ${PROJECT_SOURCE_DIR}/deps/parse_num.h)
+ list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/deps/parse_num.c)
+ endif()
+ list(APPEND lib_headers ${PROJECT_SOURCE_DIR}/src/ua_types_encoding_xml.h)
+ list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/ua_types_encoding_xml.c)
+endif()
+
+if(UA_ENABLE_SUBSCRIPTIONS)
+ list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_subscription.c
+ ${PROJECT_SOURCE_DIR}/src/server/ua_subscription_monitoreditem.c
+ ${PROJECT_SOURCE_DIR}/src/server/ua_subscription_datachange.c)
+ if(UA_ENABLE_SUBSCRIPTIONS_EVENTS)
+ if(UA_NAMESPACE_ZERO STREQUAL "MINIMAL")
+ message(FATAL_ERROR "Events require at least the reduced Namespace Zero")
+ endif()
+ list(APPEND lib_sources
+ ${PROJECT_SOURCE_DIR}/src/server/ua_subscription_events.c
+ ${PROJECT_SOURCE_DIR}/src/server/ua_subscription_events_filter.c)
+ if(UA_ENABLE_SUBSCRIPTIONS_ALARMS_CONDITIONS)
+ list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_subscription_alarms_conditions.c)
+ endif()
+ endif()
+endif()
+
+if(UA_DEBUG_DUMP_PKGS)
+ list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/plugins/ua_debug_dump_pkgs.c)
+endif()
+
+if(UA_ENABLE_DISCOVERY_MULTICAST)
+ # Copy mdnsd libmdnsd files into src_generated/mdnsd/ so they can be
+ # patched via regex (configure_file copies without variable substitution
+ # when COPYONLY is given, but using the plain copy lets downstream code
+ # run regex passes on the generated copies before compilation).
+ set(MDNSD_GENERATED_DIR "${PROJECT_BINARY_DIR}/src_generated/mdnsd")
+ file(MAKE_DIRECTORY "${MDNSD_GENERATED_DIR}")
+
+ set(MDNSD_LIBMDNSD_HEADERS 1035.h xht.h sdtxt.h inet.h mdnsd.h)
+ set(MDNSD_LIBMDNSD_SOURCES 1035.c xht.c sdtxt.c inet.c mdnsd.c log.c)
+
+ foreach(_f IN LISTS MDNSD_LIBMDNSD_HEADERS MDNSD_LIBMDNSD_SOURCES)
+ configure_file(
+ "${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/${_f}"
+ "${MDNSD_GENERATED_DIR}/${_f}"
+ COPYONLY)
+ file(READ "${MDNSD_GENERATED_DIR}/${_f}" _content)
+ # Ensure open62541/config.h (which sets _GNU_SOURCE etc.) is included
+ # before any system header, then remove any original config.h include.
+ string(PREPEND _content "#include \"open62541/config.h\"\n")
+ string(REGEX REPLACE "#include \"config\\.h\"\n?" "" _content "${_content}")
+ # Rename C++ keyword identifiers: 'class' -> 'clazz', 'new' -> 'new_'
+ string(REGEX REPLACE "([^A-Za-z0-9_])class([^A-Za-z0-9_])" "\\1clazz\\2" _content "${_content}")
+ string(REGEX REPLACE "([^A-Za-z0-9_])class([^A-Za-z0-9_])" "\\1clazz\\2" _content "${_content}")
+ string(REGEX REPLACE "([^A-Za-z0-9_])new([^A-Za-z0-9_])" "\\1new_\\2" _content "${_content}")
+ string(REGEX REPLACE "([^A-Za-z0-9_])new([^A-Za-z0-9_])" "\\1new_\\2" _content "${_content}")
+ if(_f STREQUAL "mdnsd.h")
+ string(REPLACE "#define DBG(fmt, args...) mdnsd_log(LOG_DEBUG, \"%s(): \" fmt, __func__, ##args)"
+ "#define DBG(fmt, ...) mdnsd_log(LOG_DEBUG, \"%s(): \" fmt, __func__, __VA_ARGS__)"
+ _content "${_content}")
+ string(REPLACE "#define INFO(fmt, args...) mdnsd_log(LOG_INFO, \"%s(): \" fmt, __func__, ##args)"
+ "#define INFO(fmt, ...) mdnsd_log(LOG_INFO, \"%s(): \" fmt, __func__, __VA_ARGS__)"
+ _content "${_content}")
+ string(REPLACE "#define NOTE(fmt, args...) mdnsd_log(LOG_NOTICE, fmt, ##args)"
+ "#define NOTE(...) mdnsd_log(LOG_NOTICE, __VA_ARGS__)"
+ _content "${_content}")
+ string(REPLACE "#define WARN(fmt, args...) mdnsd_log(LOG_WARNING, fmt, ##args)"
+ "#define WARN(...) mdnsd_log(LOG_WARNING, __VA_ARGS__)"
+ _content "${_content}")
+ string(REPLACE "#define ERR(fmt, args...) mdnsd_log(LOG_ERR, fmt, ##args)"
+ "#define ERR(...) mdnsd_log(LOG_ERR, __VA_ARGS__)"
+ _content "${_content}")
+ endif()
+ if(_f STREQUAL "mdnsd.c")
+ string(REPLACE
+[=[ c->rr.rdname = strdup(r->known.ns.name);]=]
+[=[ if (!r->known.ns.name) {
+ free(c->rr.rdata);
+ free(c->rr.name);
+ free(c);
+ return 1;
+ }
+ c->rr.rdname = strdup(r->known.ns.name);]=]
+ _content "${_content}")
+ string(REPLACE
+[=[ c->rr.rdname = strdup(r->known.srv.name);]=]
+[=[ if (!r->known.srv.name) {
+ free(c->rr.rdata);
+ free(c->rr.name);
+ free(c);
+ return 1;
+ }
+ c->rr.rdname = strdup(r->known.srv.name);]=]
+ _content "${_content}")
+ endif()
+ file(WRITE "${MDNSD_GENERATED_DIR}/${_f}" "${_content}")
+ endforeach()
+
+ # Suppress warnings from the generated (upstream) mdnsd C files
+ set_source_files_properties(
+ ${MDNSD_GENERATED_DIR}/1035.c
+ ${MDNSD_GENERATED_DIR}/xht.c
+ ${MDNSD_GENERATED_DIR}/sdtxt.c
+ ${MDNSD_GENERATED_DIR}/inet.c
+ ${MDNSD_GENERATED_DIR}/mdnsd.c
+ ${MDNSD_GENERATED_DIR}/log.c
+ PROPERTIES COMPILE_FLAGS
+ "-Wno-c++-compat -Wno-variadic-macros -Wno-pedantic -Wno-implicit-function-declaration -Wno-nested-externs -Wno-int-to-pointer-cast -Wno-format-nonliteral")
+ # ua_discovery_mdns.c includes mdnsd.h which has GCC-style named variadic macros
+ set_source_files_properties(
+ ${PROJECT_SOURCE_DIR}/src/server/ua_discovery_mdns.c
+ PROPERTIES COMPILE_FLAGS "-Wno-variadic-macros")
+
+ # prepend in list, otherwise it complains that winsock2.h has to be included before windows.h
+ list(APPEND lib_headers
+ ${MDNSD_GENERATED_DIR}/1035.h
+ ${MDNSD_GENERATED_DIR}/xht.h
+ ${MDNSD_GENERATED_DIR}/sdtxt.h
+ ${MDNSD_GENERATED_DIR}/inet.h
+ ${MDNSD_GENERATED_DIR}/mdnsd.h)
+ list(APPEND lib_sources
+ ${PROJECT_SOURCE_DIR}/src/server/ua_discovery_mdns.c
+ ${MDNSD_GENERATED_DIR}/1035.c
+ ${MDNSD_GENERATED_DIR}/xht.c
+ ${MDNSD_GENERATED_DIR}/sdtxt.c
+ ${MDNSD_GENERATED_DIR}/inet.c
+ ${MDNSD_GENERATED_DIR}/mdnsd.c
+ ${MDNSD_GENERATED_DIR}/log.c)
+endif()
+
+if(UA_BUILD_FUZZING OR UA_BUILD_OSS_FUZZ)
+ list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/tests/fuzz/custom_memory_manager.c)
+endif()
+
+# Architecture
+set(architecture_headers)
+set(architecture_sources)
+
+if(NOT "${UA_ARCHITECTURE}" STREQUAL "none")
+ list(APPEND architecture_headers
+ ${PROJECT_SOURCE_DIR}/arch/common/ua_timer.h
+ ${PROJECT_SOURCE_DIR}/arch/eventloop_common.h
+ ${PROJECT_SOURCE_DIR}/arch/eventloop_posix.h)
+
+ list(APPEND architecture_sources
+ ${PROJECT_SOURCE_DIR}/arch/posix/ua_clock.c
+ ${PROJECT_SOURCE_DIR}/arch/win32/ua_clock.c
+ ${PROJECT_SOURCE_DIR}/arch/common/ua_timer.c
+ ${PROJECT_SOURCE_DIR}/arch/eventloop_common.c
+ ${PROJECT_SOURCE_DIR}/arch/eventloop_posix.c
+ ${PROJECT_SOURCE_DIR}/arch/eventloop_posix_select.c
+ ${PROJECT_SOURCE_DIR}/arch/eventloop_posix_epoll.c
+ ${PROJECT_SOURCE_DIR}/arch/eventloop_posix_tcp.c
+ ${PROJECT_SOURCE_DIR}/arch/eventloop_posix_udp.c
+ ${PROJECT_SOURCE_DIR}/arch/eventloop_posix_interrupt.c)
+
+ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR UA_ENABLE_AMALGAMATION)
+ list(APPEND architecture_sources ${PROJECT_SOURCE_DIR}/arch/eventloop_posix_eth.c)
+ endif()
+
+ if(UA_ENABLE_MQTT)
+ list(APPEND architecture_sources ${PROJECT_SOURCE_DIR}/arch/eventloop_mqtt.c)
+ endif()
+endif()
+
+
+# Plugins
+set(plugin_headers ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/accesscontrol_default.h
+ ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/pki_default.h
+ ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/log_stdout.h
+ ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/nodestore_default.h
+ ${PROJECT_SOURCE_DIR}/plugins/include/open62541/server_config_default.h
+ ${PROJECT_SOURCE_DIR}/plugins/include/open62541/client_config_default.h
+ ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/securitypolicy_default.h)
+
+set(plugin_sources ${PROJECT_SOURCE_DIR}/plugins/ua_log_stdout.c
+ ${PROJECT_SOURCE_DIR}/plugins/ua_accesscontrol_default.c
+ ${PROJECT_SOURCE_DIR}/plugins/ua_nodestore_ziptree.c
+ ${PROJECT_SOURCE_DIR}/plugins/ua_nodestore_hashmap.c
+ ${PROJECT_SOURCE_DIR}/plugins/ua_config_default.c)
+
+# For file based server configuration
+if(UA_ENABLE_JSON_ENCODING)
+ list(APPEND plugin_headers ${PROJECT_SOURCE_DIR}/plugins/include/open62541/server_config_file_based.h)
+ list(APPEND plugin_sources ${PROJECT_SOURCE_DIR}/plugins/ua_config_json.c)
+endif()
+
+if(UA_ENABLE_HISTORIZING)
+ list(APPEND plugin_headers
+ ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/historydata/history_data_backend.h
+ ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/historydata/history_data_gathering.h
+ ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/historydata/history_database_default.h
+ ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/historydata/history_data_gathering_default.h
+ ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/historydata/history_data_backend_memory.h)
+ list(APPEND plugin_sources
+ ${PROJECT_SOURCE_DIR}/plugins/historydata/ua_history_data_backend_memory.c
+ ${PROJECT_SOURCE_DIR}/plugins/historydata/ua_history_data_gathering_default.c
+ ${PROJECT_SOURCE_DIR}/plugins/historydata/ua_history_database_default.c)
+endif()
+
+# Syslog-logging on Linux and Unices
+if(UNIX)
+ list(APPEND plugin_headers ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/log_syslog.h)
+ list(APPEND plugin_sources ${PROJECT_SOURCE_DIR}/plugins/ua_log_syslog.c)
+endif()
+
# Always include encryption plugins into the amalgamation
# Use guards in the files to ensure that UA_ENABLE_ENCRYPTON_MBEDTLS and UA_ENABLE_ENCRYPTION_OPENSSL are honored.
if(UA_ENABLE_ENCRYPTION_MBEDTLS OR UA_ENABLE_PUBSUB_ENCRYPTION OR UA_ENABLE_AMALGAMATION)
- list(INSERT default_plugin_sources 0
- ${PROJECT_SOURCE_DIR}/plugins/crypto/mbedtls/securitypolicy_mbedtls_common.h
- ${PROJECT_SOURCE_DIR}/plugins/crypto/mbedtls/securitypolicy_mbedtls_common.c)
+ list(INSERT plugin_sources 0
+ ${PROJECT_SOURCE_DIR}/plugins/crypto/mbedtls/securitypolicy_mbedtls_common.h
+ ${PROJECT_SOURCE_DIR}/plugins/crypto/mbedtls/securitypolicy_mbedtls_common.c)
endif()
if(UA_ENABLE_PUBSUB_ENCRYPTION)
- list(INSERT default_plugin_sources 1
- ${PROJECT_SOURCE_DIR}/plugins/crypto/mbedtls/securitypolicy_pubsub_aes128ctr.c
- ${PROJECT_SOURCE_DIR}/plugins/crypto/mbedtls/securitypolicy_pubsub_aes256ctr.c)
+ list(APPEND plugin_sources
+ ${PROJECT_SOURCE_DIR}/plugins/crypto/mbedtls/securitypolicy_pubsub_aes128ctr.c
+ ${PROJECT_SOURCE_DIR}/plugins/crypto/mbedtls/securitypolicy_pubsub_aes256ctr.c)
endif()
if(UA_ENABLE_ENCRYPTION_MBEDTLS OR UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_ENCRYPTION_LIBRESSL OR UA_ENABLE_AMALGAMATION)
- list(APPEND default_plugin_headers
- ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/create_certificate.h
- )
+ list(APPEND plugin_headers ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/create_certificate.h)
endif()
if(UA_ENABLE_ENCRYPTION_MBEDTLS OR UA_ENABLE_AMALGAMATION)
-list(INSERT default_plugin_sources 1
+list(APPEND plugin_sources
${PROJECT_SOURCE_DIR}/plugins/crypto/mbedtls/ua_securitypolicy_basic128rsa15.c
${PROJECT_SOURCE_DIR}/plugins/crypto/mbedtls/ua_securitypolicy_basic256.c
${PROJECT_SOURCE_DIR}/plugins/crypto/mbedtls/ua_securitypolicy_basic256sha256.c
${PROJECT_SOURCE_DIR}/plugins/crypto/mbedtls/ua_securitypolicy_aes128sha256rsaoaep.c
+ ${PROJECT_SOURCE_DIR}/plugins/crypto/mbedtls/ua_securitypolicy_aes256sha256rsapss.c
+ ${PROJECT_SOURCE_DIR}/plugins/crypto/mbedtls/ua_mbedtls_create_certificate.c
${PROJECT_SOURCE_DIR}/plugins/crypto/mbedtls/ua_pki_mbedtls.c)
endif()
if(UA_ENABLE_TPM2_SECURITY)
-list(INSERT default_plugin_sources 0
+list(INSERT plugin_sources 0
${PROJECT_SOURCE_DIR}/plugins/crypto/pkcs11/securitypolicy_pubsub_aes128ctr_tpm.c
${PROJECT_SOURCE_DIR}/plugins/crypto/pkcs11/securitypolicy_pubsub_aes256ctr_tpm.c)
endif()
if(UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_ENCRYPTION_LIBRESSL OR UA_ENABLE_AMALGAMATION)
-list(INSERT default_plugin_sources 0
+list(APPEND plugin_sources
${PROJECT_SOURCE_DIR}/plugins/crypto/openssl/securitypolicy_openssl_common.h
${PROJECT_SOURCE_DIR}/plugins/crypto/openssl/ua_openssl_version_abstraction.h
${PROJECT_SOURCE_DIR}/plugins/crypto/openssl/securitypolicy_openssl_common.c
@@ -1075,277 +1156,184 @@ list(INSERT default_plugin_sources 0
${PROJECT_SOURCE_DIR}/plugins/crypto/openssl/ua_openssl_basic256.c
${PROJECT_SOURCE_DIR}/plugins/crypto/openssl/ua_openssl_basic256sha256.c
${PROJECT_SOURCE_DIR}/plugins/crypto/openssl/ua_openssl_aes128sha256rsaoaep.c
+ ${PROJECT_SOURCE_DIR}/plugins/crypto/openssl/ua_openssl_aes256sha256rsapss.c
${PROJECT_SOURCE_DIR}/plugins/crypto/openssl/ua_openssl_create_certificate.c
${PROJECT_SOURCE_DIR}/plugins/crypto/openssl/ua_pki_openssl.c)
endif()
-if(UA_ENABLE_HISTORIZING)
-
- list(APPEND default_plugin_headers
- ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/historydata/history_data_backend.h
- ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/historydata/history_data_gathering.h
- ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/historydata/history_database_default.h
- ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/historydata/history_data_gathering_default.h
- ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/historydata/history_data_backend_memory.h
- )
- list(APPEND default_plugin_sources
- ${PROJECT_SOURCE_DIR}/plugins/historydata/ua_history_data_backend_memory.c
- ${PROJECT_SOURCE_DIR}/plugins/historydata/ua_history_data_gathering_default.c
- ${PROJECT_SOURCE_DIR}/plugins/historydata/ua_history_database_default.c
- )
-endif()
+# ua_securitypolicy_none.c requires UA_*_LoadCertificate() if encryption is enabled
+list(APPEND plugin_sources
+ ${PROJECT_SOURCE_DIR}/plugins/crypto/ua_pki_none.c
+ ${PROJECT_SOURCE_DIR}/plugins/crypto/ua_securitypolicy_none.c)
if(UA_ENABLE_DISCOVERY)
- list(INSERT internal_headers 13 ${PROJECT_SOURCE_DIR}/src/server/ua_discovery_manager.h)
- list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_discovery_manager.c)
+ list(APPEND lib_headers ${PROJECT_SOURCE_DIR}/src/server/ua_discovery.h)
+ list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_discovery.c)
endif()
-if(UA_ENABLE_PUBSUB)
- list(APPEND default_plugin_headers ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/pubsub_udp.h)
- list(APPEND default_plugin_sources ${PROJECT_SOURCE_DIR}/plugins/ua_pubsub_udp.c)
- if(UA_ENABLE_PUBSUB_ETH_UADP)
- list(APPEND default_plugin_headers ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/pubsub_ethernet.h)
- list(APPEND default_plugin_sources ${PROJECT_SOURCE_DIR}/plugins/ua_pubsub_ethernet.c)
- find_library(LIB_BPF bpf)
- if(LIB_BPF)
- list(APPEND open62541_LIBRARIES bpf)
- else()
- message("bpf library not found. XDP functionalities will not be available.")
- endif()
- endif()
- if(UA_ENABLE_PUBSUB_MQTT)
- if(WIN32)
- MESSAGE(WARNING "Multithreading is enabled in MQTT plugin. This feature is under development and marked as EXPERIMENTAL")
- else()
- list(APPEND default_plugin_headers ${PROJECT_SOURCE_DIR}/deps/mqtt-c/include/mqtt_pal.h
- ${PROJECT_SOURCE_DIR}/deps/mqtt-c/include/mqtt.h
- ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/pubsub_mqtt.h
- ${PROJECT_SOURCE_DIR}/plugins/mqtt/ua_mqtt-c_adapter.h)
- list(APPEND default_plugin_sources ${PROJECT_SOURCE_DIR}/deps/mqtt-c/src/mqtt_pal.c
- ${PROJECT_SOURCE_DIR}/deps/mqtt-c/src/mqtt.c
- ${PROJECT_SOURCE_DIR}/plugins/ua_pubsub_mqtt.c
- ${PROJECT_SOURCE_DIR}/plugins/mqtt/ua_mqtt-c_adapter.c)
- endif()
- endif()
- if(UA_ENABLE_MALLOC_SINGLETON AND UA_ENABLE_PUBSUB_BUFMALLOC)
- list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_bufmalloc.c)
- list(APPEND internal_headers ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_bufmalloc.h)
- endif()
- if(UA_ENABLE_PUBSUB_ENCRYPTION)
- list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_security.c)
- endif()
-endif()
+if(UA_ENABLE_NODESETLOADER)
+ # This is required because of issues with policy CMP0077.
+ # Source: https://stackoverflow.com/a/54404924
+ option(ENABLE_BUILD_INTO_OPEN62541 "make nodesetLoader part of the open62541 library" off)
+ set(ENABLE_BUILD_INTO_OPEN62541 on)
-if(UA_ENABLE_JSON_ENCODING)
- if(UA_ENABLE_PUBSUB)
- list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/pubsub/ua_pubsub_networkmessage_json.c)
- endif()
- list(APPEND internal_headers ${PROJECT_SOURCE_DIR}/deps/jsmn/jsmn.h
- ${PROJECT_SOURCE_DIR}/deps/string_escape.h
- ${PROJECT_SOURCE_DIR}/deps/itoa.h
- ${PROJECT_SOURCE_DIR}/deps/atoi.h
- ${PROJECT_SOURCE_DIR}/src/ua_types_encoding_json.h)
- list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/deps/jsmn/jsmn.c
- ${PROJECT_SOURCE_DIR}/deps/string_escape.c
- ${PROJECT_SOURCE_DIR}/deps/itoa.c
- ${PROJECT_SOURCE_DIR}/deps/atoi.c
- ${PROJECT_SOURCE_DIR}/src/ua_types_encoding_json.c)
-endif()
+ add_subdirectory(${PROJECT_SOURCE_DIR}/deps/nodesetLoader)
-if(UA_ENABLE_SUBSCRIPTIONS)
- list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_subscription.c
- ${PROJECT_SOURCE_DIR}/src/server/ua_subscription_monitoreditem.c
- ${PROJECT_SOURCE_DIR}/src/server/ua_subscription_datachange.c)
- if(UA_ENABLE_SUBSCRIPTIONS_EVENTS)
- if(UA_NAMESPACE_ZERO STREQUAL "MINIMAL")
- message(FATAL_ERROR "Events require at least the reduced Namespace Zero")
- endif()
- list(APPEND lib_sources
- ${PROJECT_SOURCE_DIR}/src/server/ua_subscription_events.c
- ${PROJECT_SOURCE_DIR}/src/server/ua_subscription_events_filter.c)
- if(UA_ENABLE_SUBSCRIPTIONS_ALARMS_CONDITIONS)
- list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_subscription_alarms_conditions.c)
- endif()
- endif()
-endif()
-
-if(UA_DEBUG_DUMP_PKGS)
- list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/plugins/ua_debug_dump_pkgs.c)
-endif()
-
-if(UA_ENABLE_DISCOVERY_MULTICAST)
- # prepend in list, otherwise it complains that winsock2.h has to be included before windows.h
- set(internal_headers ${PROJECT_BINARY_DIR}/src_generated/mdnsd_config.h
- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/1035.h
- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/xht.h
- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/sdtxt.h
- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/mdnsd.h
- ${internal_headers} )
- set(lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_server_discovery_mdns.c
- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/1035.c
- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/xht.c
- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/sdtxt.c
- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/mdnsd.c
- ${lib_sources})
-endif()
+ list(APPEND lib_sources ${NODESETLOADER_SOURCES})
+ list(APPEND plugin_headers ${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/nodesetloader.h)
+ list(APPEND plugin_sources ${PROJECT_SOURCE_DIR}/plugins/ua_nodesetloader.c)
+ list(APPEND open62541_LIBRARIES ${NODESETLOADER_DEPS_LIBS})
-if(UA_BUILD_FUZZING OR UA_BUILD_OSS_FUZZ)
- set(lib_sources
- ${lib_sources}
- ${PROJECT_SOURCE_DIR}/tests/fuzz/custom_memory_manager.c)
+ if(UA_ENABLE_AMALGAMATION)
+ list(APPEND exported_headers ${NODESETLOADER_PUBLIC_HEADERS})
+ list(APPEND lib_headers ${NODESETLOADER_PRIVATE_HEADERS})
+ endif()
endif()
#########################
# Generate source files #
#########################
-# List of nodeset files combined into NS0 generated file
-set(UA_FILE_NODESETS)
+# Nodeset files combined into NS0 generated file
+set(UA_FILE_NODESETS) # List of nodeset-xml files to be considered in the generated information model
+set(UA_NODESET_DIR ${PROJECT_SOURCE_DIR}/deps/ua-nodeset CACHE STRING "The path to the node-set directory (e.g. from https://github.com/OPCFoundation/UA-Nodeset)")
-if(UA_NAMESPACE_ZERO STREQUAL "FULL" OR UA_NAMESPACE_ZERO STREQUAL "LATEST_1_05")
- if(NOT UA_FILE_NS0)
- set(UA_FILE_NS0 ${open62541_NODESET_DIR}/Schema/Opc.Ua.NodeSet2.xml)
+unset(UA_FILE_NS0_PRIVATE)
+if(UA_FILE_NS0)
+ set(UA_FILE_NS0_PRIVATE "${UA_FILE_NS0}")
+endif()
+
+if(UA_NAMESPACE_ZERO STREQUAL "FULL")
+ # Use the "full" schema files also for datatypes and statuscodes
+ set(UA_SCHEMA_DIR ${UA_NODESET_DIR}/Schema CACHE INTERNAL "")
+
+ # Set the full Nodeset for NS0
+ if(NOT UA_FILE_NS0_PRIVATE)
+ set(UA_FILE_NS0_PRIVATE ${UA_SCHEMA_DIR}/Opc.Ua.NodeSet2.xml)
endif()
- set(UA_FILE_NODESETS "${UA_FILE_NS0}")
- if(NOT EXISTS "${UA_FILE_NS0}")
- message(FATAL_ERROR "File ${UA_FILE_NS0} not found. You probably need to initialize the git submodule for deps/ua-nodeset or set open62541_NODESET_DIR.")
- else()
- # If the "LATEST_1_05" flag is set, it must be checked whether the nodeset NS0 is on the latest version.
- if(UA_NAMESPACE_ZERO STREQUAL "LATEST_1_05")
- file(READ ${UA_FILE_NS0} ver LIMIT 5000)
- string(REGEX MATCH ".*http:\\/\\/opcfoundation\\.org\\/UA\\/\" Version=\"1\\.05" match ${ver})
- if(NOT match)
- message(FATAL_ERROR "File ${UA_FILE_NS0} is set incorrectly. You probably need to checkout the git submodule for deps/ua-nodeset to version 1.05. Therefore execute the following command inside the deps/ua-nodeset directory \ngit checkout v1.05")
- endif()
+ # Check that the submodule was checked out or manually downloaded into the folder
+ if(NOT EXISTS "${UA_FILE_NS0_PRIVATE}")
+ message(STATUS "Submodule update")
+ execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
+ RESULT_VARIABLE GIT_SUBMOD_RESULT)
+ if(NOT GIT_SUBMOD_RESULT EQUAL "0")
+ message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}")
endif()
endif()
-
-
- set(UA_FILE_NODEIDS ${open62541_NODESET_DIR}/Schema/NodeIds.csv)
- set(UA_FILE_STATUSCODES ${open62541_NODESET_DIR}/Schema/StatusCode.csv)
- set(UA_FILE_TYPES_BSD ${open62541_NODESET_DIR}/Schema/Opc.Ua.Types.bsd)
else()
- if(NOT UA_FILE_NS0)
- set(UA_FILE_NS0 ${PROJECT_SOURCE_DIR}/tools/schema/Opc.Ua.NodeSet2.Reduced.xml)
+ # Directory with the schema files for installation
+ set(UA_SCHEMA_DIR ${PROJECT_SOURCE_DIR}/tools/schema CACHE INTERNAL "")
+
+ # Set the reduced Nodeset for NS0
+ if(NOT UA_FILE_NS0_PRIVATE)
+ set(UA_FILE_NS0_PRIVATE ${UA_SCHEMA_DIR}/Opc.Ua.NodeSet2.Reduced.xml CACHE INTERNAL "")
endif()
- set(UA_FILE_NODESETS "${UA_FILE_NS0}")
- set(UA_FILE_DATATYPES ${PROJECT_SOURCE_DIR}/tools/schema/datatypes_minimal.txt)
- set(UA_FILE_NODEIDS ${PROJECT_SOURCE_DIR}/tools/schema/NodeIds.csv)
- set(UA_FILE_STATUSCODES ${PROJECT_SOURCE_DIR}/tools/schema/StatusCode.csv)
- set(UA_FILE_TYPES_BSD ${PROJECT_SOURCE_DIR}/tools/schema/Opc.Ua.Types.bsd)
+ # Set feature-specific datatypes definitions and nodesets
+ set(UA_FILE_DATATYPES ${UA_SCHEMA_DIR}/datatypes_minimal.txt
+ ${UA_SCHEMA_DIR}/datatypes_discovery.txt)
if(UA_ENABLE_METHODCALLS)
- list(APPEND UA_FILE_DATATYPES ${PROJECT_SOURCE_DIR}/tools/schema/datatypes_method.txt)
+ list(APPEND UA_FILE_DATATYPES ${UA_SCHEMA_DIR}/datatypes_method.txt)
endif()
if(UA_ENABLE_DIAGNOSTICS)
- list(APPEND UA_FILE_DATATYPES ${PROJECT_SOURCE_DIR}/tools/schema/datatypes_diagnostics.txt)
- list(APPEND UA_FILE_NODESETS ${PROJECT_SOURCE_DIR}/tools/schema/Opc.Ua.NodeSet2.DiagnosticsMinimal.xml)
+ list(APPEND UA_FILE_NODESETS ${UA_SCHEMA_DIR}/Opc.Ua.NodeSet2.DiagnosticsMinimal.xml)
+ list(APPEND UA_FILE_DATATYPES ${UA_SCHEMA_DIR}/datatypes_diagnostics.txt)
endif()
if(UA_ENABLE_SUBSCRIPTIONS)
- list(APPEND UA_FILE_DATATYPES ${PROJECT_SOURCE_DIR}/tools/schema/datatypes_subscriptions.txt)
+ list(APPEND UA_FILE_DATATYPES ${UA_SCHEMA_DIR}/datatypes_subscriptions.txt)
endif()
if(UA_ENABLE_SUBSCRIPTIONS_EVENTS)
- list(APPEND UA_FILE_DATATYPES ${PROJECT_SOURCE_DIR}/tools/schema/datatypes_events.txt)
- list(APPEND UA_FILE_NODESETS ${PROJECT_SOURCE_DIR}/tools/schema/Opc.Ua.NodeSet2.EventsMinimal.xml)
+ list(APPEND UA_FILE_NODESETS ${UA_SCHEMA_DIR}/Opc.Ua.NodeSet2.EventsMinimal.xml)
endif()
if(UA_ENABLE_HISTORIZING)
- list(APPEND UA_FILE_DATATYPES ${PROJECT_SOURCE_DIR}/tools/schema/datatypes_historizing.txt)
- list(APPEND UA_FILE_NODESETS ${PROJECT_SOURCE_DIR}/tools/schema/Opc.Ua.NodeSet2.HistorizingMinimal.xml)
- endif()
-
- if(UA_ENABLE_DISCOVERY)
- list(APPEND UA_FILE_DATATYPES ${PROJECT_SOURCE_DIR}/tools/schema/datatypes_discovery.txt)
+ list(APPEND UA_FILE_NODESETS ${UA_SCHEMA_DIR}/Opc.Ua.NodeSet2.HistorizingMinimal.xml)
+ list(APPEND UA_FILE_DATATYPES ${UA_SCHEMA_DIR}/datatypes_historizing.txt)
endif()
if(UA_ENABLE_QUERY)
- list(APPEND UA_FILE_DATATYPES ${PROJECT_SOURCE_DIR}/tools/schema/datatypes_query.txt)
+ list(APPEND UA_FILE_DATATYPES ${UA_SCHEMA_DIR}/datatypes_query.txt)
endif()
if(UA_ENABLE_PUBSUB)
- list(APPEND UA_FILE_DATATYPES ${PROJECT_SOURCE_DIR}/tools/schema/datatypes_pubsub.txt)
+ list(APPEND UA_FILE_DATATYPES ${UA_SCHEMA_DIR}/datatypes_pubsub.txt)
if(UA_ENABLE_PUBSUB_INFORMATIONMODEL)
- list(APPEND UA_FILE_NODESETS ${PROJECT_SOURCE_DIR}/tools/schema/Opc.Ua.NodeSet2.PubSubMinimal.xml)
+ list(APPEND UA_FILE_NODESETS ${UA_SCHEMA_DIR}/Opc.Ua.NodeSet2.PubSubMinimal.xml)
endif()
endif()
+
if(UA_ENABLE_DA)
- list(APPEND UA_FILE_DATATYPES ${PROJECT_SOURCE_DIR}/tools/schema/datatypes_dataaccess.txt)
- set(UA_NODESET_FILE_DA ${PROJECT_SOURCE_DIR}/tools/schema/Opc.Ua.NodeSet2.Part8_Subset.xml)
+ list(APPEND UA_FILE_DATATYPES ${UA_SCHEMA_DIR}/datatypes_dataaccess.txt)
+ list(APPEND UA_FILE_NODESETS ${UA_SCHEMA_DIR}/Opc.Ua.NodeSet2.Part8_Subset.xml)
endif()
+
if(UA_ENABLE_TYPEDESCRIPTION)
- list(APPEND UA_FILE_DATATYPES ${PROJECT_SOURCE_DIR}/tools/schema/datatypes_typedescription.txt)
+ list(APPEND UA_FILE_DATATYPES ${UA_SCHEMA_DIR}/datatypes_typedescription.txt)
endif()
endif()
+list(INSERT UA_FILE_NODESETS 0 "${UA_FILE_NS0_PRIVATE}")
+set(UA_FILE_NODEIDS ${UA_SCHEMA_DIR}/NodeIds.csv)
+set(UA_FILE_STATUSCODES ${UA_SCHEMA_DIR}/StatusCode.csv)
+set(UA_FILE_TYPES_BSD ${UA_SCHEMA_DIR}/Opc.Ua.Types.bsd)
+
+# Generate all datatypes -> reset the lists used for filtering
+if(UA_ENABLE_DATATYPES_ALL)
+ unset(UA_FILE_DATATYPES)
+endif()
+
# standard-defined data types
-ua_generate_datatypes(
- BUILTIN
- NAME "types"
- TARGET_SUFFIX "types"
- NAMESPACE_IDX 0
- FILE_CSV "${UA_FILE_NODEIDS}"
- FILES_BSD "${UA_FILE_TYPES_BSD}"
- FILES_SELECTED ${UA_FILE_DATATYPES}
-)
+ua_generate_datatypes(BUILTIN GEN_DOC NAME "types" TARGET_SUFFIX "types" NAMESPACE_IDX 0
+ FILE_CSV "${UA_FILE_NODEIDS}"
+ FILES_BSD "${UA_FILE_TYPES_BSD}"
+ FILES_SELECTED ${UA_FILE_DATATYPES})
# transport data types
-ua_generate_datatypes(
- INTERNAL
- NAME "transport"
- TARGET_SUFFIX "transport"
- NAMESPACE_IDX 1
- FILE_CSV "${UA_FILE_NODEIDS}"
- IMPORT_BSD "TYPES#${UA_FILE_TYPES_BSD}"
- FILES_BSD "${PROJECT_SOURCE_DIR}/tools/schema/Custom.Opc.Ua.Transport.bsd"
- FILES_SELECTED "${PROJECT_SOURCE_DIR}/tools/schema/datatypes_transport.txt"
-)
+ua_generate_datatypes(INTERNAL NAME "transport" TARGET_SUFFIX "transport" NAMESPACE_IDX 1
+ FILE_CSV "${UA_FILE_NODEIDS}"
+ IMPORT_BSD "TYPES#${UA_FILE_TYPES_BSD}"
+ FILES_BSD "${PROJECT_SOURCE_DIR}/tools/schema/Custom.Opc.Ua.Transport.bsd"
+ FILES_SELECTED "${PROJECT_SOURCE_DIR}/tools/schema/datatypes_transport.txt")
# statuscode explanation
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/open62541/statuscodes.h
${PROJECT_BINARY_DIR}/src_generated/open62541/statuscodes.c
- PRE_BUILD
- COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/generate_statuscode_descriptions.py
- ${UA_FILE_STATUSCODES} ${PROJECT_BINARY_DIR}/src_generated/open62541/statuscodes
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/generate_statuscode_descriptions.py
- ${UA_FILE_STATUSCODES})
+ COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/generate_statuscode_descriptions.py
+ ${UA_FILE_STATUSCODES} ${PROJECT_BINARY_DIR}/src_generated/open62541/statuscodes
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/generate_statuscode_descriptions.py
+ ${UA_FILE_STATUSCODES})
# Header containing defines for all NodeIds
-ua_generate_nodeid_header(
- NAME "nodeids"
- ID_PREFIX "NS0"
- TARGET_SUFFIX "ids-ns0"
- FILE_CSV "${UA_FILE_NODEIDS}"
-)
+ua_generate_nodeid_header(NAME "nodeids" ID_PREFIX "NS0" TARGET_SUFFIX "ids-ns0"
+ FILE_CSV "${UA_FILE_NODEIDS}")
# we need a custom target to avoid that the generator is called concurrently and
# thus overwriting files while the other thread is compiling
add_custom_target(open62541-generator-statuscode DEPENDS
- ${PROJECT_BINARY_DIR}/src_generated/open62541/nodeids.h
- ${PROJECT_BINARY_DIR}/src_generated/open62541/statuscodes.h
- ${PROJECT_BINARY_DIR}/src_generated/open62541/statuscodes.c)
+ ${PROJECT_BINARY_DIR}/src_generated/open62541/nodeids.h
+ ${PROJECT_BINARY_DIR}/src_generated/open62541/statuscodes.h
+ ${PROJECT_BINARY_DIR}/src_generated/open62541/statuscodes.c)
if(UA_ENABLE_AMALGAMATION)
# single-file release
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/open62541.h
- PRE_BUILD
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py
+ COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py
${OPEN62541_VERSION} ${CMAKE_CURRENT_BINARY_DIR}/open62541.h
- ${exported_headers} ${default_plugin_headers} ${ua_architecture_headers}
+ ${exported_headers} ${plugin_headers}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py
- ${exported_headers} ${default_plugin_headers} ${ua_architecture_headers})
+ ${exported_headers} ${plugin_headers})
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/open62541.c
- PRE_BUILD
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py
+ COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py
${OPEN62541_VERSION} ${CMAKE_CURRENT_BINARY_DIR}/open62541.c
- ${internal_headers} ${lib_sources} ${default_plugin_sources} ${ua_architecture_sources}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py ${internal_headers}
- ${lib_sources} ${default_plugin_sources} ${ua_architecture_sources} )
+ ${lib_headers} ${lib_sources} ${plugin_sources} ${architecture_headers} ${architecture_sources}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py ${lib_headers}
+ ${lib_sources} ${architecture_sources} ${plugin_sources} ${architecture_headers} ${architecture_sources})
add_custom_target(open62541-amalgamation-source DEPENDS ${PROJECT_BINARY_DIR}/open62541.c)
add_custom_target(open62541-amalgamation-header DEPENDS ${PROJECT_BINARY_DIR}/open62541.h)
@@ -1355,49 +1343,57 @@ if(UA_ENABLE_AMALGAMATION)
open62541-generator-transport open62541-generator-statuscode)
endif()
-ua_generate_nodeset(
- NAME "ns0"
- FILE ${UA_FILE_NODESETS} ${UA_NODESET_FILE_DA}
- INTERNAL
- BLACKLIST ${UA_FILE_NS0_BLACKLIST}
- IGNORE "${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/NodeID_NS0_Base.txt"
- DEPENDS_TARGET "open62541-generator-types"
-)
-
-# stack protector and optimization needs to be disabled for the huge ns0 file, otherwise debian packaging fails due to long build times.
-# We also disable optimization on Appveyor builds, since they take almost an hour otherwise
-if(UA_PACK_DEBIAN OR (NOT "$ENV{APPVEYOR}" STREQUAL "") OR (
- (CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" OR CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") AND (
- # List of compilers which have problems with the huge ns0 optimization
- (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") AND (CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0))
- )
- ))
- set_source_files_properties(${PROJECT_BINARY_DIR}/src_generated/open62541/namespace0_generated.c PROPERTIES COMPILE_FLAGS "-fno-stack-protector -O0")
+ua_generate_nodeset(NAME "ns0" FILE ${UA_FILE_NODESETS}
+ INTERNAL BLACKLIST ${UA_FILE_NS0_BLACKLIST}
+ IGNORE "${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/NodeID_NS0_Base.txt"
+ DEPENDS_TARGET "open62541-generator-types")
+
+if(UA_ENABLE_NODESET_INJECTOR)
+ message(STATUS "Nodesetinjector feature enabled")
+ add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/open62541/nodesetinjector.h
+ ${PROJECT_BINARY_DIR}/src_generated/open62541/nodesetinjector.c
+ COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/nodeset_injector/generate_nodesetinjector.py
+ ${PROJECT_BINARY_DIR}/src_generated/open62541/nodesetinjector
+ ${UA_INFORMATION_MODEL_AUTOLOAD})
+ add_custom_target(open62541-generator-nodesetinjector DEPENDS
+ ${PROJECT_BINARY_DIR}/src_generated/open62541/nodesetinjector.c
+ ${PROJECT_BINARY_DIR}/src_generated/open62541/nodesetinjector.h)
+ set(UA_NODESETINJECTOR_GENERATORS "")
+ set(UA_NODESETINJECTOR_SOURCE_FILES "")
+ set(UA_NODESETINJECTOR_HEADER_FILES "")
+ set(UA_NODESETINJECTOR_EXAMPLE_NAMES "")
+ set(UA_NODESETINJECTOR_TEST_NAMES "")
endif()
#####################
# Build the Library #
#####################
-assign_source_group(${lib_sources})
-assign_source_group(${internal_headers})
assign_source_group(${exported_headers})
-assign_source_group(${default_plugin_sources})
-assign_source_group(${ua_architecture_sources})
+assign_source_group(${lib_headers} ${lib_sources})
+assign_source_group(${architecture_headers} ${architecture_sources})
+assign_source_group(${plugin_headers} ${plugin_sources})
+
+# When building packages, include the source in the library name to enable parallel
+# installation of multiple versions. We may break the ABI between minor releases!
if(UA_ENABLE_AMALGAMATION)
add_library(open62541-object OBJECT ${PROJECT_BINARY_DIR}/open62541.c ${PROJECT_BINARY_DIR}/open62541.h)
target_include_directories(open62541-object PRIVATE ${PROJECT_BINARY_DIR})
- target_include_directories(open62541-object PRIVATE "${ua_architecture_directories_to_include}")
if(UA_ENABLE_ENCRYPTION_MBEDTLS)
target_include_directories(open62541-object PRIVATE ${MBEDTLS_INCLUDE_DIRS})
endif()
- if(UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_MQTT_TLS_OPENSSL)
+ if(UA_ENABLE_ENCRYPTION_OPENSSL)
target_include_directories(open62541-object PRIVATE ${OPENSSL_INCLUDE_DIR})
endif()
if(UA_ENABLE_ENCRYPTION_LIBRESSL)
target_include_directories(open62541-object PRIVATE ${LIBRESSL_INCLUDE_DIR})
endif()
+ if(UA_ENABLE_NODESETLOADER)
+ target_include_directories(open62541-object PRIVATE
+ ${NODESETLOADER_PUBLIC_INCLUDES}
+ ${NODESETLOADER_PRIVATE_INCLUDES})
+ endif()
# make sure the open62541_amalgamation target builds before so that amalgamation is finished and it is not executed again for open62541-object
# and thus may overwrite the amalgamation result during multiprocessor compilation
@@ -1407,50 +1403,48 @@ if(UA_ENABLE_AMALGAMATION)
open62541-generator-types
open62541-generator-transport
open62541-generator-statuscode
- open62541-amalgamation-source
- )
+ open62541-amalgamation-source)
add_library(open62541 $)
# the only directory that needs to be included if open62541 (amalgameted) target from
# the build directory is ${PROJECT_BINARY_DIR}, that contains the generated open62541.h
target_include_directories(open62541 PUBLIC $)
- if(UA_FORCE_CPP)
- set_source_files_properties(${PROJECT_BINARY_DIR}/open62541.c PROPERTIES LANGUAGE CXX)
- endif()
-
add_dependencies(open62541-amalgamation-source open62541-generator-namespace)
add_dependencies(open62541-amalgamation-header open62541-generator-namespace)
else()
- add_library(open62541-object OBJECT ${lib_sources} ${internal_headers} ${exported_headers})
+ add_library(open62541-object OBJECT ${lib_sources} ${lib_headers} ${exported_headers})
+ target_include_directories(open62541-object PRIVATE ${PROJECT_SOURCE_DIR}/src)
add_custom_target(open62541-code-generation DEPENDS
open62541-generator-types
open62541-generator-transport
open62541-generator-statuscode
- open62541-generator-namespace
- )
+ open62541-generator-namespace)
- target_include_directories(open62541-object PRIVATE ${PROJECT_SOURCE_DIR}/src)
+ if(UA_ENABLE_NODESET_INJECTOR)
+ add_dependencies(open62541-code-generation open62541-generator-nodesetinjector)
+ endif()
+
+ if(UA_ENABLE_COVERAGE)
+ add_coverage(open62541-object)
+ endif()
+
+ # stack protector and optimization are disabled for the huge ns0 file
+ if(UA_NAMESPACE_ZERO STREQUAL "FULL" AND NOT MSVC)
+ set_source_files_properties(${PROJECT_BINARY_DIR}/src_generated/open62541/namespace0_generated.c
+ PROPERTIES COMPILE_FLAGS "-fno-stack-protector -O0")
+ endif()
- add_library(open62541-plugins OBJECT ${default_plugin_sources} ${ua_architecture_sources} ${exported_headers})
+ add_library(open62541-plugins OBJECT ${plugin_sources} ${architecture_sources} ${exported_headers})
add_dependencies(open62541-plugins open62541-generator-types open62541-generator-transport open62541-generator-namespace)
target_include_directories(open62541-plugins PRIVATE ${PROJECT_SOURCE_DIR}/plugins)
target_include_directories(open62541-plugins PRIVATE ${PROJECT_BINARY_DIR}/src_generated)
target_compile_definitions(open62541-plugins PRIVATE -DUA_DYNAMIC_LINKING_EXPORT)
set_target_properties(open62541-plugins PROPERTIES FOLDER "open62541/lib")
- if(UA_PACK_DEBIAN)
- add_library(open62541-static STATIC $ $)
- set_target_properties(open62541-static PROPERTIES OUTPUT_NAME open62541)
- endif()
add_library(open62541 $ $)
- if(UA_FORCE_CPP)
- set_source_files_properties(${lib_sources} PROPERTIES LANGUAGE CXX)
- set_source_files_properties(${default_plugin_sources} ${ua_architecture_sources} PROPERTIES LANGUAGE CXX)
- endif()
-
if(UA_ENABLE_ENCRYPTION_LIBRESSL)
# Prevent Wincrypt override warning.
target_compile_definitions(open62541-plugins PUBLIC NOCRYPT=1)
@@ -1474,31 +1468,34 @@ else()
endfunction()
# Public includes
- include_directories_public(${ua_architecture_directories_to_include}
- "${PROJECT_SOURCE_DIR}/include"
+ include_directories_public("${PROJECT_SOURCE_DIR}/include"
"${PROJECT_SOURCE_DIR}/plugins/include"
"${PROJECT_SOURCE_DIR}/deps"
"${PROJECT_SOURCE_DIR}/src/pubsub"
"${PROJECT_BINARY_DIR}/src_generated")
+ if(UA_ENABLE_NODESETLOADER)
+ include_directories_public(${NODESETLOADER_PUBLIC_INCLUDES})
+ endif()
+
# Private includes
include_directories_private("${PROJECT_BINARY_DIR}")
+ if(UA_ENABLE_DISCOVERY_MULTICAST)
+ include_directories_private("${PROJECT_BINARY_DIR}/src_generated/mdnsd")
+ endif()
if(UA_ENABLE_ENCRYPTION_MBEDTLS)
include_directories_private(${MBEDTLS_INCLUDE_DIRS})
endif()
- if(UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_MQTT_TLS_OPENSSL)
+ if(UA_ENABLE_ENCRYPTION_OPENSSL)
include_directories_private(${OPENSSL_INCLUDE_DIR})
endif()
if(UA_ENABLE_ENCRYPTION_LIBRESSL)
include_directories_private(${LIBRESSL_INCLUDE_DIR})
endif()
-
- # Option-specific includes
- if(UA_ENABLE_DISCOVERY)
- include_directories_private("${PROJECT_SOURCE_DIR}/src/client")
+ if(UA_ENABLE_NODESETLOADER)
+ include_directories_private(${NODESETLOADER_PRIVATE_INCLUDES})
endif()
-
endif()
add_dependencies(open62541-object open62541-code-generation)
@@ -1513,32 +1510,15 @@ if(UA_ENABLE_DISCOVERY_MULTICAST)
target_compile_definitions(open62541-object PRIVATE -DMDNSD_DYNAMIC_LINKING_EXPORT)
target_compile_definitions(open62541 PRIVATE -DMDNSD_DYNAMIC_LINKING_EXPORT)
endif()
-# Generate properly versioned shared library links on Linux
-SET_TARGET_PROPERTIES(open62541 PROPERTIES SOVERSION "${OPEN62541_VER_MAJOR}" VERSION "${OPEN62541_VER_MAJOR}.${OPEN62541_VER_MINOR}.${OPEN62541_VER_PATCH}")
-##################################
-# Architectures changes #
-##################################
-
-GET_PROPERTY(ua_architecture_add_definitions GLOBAL PROPERTY UA_ARCHITECTURE_ADD_DEFINITIONS)
-add_definitions(${ua_architecture_add_definitions})
-
-GET_PROPERTY(ua_architecture_remove_definitions GLOBAL PROPERTY UA_ARCHITECTURE_REMOVE_DEFINITIONS)
-if(NOT "${ua_architecture_remove_definitions}" STREQUAL "")
- string(REPLACE " " ";" ua_architecture_remove_definitions_list ${ua_architecture_remove_definitions})
- remove_definitions(${ua_architecture_remove_definitions_list})
- foreach ( flag ${ua_architecture_remove_definitions} )
- string(REPLACE "${flag}" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
- endforeach()
-endif(NOT "${ua_architecture_remove_definitions}" STREQUAL "")
-
-GET_PROPERTY(ua_architecture_append_to_library GLOBAL PROPERTY UA_ARCHITECTURE_APPEND_TO_LIBRARY)
-list(APPEND open62541_LIBRARIES ${ua_architecture_append_to_library})
-
-target_compile_definitions(open62541 PUBLIC UA_ARCHITECTURE_${UA_ARCHITECTURE_UPPER})
+# Generate properly versioned shared library links on Linux
+SET_TARGET_PROPERTIES(open62541 PROPERTIES
+ SOVERSION "${OPEN62541_VER_MAJOR}.${OPEN62541_VER_MINOR}"
+ VERSION "${OPEN62541_VER_MAJOR}.${OPEN62541_VER_MINOR}.${OPEN62541_VER_PATCH}")
# DLL requires linking to dependencies
-target_link_libraries(open62541 ${open62541_LIBRARIES})
+target_link_libraries(open62541 PUBLIC ${open62541_PUBLIC_LIBRARIES})
+target_link_libraries(open62541 PRIVATE ${open62541_LIBRARIES})
##########################
# Build Selected Targets #
@@ -1581,173 +1561,108 @@ endif()
########################
# Linting as target #
########################
+
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+include(linting_build)
include(linting_target)
##########################
# Installation #
##########################
+
# invoke via `make install`
# specify install location with `-DCMAKE_INSTALL_PREFIX=xyz`
# Enable shared library with `-DBUILD_SHARED_LIBS=ON`
-set(cmake_configfile_install ${CMAKE_INSTALL_LIBDIR}/cmake/open62541)
-set(open62541_install_tools_dir share/open62541/tools)
-set(open62541_install_nodeset_dir share/open62541/tools/ua-nodeset)
-
-# This list of components allows to define a find_package requirement.
-# E.g.:
-# find_package(open62541 1.0.0 REQUIRED COMPONENTS Events Methods FullNamespace)
-set(open62541_enabled_components "")
-if(UA_NAMESPACE_ZERO STREQUAL "FULL")
- list(APPEND open62541_enabled_components "FullNamespace")
-endif()
-if(UA_ENABLE_METHODCALLS)
- list(APPEND open62541_enabled_components "Methods")
-endif()
-if(UA_ENABLE_SUBSCRIPTIONS)
- list(APPEND open62541_enabled_components "Subscriptions")
-endif()
-if(UA_ENABLE_PUBSUB)
- list(APPEND open62541_enabled_components "PubSub")
-endif()
-list (FIND UA_ENCRYPTION_PLUGINS ${UA_ENABLE_ENCRYPTION} _tmp)
-if(${_tmp} GREATER -1)
- list(APPEND open62541_enabled_components "Encryption")
-endif()
-if(UA_ENABLE_ENCRYPTION_MBEDTLS)
- list(APPEND open62541_enabled_components "EncryptionMbedTLS")
-endif()
-if(UA_ENABLE_ENCRYPTION_OPENSSL)
- list(APPEND open62541_enabled_components "EncryptionOpenSSL")
-endif()
-if(UA_ENABLE_ENCRYPTION_LIBRESSL)
- list(APPEND open62541_enabled_components "EncryptionLibreSSL")
-endif()
if(UA_ENABLE_AMALGAMATION)
- list(APPEND open62541_enabled_components "Amalgamation")
-endif()
-if(UA_ENABLE_HISTORIZING)
- list(APPEND open62541_enabled_components "Historizing")
-endif()
-if(UA_ENABLE_EXPERIMENTAL_HISTORIZING)
- list(APPEND open62541_enabled_components "ExperimentalHistorizing")
-endif()
-if(UA_ENABLE_SUBSCRIPTIONS_EVENTS)
- list(APPEND open62541_enabled_components "Events")
-endif()
-if(UA_MULTITHREADING GREATER_EQUAL 100)
- list(APPEND open62541_enabled_components "Multithreading")
-endif()
-if(UA_ENABLE_DISCOVERY)
- list(APPEND open62541_enabled_components "Discovery")
-endif()
-if(UA_ENABLE_DISCOVERY_MULTICAST)
- list(APPEND open62541_enabled_components "DiscoveryMulticast")
+ install(CODE "MESSAGE(FATAL_ERROR \"Installation with UA_ENABLE_AMALGAMATION=ON is not possible.\")")
endif()
# export library (either static or shared depending on BUILD_SHARED_LIBS)
-if(UA_PACK_DEBIAN)
- set(EXTRATARGETS "open62541-static")
-else()
- set(EXTRATARGETS "")
-endif()
-install(TARGETS open62541 ${EXTRATARGETS}
+install(TARGETS open62541
EXPORT open62541Targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION include)
-if(UA_ENABLE_AMALGAMATION)
-# Our default way of installation is the non-amalgamated version.
-# See also https://github.com/open62541/open62541/pull/2292#discussion_r241106424
-install(CODE "MESSAGE(WARNING \"Installation with UA_ENABLE_AMALGAMATION=ON is not recommended.\")")
-endif()
+set(open62541_install_tools_dir share/open62541)
+set(open62541_install_schema_dir share/open62541/schema)
+# Create open62541Config.cmake
include(CMakePackageConfigHelpers)
+set(cmake_configfile_install ${CMAKE_INSTALL_LIBDIR}/cmake/open62541)
configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake/open62541Config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/open62541Config.cmake"
INSTALL_DESTINATION "${cmake_configfile_install}"
PATH_VARS open62541_install_tools_dir
- open62541_install_nodeset_dir
- open62541_enabled_components
- )
+ open62541_install_schema_dir)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/open62541Config.cmake"
+ "${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake/open62541Macros.cmake"
+ DESTINATION "${cmake_configfile_install}")
+# Create open62541ConfigVersion.cmake
set(open62541_VERSION)
get_target_property(open62541_VERSION open62541 VERSION)
-
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/open62541ConfigVersion.cmake"
- VERSION ${open62541_VERSION}
- COMPATIBILITY AnyNewerVersion)
+ VERSION ${open62541_VERSION} COMPATIBILITY AnyNewerVersion)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/open62541ConfigVersion.cmake"
+ DESTINATION "${cmake_configfile_install}")
+# Create open62541Targets.cmake
install(EXPORT open62541Targets
FILE open62541Targets.cmake
DESTINATION "${cmake_configfile_install}"
NAMESPACE open62541::)
+export(TARGETS open62541
+ NAMESPACE open62541::
+ FILE ${CMAKE_CURRENT_BINARY_DIR}/open62541Targets.cmake)
-export(
- TARGETS open62541
- NAMESPACE open62541::
- FILE ${CMAKE_CURRENT_BINARY_DIR}/open62541Targets.cmake
-)
-
-configure_file("${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake/macros_public.cmake" "${CMAKE_CURRENT_BINARY_DIR}/open62541Macros.cmake" COPYONLY)
-
-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/open62541Config.cmake"
- "${CMAKE_CURRENT_BINARY_DIR}/open62541ConfigVersion.cmake"
- "${CMAKE_CURRENT_BINARY_DIR}/open62541Macros.cmake"
- DESTINATION "${cmake_configfile_install}")
-
-if(UA_ENABLE_ENCRYPTION_MBEDTLS)
- install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake/FindMbedTLS.cmake"
- DESTINATION "${cmake_configfile_install}")
+# Generate and install open62541.pc
+if(UA_ENABLE_AMALGAMATION)
+ set(PC_EXTRA_CFLAGS "-DUA_ENABLE_AMALGAMATION")
endif()
+string(REPLACE ";" " " pkgcfg_requiresprivate "${pkgcfg_requiresprivate}")
+string(REPLACE ";" " " pkgcfg_libsprivate "${pkgcfg_libsprivate}")
+configure_file(tools/open62541.pc.in ${PROJECT_BINARY_DIR}/src_generated/open62541.pc @ONLY)
+
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
install(FILES "${PROJECT_BINARY_DIR}/src_generated/open62541.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
-set(UA_install_tools_dirs "tools/certs"
- "tools/nodeset_compiler"
- "tools/schema"
- ${open62541_NODESET_DIR})
-
+# Install nodeset compiler
+install(DIRECTORY "tools/certs" "tools/nodeset_compiler"
+ DESTINATION ${open62541_install_tools_dir}
+ FILES_MATCHING
+ PATTERN "*"
+ PATTERN "__pycache__" EXCLUDE
+ PATTERN "*.pyc" EXCLUDE
+ PATTERN ".git*" EXCLUDE
+ PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE)
+
+# Install schemas
+# Trailing slash to prevent "schema/schema" nesting
+install(DIRECTORY ${UA_SCHEMA_DIR}/
+ DESTINATION ${open62541_install_schema_dir}
+ FILES_MATCHING
+ PATTERN "*.xml"
+ PATTERN "*Types.bsd"
+ PATTERN "StatusCode.csv"
+ PATTERN "NodeIds.csv"
+ PERMISSIONS OWNER_READ GROUP_READ)
+
+# Install python tools
set(UA_install_tools_files "tools/generate_datatypes.py"
- "tools/generate_nodeid_header.py"
- "tools/generate_statuscode_descriptions.py")
-
-install(DIRECTORY ${UA_install_tools_dirs}
- DESTINATION ${open62541_install_tools_dir}
- USE_SOURCE_PERMISSIONS
- FILES_MATCHING
- PATTERN "*"
- PATTERN "*.pyc" EXCLUDE
- )
-
-install(FILES ${UA_install_tools_files} DESTINATION ${open62541_install_tools_dir})
-
-if(UA_PACK_DEBIAN)
- set(UA_install_examples_dirs "examples/"
- "examples/access_control"
- "examples/custom_datatype"
- "examples/discovery"
- "examples/encryption"
- "examples/nodeset"
- "examples/pubsub")
-
- set(open62541_install_examples_dir share/open62541/examples)
- install(DIRECTORY ${UA_install_examples_dirs} COMPONENT examples DESTINATION ${open62541_install_examples_dir} USE_SOURCE_PERMISSIONS)
-endif()
+ "tools/generate_nodeid_header.py"
+ "tools/generate_statuscode_descriptions.py")
+install(FILES ${UA_install_tools_files} DESTINATION ${open62541_install_tools_dir}
+ PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE)
+# Recreate the include folder structure from the source also in /usr/include/open62541
if(NOT UA_ENABLE_AMALGAMATION)
- # Recreate the include folder structure from the source also in /usr/lib/include/open62541
-
- set(FILES_TO_INSTALL
- ${exported_headers}
- ${default_plugin_headers}
- ${ua_architecture_headers})
-
+ set(FILES_TO_INSTALL ${exported_headers} ${plugin_headers})
set(BASE_PATH_MAIN "${PROJECT_SOURCE_DIR}/include/open62541")
set(BASE_PATH_PLUGINS "${PROJECT_SOURCE_DIR}/plugins/include/open62541")
set(BASE_PATH_ARCH "${PROJECT_SOURCE_DIR}/arch")
@@ -1772,16 +1687,10 @@ if(NOT UA_ENABLE_AMALGAMATION)
install(FILES ${full_path} DESTINATION include/open62541${dir})
endif()
endforeach()
-else()
- # Export amalgamated header open62541.h which is generated due to build of
- # open62541-object
- install(FILES ${PROJECT_BINARY_DIR}/open62541.h DESTINATION include)
endif()
-add_subdirectory(tools/packaging)
-
##################################
-# Visual studio solution folders #
+# Visual Studio Solution Folders #
##################################
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
@@ -1798,3 +1707,7 @@ set_target_properties(open62541-generator-namespace PROPERTIES FOLDER "open62541
set_target_properties(open62541-generator-statuscode PROPERTIES FOLDER "open62541/generators")
set_target_properties(open62541-generator-transport PROPERTIES FOLDER "open62541/generators")
set_target_properties(open62541-generator-types PROPERTIES FOLDER "open62541/generators")
+if(UA_ENABLE_NODESET_INJECTOR)
+ set_target_properties(open62541-generator-nodesetinjector PROPERTIES FOLDER "open62541/generators")
+ add_subdirectory(tools/nodeset_injector)
+endif()
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 2f1f73a1da9..f40e7a3419c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -25,8 +25,6 @@ expectations for all contributors.
Everybody can propose a pull request (PR). But only the core-maintainers of the
project can merge PR.
-### Minimal requirements for a PR
-
The following are the minimal requirements that every PR needs to meet.
- **Pass Continuous Integration (CI)**: Every PR has to pass our CI. This
@@ -34,26 +32,79 @@ The following are the minimal requirements that every PR needs to meet.
architectures, passing the unit tests and no detected issues with static code
analysis tools.
-- **Code-Style**: Please consider the
- [Code-Style](#code-style)
- recommendations when formatting your code.
+- **Code-Style**: Please consider the [Code-Style](#code-style) recommendations
+ when formatting your code.
- **Signed CLA**: Every contributor must sign the Contributor License Agreement
(CLA) before we can merge his first PR. The signing can be done online. The
link automatically appears on the page of the first PR. In addition, the CLA
text can be accessed [here](https://cla-assistant.io/open62541/open62541).
+- **Separation of Concerns**: Small changes are much easier to review.
+ Typically, small PR are merged much faster. For larger contributions, it might
+ make sense to break them up into a series of PR. For example, a PR with a new
+ feature should not contain other commits with only stylistic improvements to
+ another portion of the code.
+
+- **Feature Commits**: The same holds true for the individual PR as well. Every
+ commit inside the PR should do one thing only. If many changes have been
+ applied at the same time, `git add --patch` can be used to partially stage and
+ commit changes that belong together.
+
+- **Commit Messages**: Good commit messages help in understanding changes.
+ See the next section.
+
+- **Linear Commit History**: Our goal is to maintain a linear commit history
+ where possible. Use the `git rebase` functionality before pushing a PR. Use
+ `git rebase --interactive` to squash bugfix commits.
+
+These labels can be used for the PR title to indicate its status.
+
+- `[WIP]`: The PR is work in progress and at this point simply informative.
+- `[Review]`: The PR is ready from the developers perspective. He requests a
+ review from a core-maintainer.
+- `[Discussion]`: The PR is a contribution to ongoing technical discussions. The
+ PR may be incomplete and is not intended to be merged before the discussion
+ has concluded.
+
+The core-maintainers are busy people. If they take especially long to react,
+feel free to trigger them by additional comments in the PR thread. Again, small
+PR are much faster to review.
+
+It is the job of the developer that posts the PR to rebase the PR on the target
+branch when the two diverge.
+
+### Changes to the Public API
+
+The *public* API is the collection of header files in the /include folder.
+
+Changes to the public API are under especially high scrutiny. Public API changes
+are best discussed with the core-maintainers early on. Simply to avoid duplicate
+work when changes to the proposed API become necessary.
+
+You can create a special issue or PR just for the sake of discussing a proposed
+API change. The actual implementation can follow later on.
+
+Breaking changes are frowned upon. If you cannot avoid API changes, try to
+create a new one and keep the old API alive (maybe with an addition
+UA_DEPRECATED macro).
+
+Breaking changes have to be mentioned in the CHANGELOG file.
+
## Commit and PR Hygiene
-We have very precise rules over how our git commit messages can be formatted. This leads to **more
-readable messages** that are easy to follow when looking through the **project history**. But also,
-we use the git commit messages to **generate the change log**.
+We have very precise rules over how our git commit messages can be formatted.
+This leads to **more readable messages** that are easy to follow when looking
+through the **project history**. But also, we use the git commit messages to
+**generate the change log**.
-This convention is identical to the [Conventional Commits](https://www.conventionalcommits.org) specification or the one used by Angular.
+This convention is identical to the [Conventional
+Commits](https://www.conventionalcommits.org) specification or the one used by
+Angular.
-### Commit Message Format
-Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
-format that includes a **type**, a **scope** and a **subject**:
+Each commit message consists of a **Header**, a **Body** and a **Footer**. The
+header has a special format that includes a **Type**, a **Scope** and a
+**Subject**:
```text
():
@@ -63,10 +114,10 @@ format that includes a **type**, a **scope** and a **subject**: