# role: opcua 用于将软总线数据模型转换为 OPC UA 数据模型
softbus_package(softbus_opcua)

add_library(softbus_opcua STATIC
    src/UaServerEngine.cpp
    src/UaAddressSpaceBuilder.cpp
    src/UaModelBinder.cpp
    src/UaMethodBinder.cpp
    src/UaEventBridge.cpp
    internal/UaServerImpl.cpp
    model/AddressSpace.cpp
    protocol/UaBinary.cpp
    protocol/UaServices.cpp
    security/UaTls.cpp
    events/UaEventEmitter.cpp
)

softbus_export_include(softbus_opcua "${CMAKE_CURRENT_SOURCE_DIR}/include")

target_include_directories(softbus_opcua PRIVATE
    "${CMAKE_CURRENT_SOURCE_DIR}"
)

target_link_libraries(softbus_opcua PUBLIC softbus_core softbus_api softbus_bus softbus_net softbus_json)
softbus_apply_open62541(softbus_opcua)
softbus_apply_platform_libs(softbus_opcua)

if(SOFTBUS_HAS_OPCUA)
    find_package(OpenSSL QUIET)
    if(OpenSSL_FOUND)
        target_compile_definitions(softbus_opcua PRIVATE SOFTBUS_HAS_UA_TLS=1)
        target_link_libraries(softbus_opcua PRIVATE OpenSSL::SSL OpenSSL::Crypto)
        message(STATUS "softbus_opcua: OpenSSL found, TLS support available")
    else()
        message(STATUS "softbus_opcua: OpenSSL not found, SecurityPolicy#None only")
    endif()
endif()
