From 5fb67e9da9fd3d81fd30e6d7e66b067580d0f7fb Mon Sep 17 00:00:00 2001 From: Arthur Araujo <153530493+arthuraraujo-msft@users.noreply.github.com> Date: Tue, 19 Mar 2024 17:16:27 -0300 Subject: [PATCH] [correlation-vector-cpp] new port (#37282) --- .../correlation-vector.patch | 50 +++++++++++++++++++ ports/correlation-vector-cpp/portfile.cmake | 28 +++++++++++ ports/correlation-vector-cpp/usage | 4 ++ ports/correlation-vector-cpp/vcpkg.json | 21 ++++++++ versions/baseline.json | 4 ++ versions/c-/correlation-vector-cpp.json | 9 ++++ 6 files changed, 116 insertions(+) create mode 100644 ports/correlation-vector-cpp/correlation-vector.patch create mode 100644 ports/correlation-vector-cpp/portfile.cmake create mode 100644 ports/correlation-vector-cpp/usage create mode 100644 ports/correlation-vector-cpp/vcpkg.json create mode 100644 versions/c-/correlation-vector-cpp.json diff --git a/ports/correlation-vector-cpp/correlation-vector.patch b/ports/correlation-vector-cpp/correlation-vector.patch new file mode 100644 index 0000000000..de1a2d5ab4 --- /dev/null +++ b/ports/correlation-vector-cpp/correlation-vector.patch @@ -0,0 +1,50 @@ +diff --git a/CorrelationVector/CMakeLists.txt b/CorrelationVector/CMakeLists.txt +index 2b32f8b..2c3a0ec 100644 +--- a/CorrelationVector/CMakeLists.txt ++++ b/CorrelationVector/CMakeLists.txt +@@ -9,7 +9,7 @@ include (CVOptions) + include (CVHelpers) + + add_global_definitions () +-set_global_compile_flags () ++#set_global_compile_flags () + + set(CORRELATION_VECTOR_VERSION_MAJOR 1) + set(CORRELATION_VECTOR_VERSION_MINOR 0) +diff --git a/CorrelationVector/cmake/correlation_vector-config.in.cmake b/CorrelationVector/cmake/correlation_vector-config.in.cmake +index 6b389d5..9c4fb5a 100644 +--- a/CorrelationVector/cmake/correlation_vector-config.in.cmake ++++ b/CorrelationVector/cmake/correlation_vector-config.in.cmake +@@ -1 +1,7 @@ ++# Optional dependency for Linux ++if(UNIX) ++ include(CMakeFindDependencyMacro) ++ find_dependency(unofficial-libuuid) ++endif() ++ + include("${CMAKE_CURRENT_LIST_DIR}/correlation_vector-targets.cmake") +\ No newline at end of file +diff --git a/CorrelationVector/src/CMakeLists.txt b/CorrelationVector/src/CMakeLists.txt +index 00baa66..08f3fc9 100644 +--- a/CorrelationVector/src/CMakeLists.txt ++++ b/CorrelationVector/src/CMakeLists.txt +@@ -15,16 +15,9 @@ else() + if (WIN32) + target_compile_definitions(${TARGETNAME} PUBLIC GUID_WINDOWS) + elseif (UNIX) +- # apt-get install pkg-config uuid-dev +- find_package(PkgConfig REQUIRED) +- # TODO: move to FindUUID module +- pkg_check_modules(UUID uuid) +- if (UUID_FOUND) +- message("Found and using uuid.") +- target_include_directories(${TARGETNAME} PUBLIC ${UUID_INCLUDE_DIRS}) +- target_link_libraries(${TARGETNAME} PRIVATE ${UUID_LIBRARIES}) +- target_compile_definitions(${TARGETNAME} PUBLIC GUID_LIBUUID) +- endif() ++ find_package(unofficial-libuuid REQUIRED) ++ target_compile_definitions(${TARGETNAME} PUBLIC GUID_LIBUUID) ++ target_link_libraries(${TARGETNAME} PRIVATE unofficial::UUID::uuid) + endif() + endif() + diff --git a/ports/correlation-vector-cpp/portfile.cmake b/ports/correlation-vector-cpp/portfile.cmake new file mode 100644 index 0000000000..99555c7bf4 --- /dev/null +++ b/ports/correlation-vector-cpp/portfile.cmake @@ -0,0 +1,28 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO microsoft/CorrelationVector-Cpp + REF cf38d2b44baaf352509ad9980786bc49554c32e4 + SHA512 f97eaef649ffd010fb79bca0ae6cb7ce6792dcb38f6a5180d04dc6542589d0d727583455bbafb319982cfed1291384180d49c7f32ebe7560b444ec132c76d0c4 + HEAD_REF master + PATCHES + "correlation-vector.patch" +) + +if(VCPKG_TARGET_IS_WINDOWS) + vcpkg_check_linkage(ONLY_STATIC_LIBRARY) +endif() + +vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}") +vcpkg_cmake_install() +vcpkg_fixup_pkgconfig() +vcpkg_cmake_config_fixup(PACKAGE_NAME correlation_vector CONFIG_PATH lib/correlation_vector) + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +if(VCPKG_TARGET_IS_WINDOWS) + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") +endif() diff --git a/ports/correlation-vector-cpp/usage b/ports/correlation-vector-cpp/usage new file mode 100644 index 0000000000..be0f91b33d --- /dev/null +++ b/ports/correlation-vector-cpp/usage @@ -0,0 +1,4 @@ +The package CorrelationVector-Cpp provides CMake targets: + + find_package(correlation_vector CONFIG REQUIRED) + target_link_libraries(main PRIVATE microsoft::correlation_vector) diff --git a/ports/correlation-vector-cpp/vcpkg.json b/ports/correlation-vector-cpp/vcpkg.json new file mode 100644 index 0000000000..c7a602f99e --- /dev/null +++ b/ports/correlation-vector-cpp/vcpkg.json @@ -0,0 +1,21 @@ +{ + "name": "correlation-vector-cpp", + "version": "1.0", + "description": "CorrelationVector-Cpp provides a reference C++ implementation of the CorrelationVector protocol for tracing and correlation of events through a distributed system.", + "homepage": "https://github.com/microsoft/CorrelationVector-Cpp", + "license": "MIT", + "dependencies": [ + { + "name": "libuuid", + "platform": "!windows" + }, + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index 19627c7fd4..30f758e407 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -1824,6 +1824,10 @@ "baseline": "2020.06", "port-version": 8 }, + "correlation-vector-cpp": { + "baseline": "1.0", + "port-version": 0 + }, "cpp-async": { "baseline": "1.1.0", "port-version": 0 diff --git a/versions/c-/correlation-vector-cpp.json b/versions/c-/correlation-vector-cpp.json new file mode 100644 index 0000000000..28205c47e6 --- /dev/null +++ b/versions/c-/correlation-vector-cpp.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "004b3aeae78d35b82ed9672a0d94340a82bfdc06", + "version": "1.0", + "port-version": 0 + } + ] +}