# ====================================== # OPC UA Discovery — Top-level build # ====================================== # # Builds three programs that demonstrate OPC UA discovery: # ServerLDS — Local Discovery Server # ServerRegister — Server that registers with the LDS # ClientFindServers — Client that queries the LDS # # All programs link against DiscoveryCommon (shared helpers and # config parser) which in turn depends on open62541. cmake_minimum_required(VERSION 4.0) project(OpcUaDiscovery 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(DiscoveryCommon STATIC src/common.c src/config.c) target_link_libraries(DiscoveryCommon open62541::open62541) # Queries the LDS for registered servers and their endpoints. add_executable(ClientFindServers src/client_find_servers.c) target_link_libraries(ClientFindServers DiscoveryCommon) # Runs the Local Discovery Server that other servers register with. add_executable(ServerLDS src/server_lds.c) target_link_libraries(ServerLDS DiscoveryCommon) # Runs a server that periodically registers itself with the LDS. add_executable(ServerRegister src/server_register.c) target_link_libraries(ServerRegister DiscoveryCommon) # ====================================== # 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, client_find_servers.conf. enable_testing () set (_test_script "${CMAKE_SOURCE_DIR}/tests/run_test.sh") set (_test_names none_anon none_user basic256sha256_anon basic256sha256_user aes128_anon aes128_user) set (_test_policies None None Basic256Sha256 Basic256Sha256 Aes128_Sha256_RsaOaep Aes128_Sha256_RsaOaep) 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 ()