Skip to content

Commit 7b8f4d4

Browse files
yunowooonyshch
andauthored
Enable gvametapublishkafka gvametapublishmqtt on Windows (#718)
* Enable gvametapublishkafka gvametapublishmqtt on Windows * apply suggestions Co-authored-by: Lena Onyshchenko <olena.onyshchenko@intel.com> * comments --------- Co-authored-by: Lena Onyshchenko <olena.onyshchenko@intel.com>
1 parent 358520f commit 7b8f4d4

File tree

8 files changed

+100
-31
lines changed

8 files changed

+100
-31
lines changed

.github/workflows/dls-build-and-test-windows.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ env:
2626
VIDEO_INPUTS_PATH: 'C:\videos\videos'
2727
TESTS_RESULTS_DIRECTORY: 'C:\dlstreamer_test_results'
2828
PYTHON_VERSION: '3.12.7'
29-
DLL_EXPECTED_COUNT: 16
29+
DLL_EXPECTED_COUNT: 19
3030

3131
jobs:
3232
DLS_Building_and_Testing:

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66

77
cmake_minimum_required(VERSION 3.20)
88

9+
if(WIN32)
10+
set(VCPKG_OVERLAY_TRIPLETS "${CMAKE_SOURCE_DIR}/cmake/vcpkg/triplets")
11+
set(VCPKG_TARGET_TRIPLET "x64-windows-mixed")
12+
endif()
13+
914
project(DL_Streamer C CXX)
1015

1116
include_directories("${CMAKE_BINARY_DIR}/deps/install/include;${CMAKE_BINARY_DIR}/deps/gstreamer-bin/include;${CMAKE_BINARY_DIR}/deps/opencv-bin/include")
@@ -112,10 +117,10 @@ option(ENABLE_SAMPLES "Parameter to enable samples building" ON)
112117
cmake_dependent_option(TREAT_WARNING_AS_ERROR "Treat build warnings as errors" ON "UNIX" OFF)
113118
cmake_dependent_option(ENABLE_ITT "Enable ITT for tracing" ON "UNIX AND NOT ${CMAKE_SYSTEM_PROCESSOR} STREQUAL aarch64" OFF)
114119
cmake_dependent_option(ENABLE_VAAPI "Parameter to enable VAAPI for image pre-processing" ON "UNIX" ON)
115-
cmake_dependent_option(ENABLE_PAHO_INSTALLATION "Enables paho-mqtt3c installation" OFF "UNIX" OFF)
120+
cmake_dependent_option(ENABLE_PAHO_INSTALLATION "Enables paho-mqtt3c installation" OFF "UNIX" ON "WIN32" OFF)
116121
cmake_dependent_option(ENABLE_TESTS "Parameter to enable tests building" ON "UNIX" OFF)
117122
cmake_dependent_option(ENABLE_FUZZING "Parameter to enable fuzzy tests building" OFF "UNIX" OFF)
118-
cmake_dependent_option(ENABLE_RDKAFKA_INSTALLATION "Enables rdkafka installation" OFF "UNIX" OFF)
123+
cmake_dependent_option(ENABLE_RDKAFKA_INSTALLATION "Enables rdkafka installation" OFF "UNIX" ON "WIN32" OFF)
119124
option(ENABLE_AUDIO_INFERENCE_ELEMENTS "Enables audio inference elements" ON)
120125
option(ENABLE_REALSENSE "Parameter to enable RelaseSense plugin compilation" OFF)
121126
option(ENABLE_GENAI "Enables GenAI elements" OFF)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# ==============================================================================
2+
# Copyright (C) 2026 Intel Corporation
3+
#
4+
# SPDX-License-Identifier: MIT
5+
# ==============================================================================
6+
7+
set(VCPKG_TARGET_ARCHITECTURE x64)
8+
set(VCPKG_CRT_LINKAGE dynamic)
9+
set(VCPKG_BUILD_TYPE release)
10+
if(${PORT} MATCHES "curl|dlfcn-win32|lz4|opencl|openssl|zlib|zstd")
11+
set(VCPKG_LIBRARY_LINKAGE static)
12+
else()
13+
set(VCPKG_LIBRARY_LINKAGE dynamic)
14+
endif()

src/monolithic/gst/elements/gvametapublish/kafka/CMakeLists.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
# ==============================================================================
2-
# Copyright (C) 2021 Intel Corporation
2+
# Copyright (C) 2021-2026 Intel Corporation
33
#
44
# SPDX-License-Identifier: MIT
55
# ==============================================================================
66

77
set (TARGET_NAME "gvametapublishkafka")
88

99
find_package(PkgConfig REQUIRED)
10-
find_library(KAFKA rdkafka++ REQUIRED)
10+
if(WIN32)
11+
find_package(RdKafka CONFIG REQUIRED)
12+
set(KAFKA RdKafka::rdkafka++)
13+
else()
14+
find_library(KAFKA rdkafka++ REQUIRED)
15+
endif()
1116
pkg_check_modules(GSTREAMER gstreamer-1.0>=1.16 REQUIRED)
17+
pkg_check_modules(GSTBASE gstreamer-base-1.0>=1.16 REQUIRED)
1218

1319

1420
file (GLOB MAIN_SRC
@@ -20,20 +26,25 @@ file (GLOB MAIN_HEADERS
2026

2127
add_library(${TARGET_NAME} SHARED ${MAIN_SRC} ${MAIN_HEADERS})
2228
set_compile_flags(${TARGET_NAME})
29+
if(WIN32)
30+
add_vs_version_resource(${TARGET_NAME})
31+
endif()
2332

2433
target_include_directories(${TARGET_NAME}
2534
PUBLIC
2635
${CMAKE_CURRENT_SOURCE_DIR}
2736
PRIVATE
2837
${GLIB2_INCLUDE_DIRS}
2938
${GSTREAMER_INCLUDE_DIRS}
39+
${GSTBASE_INCLUDE_DIRS}
3040
)
3141

3242
target_link_libraries(${TARGET_NAME}
3343
PUBLIC
3444
gvametapublish
3545
PRIVATE
3646
${GSTREAMER_LIBRARIES}
47+
${GSTBASE_LIBRARIES}
3748
${KAFKA}
3849
)
3950

src/monolithic/gst/elements/gvametapublish/mqtt/CMakeLists.txt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
# ==============================================================================
2-
# Copyright (C) 2021-2024 Intel Corporation
2+
# Copyright (C) 2021-2026 Intel Corporation
33
#
44
# SPDX-License-Identifier: MIT
55
# ==============================================================================
66

77
set (TARGET_NAME "gvametapublishmqtt")
88

99
find_package(PkgConfig REQUIRED)
10-
find_library(UUID uuid REQUIRED)
11-
find_library(MQTT paho-mqtt3as REQUIRED)
10+
if(WIN32)
11+
find_package(eclipse-paho-mqtt-c CONFIG REQUIRED)
12+
set(MQTT eclipse-paho-mqtt-c::paho-mqtt3as)
13+
set(UUID rpcrt4)
14+
else()
15+
find_library(MQTT paho-mqtt3as REQUIRED)
16+
find_library(UUID uuid REQUIRED)
17+
endif()
1218
pkg_check_modules(GSTREAMER gstreamer-1.0>=1.16 REQUIRED)
1319

1420
file (GLOB MAIN_SRC
@@ -20,6 +26,9 @@ file (GLOB MAIN_HEADERS
2026

2127
add_library(${TARGET_NAME} SHARED ${MAIN_SRC} ${MAIN_HEADERS})
2228
set_compile_flags(${TARGET_NAME})
29+
if(WIN32)
30+
add_vs_version_resource(${TARGET_NAME})
31+
endif()
2332

2433
target_include_directories(${TARGET_NAME}
2534
PRIVATE
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*******************************************************************************
2+
* Copyright (C) 2026 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
******************************************************************************/
6+
7+
#pragma once
8+
9+
#include <string>
10+
11+
#ifdef _WIN32
12+
#define RPC_USE_NATIVE_WCHAR
13+
#include <rpc.h>
14+
#include <stdexcept>
15+
16+
inline std::string generate_client_id() {
17+
UUID uuid;
18+
RPC_STATUS status = UuidCreate(&uuid);
19+
if (status != RPC_S_OK && status != RPC_S_UUID_LOCAL_ONLY)
20+
throw std::runtime_error("UuidCreate failed with status " + std::to_string(status));
21+
RPC_WSTR szUuid = nullptr;
22+
status = UuidToStringW(&uuid, &szUuid);
23+
if (status != RPC_S_OK)
24+
throw std::runtime_error("UuidToStringW failed with status " + std::to_string(status));
25+
std::wstring wide(szUuid);
26+
std::string result(wide.begin(), wide.end());
27+
RpcStringFreeW(&szUuid);
28+
return result;
29+
}
30+
31+
#else
32+
#include <uuid/uuid.h>
33+
34+
inline std::string generate_client_id() {
35+
// 36 character UUID string plus terminating character
36+
static constexpr int kUuidStringLen = UUID_STR_LEN + 1;
37+
uuid_t binuuid;
38+
uuid_generate_random(binuuid);
39+
char uuid[kUuidStringLen];
40+
uuid_unparse(binuuid, uuid);
41+
return uuid;
42+
}
43+
44+
#endif

src/monolithic/gst/elements/gvametapublish/mqtt/gvametapublishmqtt.cpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (C) 2018-2025 Intel Corporation
2+
* Copyright (C) 2018-2026 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
******************************************************************************/
@@ -9,13 +9,13 @@
99
#include <nlohmann/json.hpp>
1010
using json = nlohmann::json;
1111

12+
#include "generate_client_id.hpp"
1213
#include "gvametapublishmqtt.hpp"
1314

1415
#include <common.hpp>
1516
#include <safe_arithmetic.hpp>
1617

1718
#include <MQTTAsync.h>
18-
#include <uuid/uuid.h>
1919

2020
#include <cstdint>
2121
#include <string>
@@ -24,18 +24,6 @@ using json = nlohmann::json;
2424
GST_DEBUG_CATEGORY_STATIC(gva_meta_publish_mqtt_debug_category);
2525
#define GST_CAT_DEFAULT gva_meta_publish_mqtt_debug_category
2626

27-
namespace {
28-
std::string generate_client_id() {
29-
uuid_t binuuid;
30-
uuid_generate_random(binuuid);
31-
char uuid[37];
32-
// 36 character UUID string plus terminating character
33-
uuid_unparse(binuuid, uuid);
34-
return uuid;
35-
}
36-
37-
} // namespace
38-
3927
/* Properties */
4028
enum {
4129
PROP_0,

vcpkg.json

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33
{
44
"name": "opencv4",
55
"default-features": false,
6-
"features": ["world", "opencl", "calib3d", "dshow", "fs", "intrinsics", "msmf", "thread", "win32ui"]
6+
"features": ["world", "opencl", "calib3d", "fs", "intrinsics", "thread", "win32ui"]
77
},
88
"pkgconf",
99
"opencl",
1010
"dlfcn-win32",
11-
"fmt"
12-
],
13-
"overrides": [
14-
{
15-
"name": "fmt",
16-
"version": "10.2.1"
17-
}
18-
]
11+
"paho-mqttpp3",
12+
{
13+
"name": "librdkafka",
14+
"features": ["curl", "ssl", "zlib", "zstd"]
15+
}
16+
]
1917
}

0 commit comments

Comments
 (0)