[aeron] Add libuuid dependency for Linux build (#49384)

This commit is contained in:
cuihairu 2026-01-16 03:02:37 +08:00 committed by GitHub
parent 397577fc23
commit 09ab3d69c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 94 additions and 3 deletions

View File

@ -0,0 +1,76 @@
diff --git a/aeron-driver/src/main/c/CMakeLists.txt b/aeron-driver/src/main/c/CMakeLists.txt
index 1234567..abcdefg 100644
--- a/aeron-driver/src/main/c/CMakeLists.txt
+++ b/aeron-driver/src/main/c/CMakeLists.txt
@@ -36,15 +36,39 @@ if (NOT MSVC)
endif ()
check_include_file("bsd/stdlib.h" BSDSTDLIB_H_EXISTS)
-check_include_file("uuid/uuid.h" UUID_H_EXISTS)
find_library(LIBBSD_EXISTS NAMES bsd libbsd)
-find_library(LIBUUID_EXISTS NAMES uuid libuuid libuuid.dll)
+find_library(LIBUUID_SYSTEM NAMES uuid libuuid libuuid.dll)
+
+# In vcpkg builds on Linux, use vcpkg's libuuid
+if(DEFINED VCPKG_TOOLCHAIN AND CMAKE_SYSTEM_NAME MATCHES "Linux")
+ find_package(unofficial-libuuid QUIET CONFIG)
+ if(TARGET unofficial::UUID::uuid)
+ get_target_property(UUID_INCLUDE_DIR unofficial::UUID::uuid INTERFACE_INCLUDE_DIRECTORIES)
+ if(UUID_INCLUDE_DIR)
+ list(APPEND CMAKE_REQUIRED_INCLUDES "${UUID_INCLUDE_DIR}")
+ endif()
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "unofficial::UUID::uuid")
+ set(LIBUUID_EXISTS TRUE)
+ set(AERON_LIB_UUID_LIBS "unofficial::UUID::uuid")
+ set(UUID_H_EXISTS TRUE)
+ set(UUID_GENERATE_PROTOTYPE_EXISTS TRUE)
+ endif()
+endif()
+
+if(NOT DEFINED LIBUUID_EXISTS OR NOT LIBUUID_EXISTS)
+ set(LIBUUID_EXISTS ${LIBUUID_SYSTEM})
+endif()
+
+# Only check for uuid headers if not found via vcpkg
+if(NOT DEFINED UUID_H_EXISTS OR NOT UUID_H_EXISTS)
+ check_include_file("uuid/uuid.h" UUID_H_EXISTS)
+endif()
if (LIBBSD_EXISTS)
set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES} -lbsd")
endif ()
-if (LIBUUID_EXISTS)
+if (LIBUUID_EXISTS AND NOT AERON_LIB_UUID_LIBS)
set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES} -luuid")
endif ()
@@ -64,7 +88,9 @@ if (MSVC AND "${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
set(WSAPOLL_PROTOTYPE_EXISTS True)
endif ()
-check_symbol_exists(uuid_generate "uuid/uuid.h" UUID_GENERATE_PROTOTYPE_EXISTS)
+if(NOT DEFINED UUID_GENERATE_PROTOTYPE_EXISTS OR NOT UUID_GENERATE_PROTOTYPE_EXISTS)
+ check_symbol_exists(uuid_generate "uuid/uuid.h" UUID_GENERATE_PROTOTYPE_EXISTS)
+endif()
check_symbol_exists(poll "poll.h" POLL_PROTOTYPE_EXISTS)
check_symbol_exists(epoll_create "sys/epoll.h" EPOLL_PROTOTYPE_EXISTS)
@@ -387,7 +413,7 @@ if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
set(AERON_LIB_BSD_LIBS bsd)
endif ()
- if (LIBUUID_EXISTS)
+ if (LIBUUID_EXISTS AND NOT AERON_LIB_UUID_LIBS)
set(AERON_LIB_UUID_LIBS uuid)
endif ()
@@ -400,7 +426,7 @@ if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
endif ()
if (CYGWIN)
- if (LIBUUID_EXISTS)
+ if (LIBUUID_EXISTS AND NOT AERON_LIB_UUID_LIBS)
set(AERON_LIB_UUID_LIBS uuid)
endif ()
endif ()

View File

@ -8,6 +8,8 @@ vcpkg_from_github(
REF "${VERSION}"
SHA512 6302b235285d897bb58d388c1883145c486f931575174b68161e67a04ae2efb48993d8045855d6e04ba378fdb58050c5339561c85fffb6b222abaa1952103d37
HEAD_REF master
PATCHES
patches/add-libuuid-vcpkg-support.patch
)
# Set archive option based on feature

View File

@ -2,11 +2,16 @@
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"name": "aeron",
"version": "1.49.3",
"port-version": 1,
"description": "Efficient reliable UDP unicast, UDP multicast, and IPC message transport",
"homepage": "https://github.com/aeron-io/aeron",
"license": "Apache-2.0",
"supports": "(x64 & !uwp & !xbox) | ((x64 | arm64) & !windows & !android)",
"supports": "(x64 & windows & !uwp & !xbox) | ((x64 | arm64) & !windows & !android)",
"dependencies": [
{
"name": "libuuid",
"platform": "linux"
},
{
"name": "vcpkg-cmake",
"host": true
@ -19,7 +24,7 @@
"features": {
"archive": {
"description": "Build Aeron Archive API for recording and replaying message streams (requires Java)",
"supports": "(x64 & !uwp & !xbox) | ((x64 | arm64) & !windows & !android)"
"supports": "(x64 & windows & !uwp & !xbox) | ((x64 | arm64) & !windows & !android)"
}
}
}

View File

@ -38,6 +38,9 @@
##
# Add new items alphabetically
aeron:arm-neon-android=fail
aeron:arm64-android=fail
aeron:x64-android=fail
apr:arm-neon-android=fail
apr:arm64-android=fail
apr:x64-android=fail

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "c7c0110b039da7b02fbf0a42de05428df118d56a",
"version": "1.49.3",
"port-version": 1
},
{
"git-tree": "44788413f50414d098289891dfcdc63f664ef067",
"version": "1.49.3",

View File

@ -58,7 +58,7 @@
},
"aeron": {
"baseline": "1.49.3",
"port-version": 0
"port-version": 1
},
"air-ctl": {
"baseline": "1.1.2",