Use pkg-config for abseil-cpp detection if available

This should make things a bit easier.
This commit is contained in:
Arun Raghavan 2021-10-19 15:58:50 -04:00
parent ff85c98683
commit 8bf9efad15

View File

@ -40,6 +40,25 @@ os_deps = []
have_posix = false have_posix = false
have_win = false have_win = false
# Let's use pkg-config if available. This will also fallback to the subproject
# if pkg-config is not found, instead of CMake or manual library detection.
# This might be surprising, but is hopefully a temporary state until recent
# abseil versions become the norm.
absl_base_dep = dependency('absl_base', required : false)
absl_flags_dep = dependency('absl_flags', required : false)
absl_strings_dep = dependency('absl_strings', required : false)
absl_synchronization_dep = dependency('absl_synchronization', required : false)
# If we have the base dep, assume the rest should be present to
if absl_base_dep.found()
absl_dep = [
absl_base_dep,
absl_flags_dep,
absl_strings_dep,
absl_synchronization_dep
]
else
warning('Could not find abseil-cpp with pkg-config, trying CMake-based library detection.')
absl_dep = dependency('absl', method : 'cmake', absl_dep = dependency('absl', method : 'cmake',
modules : [ modules : [
'absl::base', 'absl::base',
@ -86,6 +105,7 @@ if not absl_dep.found()
absl_dep += cpp.find_library(l, required : false) absl_dep += cpp.find_library(l, required : false)
endforeach endforeach
endif endif
endif
if ['darwin', 'ios'].contains(host_system) if ['darwin', 'ios'].contains(host_system)
os_cflags = ['-DWEBRTC_MAC'] os_cflags = ['-DWEBRTC_MAC']