From 94b68f341cadd5433a10d346c1c248a641d8be57 Mon Sep 17 00:00:00 2001 From: "Nathaniel R. Lewis" <linux.robotdude@gmail.com> Date: Thu, 9 May 2019 21:38:14 -0700 Subject: [PATCH] cmake - Add support for detecting the presence of lrint and lrintf. Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca> --- CMakeLists.txt | 5 +++++ opus_config.cmake | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fd40e741..3d147075c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -314,6 +314,11 @@ if(COMPILER_SUPPORT_NEON AND OPUS_USE_NEON) endif() endif() +target_compile_definitions(opus + PRIVATE + $<$<BOOL:${HAVE_LRINT}>:HAVE_LRINT> + $<$<BOOL:${HAVE_LRINTF}>:HAVE_LRINTF>) + install(TARGETS opus EXPORT OpusTargets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/opus_config.cmake b/opus_config.cmake index a0bfd5839..8d4283c0d 100644 --- a/opus_config.cmake +++ b/opus_config.cmake @@ -16,6 +16,10 @@ if(HAVE_LIBM) list(APPEND OPUS_REQUIRED_LIBRARIES m) endif() +include(CheckFunctionExists) +check_function_exists(lrintf HAVE_LRINTF) +check_function_exists(lrint HAVE_LRINT) + if(CMAKE_SYSTEM_PROCESSOR MATCHES "(i[0-9]86|x86|X86|amd64|AMD64|x86_64)") if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(OPUS_CPU_X64 1) -- GitLab