You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libspatialaudio/SOURCES/0001-Fix-MySofa-library-dir...

74 lines
2.0 KiB

From 6795100468b683187bd9e284205cdb3cab42a4fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>
Date: Mon, 6 May 2024 15:04:15 +0200
Subject: [PATCH] Fix MySofa library directory detection
Current code was causing issues because:
get_filename_component(MYSOFA_LIB_DIR "${MYSOFA_LIBRARIES}" DIRECTORY)
was nil.
Thus we had:
Libs: -L${libdir} -lspatialaudio -L -lmysofa -lm -lz
in spatialaudio.pc
And thus, while building vlc, libtool was unhappy:
libtool: error: require no space between '-L' and '-lmysofa'
Here we use proper pkg-config feature PKG_CONFIG_LIBRARY_DIRS
to get the directory set in libmysofa.pc, with a find_path fallback.
---
CMakeLists.txt | 3 +--
cmake/Modules/FindMySofa.cmake | 11 +++++++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bcdc866..080191d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -137,8 +137,7 @@ configure_file(
)
if(MYSOFA_FOUND)
- get_filename_component(MYSOFA_LIB_DIR "${MYSOFA_LIBRARIES}" DIRECTORY)
- set(MYSOFA_LIB "-L${MYSOFA_LIB_DIR} -lmysofa")
+ set(MYSOFA_LIB "-L${MYSOFA_LIBRARY_DIRS} -lmysofa")
set(MYSOFA_INCLUDE "-I${MYSOFA_INCLUDE_DIRS}")
endif(MYSOFA_FOUND)
diff --git a/cmake/Modules/FindMySofa.cmake b/cmake/Modules/FindMySofa.cmake
index 0b125c3..5e81962 100644
--- a/cmake/Modules/FindMySofa.cmake
+++ b/cmake/Modules/FindMySofa.cmake
@@ -23,12 +23,23 @@ if(PKG_CONFIG_FOUND)
pkg_check_modules(MYSOFA libmysofa)
endif(PKG_CONFIG_FOUND)
+if(MYSOFA)
+ set(MYSOFA_INCLUDE_DIRS ${MYSOFA_PKG_CONFIG_INCLUDE_DIRS})
+ set(MYSOFA_LIBRARY_DIRS ${MYSOFA_PKG_CONFIG_LIBRARY_DIRS})
+endif()
+
if(NOT MYSOFA_LIBRARIES)
find_library(MYSOFA_LIBRARIES
NAMES mysofa
)
endif(NOT MYSOFA_LIBRARIES)
+if(NOT MYSOFA_LIBRARY_DIRS)
+ find_path(MYSOFA_LIBRARY_DIRS
+ NAMES libmysofa.so
+ )
+endif(NOT MYSOFA_LIBRARY_DIRS)
+
if(NOT MYSOFA_INCLUDE_DIRS)
find_path(MYSOFA_INCLUDE_DIRS
NAMES mysofa.h
--
2.44.0