diff --git a/CMakeLists.txt b/CMakeLists.txt index 06e9762e9b..acf0bb335f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,9 +64,13 @@ elseif (APPLE) set(CX_PLATFORM "darwin") elseif (UNIX) set(CX_PLATFORM "linux") - file(STRINGS "/etc/os-release" OS_RELEASE_CONTENT) - string(REGEX MATCH "VERSION_ID=\"?([0-9]+\\.[0-9]+)\"?" _ ${OS_RELEASE_CONTENT}) - set(UBUNTU_VERSION ${CMAKE_MATCH_1}) + file(STRINGS "/etc/os-release" OS_RELEASE_CONTENT NEWLINE_CONSUME) + string(REGEX MATCH "NAME=\"?([A-Za-z0-9_]+)\"?" _ ${OS_RELEASE_CONTENT}) + string(TOLOWER "${CMAKE_MATCH_1}" LINUX_DISTRIBUTION) + if (LINUX_DISTRIBUTION STREQUAL "ubuntu") + string(REGEX MATCH "VERSION_ID=\"?([0-9]+\\.[0-9]+)\"?" _ ${OS_RELEASE_CONTENT}) + set(UBUNTU_VERSION ${CMAKE_MATCH_1}) + endif() endif() message(STATUS "QUIC Platform: ${CX_PLATFORM}") diff --git a/src/platform/CMakeLists.txt b/src/platform/CMakeLists.txt index 5b01fdc891..ec1f1fdc6d 100644 --- a/src/platform/CMakeLists.txt +++ b/src/platform/CMakeLists.txt @@ -27,16 +27,11 @@ else() set(SOURCES ${SOURCES} inline.c platform_posix.c storage_posix.c cgroup.c datapath_unix.c) if(CX_PLATFORM STREQUAL "linux" AND NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") set(SOURCES ${SOURCES} datapath_linux.c datapath_epoll.c) - if ((${UBUNTU_VERSION} STREQUAL "20.04") OR - (${CMAKE_TARGET_ARCHITECTURE} STREQUAL "arm64") OR - (${CMAKE_TARGET_ARCHITECTURE} STREQUAL "arm") OR - (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm") OR - (ANDROID) OR - (QUIC_CARGO_BUILD)) - set(SOURCES ${SOURCES} datapath_xplat.c datapath_raw_dummy.c) - else() + if ("${UBUNTU_VERSION}" STREQUAL "22.04") set(LINUX_XDP_ENABLED TRUE) set(SOURCES ${SOURCES} datapath_xplat.c datapath_raw.c datapath_raw_linux.c datapath_raw_socket.c datapath_raw_socket_linux.c datapath_raw_xdp_linux.c) + else() + set(SOURCES ${SOURCES} datapath_xplat.c datapath_raw_dummy.c) endif() else() set(SOURCES ${SOURCES} datapath_kqueue.c)