blob: a3a43f5b6c36be4baac66b017013bdd1047b5dde (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# ======================================
# OPC UA Discovery — Top-level build
# ======================================
#
# Builds three programs that demonstrate OPC UA discovery.
# bobink_opcua_discovery_server runs a Local Discovery Server.
# bobink_opcua_server periodically registers itself with the LDS. client
# queries servers for discovery info, endpoints, or current time.
#
# All programs link against common (shared helpers and config parser) which in
# turn depends on open62541.
cmake_minimum_required(VERSION 4.0)
project(BobinkOpcUaC C)
set(CMAKE_C_STANDARD 11)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(cmake/BuildDeps.cmake)
# ======================================
# Libraries and executables
# ======================================
# Shared helpers (file loading, security factories, config parser) used by all
# three programs.
add_library(common STATIC src/common.c src/config.c)
target_link_libraries(common open62541::open62541)
# Unified client: find-servers, get-endpoints, read-time.
add_executable(client src/client.c)
target_link_libraries(client common)
# Runs the Local Discovery Server that other servers register with.
add_executable(bobink_opcua_discovery_server src/server_lds.c)
target_link_libraries(bobink_opcua_discovery_server common)
# Runs a server that periodically registers itself with the LDS.
add_executable(bobink_opcua_server src/server_register.c)
target_link_libraries(bobink_opcua_server common)
# ======================================
# Documentation
# ======================================
# Builds the open62541 HTML documentation via Sphinx. Requires python3-sphinx,
# python3-sphinx-rtd-theme, graphviz.
option(BUILD_DOC "Build open62541 HTML documentation" OFF)
if(BUILD_DOC)
add_custom_target(
doc
COMMAND ${CMAKE_COMMAND} --build "${OPEN62541_BUILD_DIR}" --target doc
COMMENT "Building open62541 HTML documentation"
VERBATIM)
endif()
# ======================================
# Integration tests
# ======================================
#
# Each test exercises a combination of security mode/policy and authentication
# method. _test_names and _test_policies are parallel lists: the Nth name uses
# the Nth policy. Each name corresponds to a config directory under tests/
# containing server_lds.conf, server_register.conf, server_register_client.conf,
# client.conf.
enable_testing()
set(_test_script "${CMAKE_SOURCE_DIR}/tests/run_test.sh")
set(_test_names unsecure_anonymous secure_anonymous secure_user secure_cert)
set(_test_policies None Aes256_Sha256_RsaPss Aes256_Sha256_RsaPss
Aes256_Sha256_RsaPss)
foreach(_name _policy IN ZIP_LISTS _test_names _test_policies)
add_test(NAME "${_name}" COMMAND bash "${_test_script}" "tests/${_name}"
"${_policy}")
set_tests_properties("${_name}" PROPERTIES WORKING_DIRECTORY
"${CMAKE_SOURCE_DIR}" TIMEOUT 30)
endforeach()
add_test(NAME "download_cert"
COMMAND bash "${CMAKE_SOURCE_DIR}/tests/run_download_cert_test.sh"
"tests/secure_anonymous")
set_tests_properties(
"download_cert" PROPERTIES WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" TIMEOUT 30)
add_test(NAME "cert_bootstrap"
COMMAND bash "${CMAKE_SOURCE_DIR}/tests/run_cert_bootstrap_test.sh"
"tests/cert_bootstrap")
set_tests_properties(
"cert_bootstrap" PROPERTIES WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" TIMEOUT
30)
|