|
|
|
|
@ -54,21 +54,10 @@ if(ENABLE_LIBUNWIND AND UNIX AND NOT ANDROID)
@@ -54,21 +54,10 @@ if(ENABLE_LIBUNWIND AND UNIX AND NOT ANDROID)
|
|
|
|
|
pkg_check_modules(LIBUNWIND QUIET libunwind) |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
# Fall back to find_library if pkg-config doesn't find it |
|
|
|
|
if(NOT LIBUNWIND_FOUND) |
|
|
|
|
find_library(LIBUNWIND_LIB unwind) |
|
|
|
|
find_library(LIBUNWIND_LIB NAMES unwind) |
|
|
|
|
if(LIBUNWIND_LIB) |
|
|
|
|
set(LIBUNWIND_LIBRARIES ${LIBUNWIND_LIB}) |
|
|
|
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64|aarch64|arm64") |
|
|
|
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64") |
|
|
|
|
find_library(LIBUNWIND_ARCH_LIB unwind-aarch64) |
|
|
|
|
else() |
|
|
|
|
find_library(LIBUNWIND_ARCH_LIB unwind-x86_64) |
|
|
|
|
endif() |
|
|
|
|
if(LIBUNWIND_ARCH_LIB) |
|
|
|
|
list(APPEND LIBUNWIND_LIBRARIES ${LIBUNWIND_ARCH_LIB}) |
|
|
|
|
endif() |
|
|
|
|
endif() |
|
|
|
|
set(LIBUNWIND_FOUND TRUE) |
|
|
|
|
endif() |
|
|
|
|
endif() |
|
|
|
|
@ -77,20 +66,34 @@ if(ENABLE_LIBUNWIND AND UNIX AND NOT ANDROID)
@@ -77,20 +66,34 @@ if(ENABLE_LIBUNWIND AND UNIX AND NOT ANDROID)
|
|
|
|
|
if(NOT LIBUNWIND_LIBRARIES) |
|
|
|
|
set(LIBUNWIND_LIBRARIES unwind) |
|
|
|
|
endif() |
|
|
|
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64|aarch64|arm64") |
|
|
|
|
list(JOIN LIBUNWIND_LIBRARIES ";" _libunwind_libs_joined) |
|
|
|
|
if(NOT _libunwind_libs_joined MATCHES "unwind-x86_64" AND NOT _libunwind_libs_joined MATCHES "unwind-aarch64") |
|
|
|
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64") |
|
|
|
|
find_library(LIBUNWIND_ARCH_LIB unwind-aarch64) |
|
|
|
|
else() |
|
|
|
|
find_library(LIBUNWIND_ARCH_LIB unwind-x86_64) |
|
|
|
|
|
|
|
|
|
find_library(LIBUNWIND_ARCH_LIB NAMES unwind-x86_64 unwind-x86 unwind-aarch64 unwind-arm unwind-loongarch64 unwind-ppc64 unwind-s390x) |
|
|
|
|
|
|
|
|
|
if(LIBUNWIND_ARCH_LIB) |
|
|
|
|
list(APPEND LIBUNWIND_LIBRARIES ${LIBUNWIND_ARCH_LIB}) |
|
|
|
|
else() |
|
|
|
|
if(PKG_CONFIG_FOUND) |
|
|
|
|
pkg_check_modules(LIBUNWIND_GENERIC QUIET libunwind-generic) |
|
|
|
|
|
|
|
|
|
if(LIBUNWIND_GENERIC_FOUND) |
|
|
|
|
list(APPEND LIBUNWIND_LIBRARIES ${LIBUNWIND_GENERIC_LIBRARIES}) |
|
|
|
|
endif() |
|
|
|
|
if(LIBUNWIND_ARCH_LIB) |
|
|
|
|
list(APPEND LIBUNWIND_LIBRARIES ${LIBUNWIND_ARCH_LIB}) |
|
|
|
|
else() |
|
|
|
|
message(WARNING "libunwind-x86_64 not found; stack traces may fail to link on x86_64.") |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
if(NOT LIBUNWIND_GENERIC_FOUND) |
|
|
|
|
find_library(LIBUNWIND_GENERIC NAMES unwind-generic) |
|
|
|
|
|
|
|
|
|
if(LIBUNWIND_GENERIC) |
|
|
|
|
list(APPEND LIBUNWIND_LIBRARIES ${LIBUNWIND_GENERIC}) |
|
|
|
|
set(LIBUNWIND_GENERIC_FOUND TRUE) |
|
|
|
|
endif() |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
if(LIBUNWIND_GENERIC_FOUND) |
|
|
|
|
message(WARNING "libunwind generic library used instead of arch one.") |
|
|
|
|
else() |
|
|
|
|
message(WARNING "libunwind arch or generic library not found; stack traces may fail to link.") |
|
|
|
|
endif() |
|
|
|
|
endif() |
|
|
|
|
set(HAVE_LIBUNWIND ON) |
|
|
|
|
message(STATUS "libunwind found - LIBUNWIND_LIBRARIES=${LIBUNWIND_LIBRARIES}") |
|
|
|
|
|