Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add depended on libraries and C++ runtime to link to in pkg-config file #119

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,16 @@ endif()
if(FFT_LIB STREQUAL "vdsp")
if(ACCELERATE_LIBRARIES)
set(USE_VDSP ON)
set(CHROMAPRINT_ADDITIONAL_LIBS "-F${ACCELERATE_LIBRARIES} -framework Accelerate")
else()
message(FATAL_ERROR "Selected ${FFT_LIB} for FFT calculations, but the library is not found")
endif()
elseif(FFT_LIB STREQUAL "avfft")
if(FFMPEG_LIBAVCODEC_FFT_FOUND)
set(USE_AVFFT ON)
find_package(PkgConfig)
pkg_check_modules(AVFFT REQUIRED libavcodec libavutil)
string(REPLACE ";" " " CHROMAPRINT_ADDITIONAL_LIBS "${AVFFT_LDFLAGS}")
else()
message(FATAL_ERROR "Selected ${FFT_LIB} for FFT calculations, but the library is not found")
endif()
Expand Down Expand Up @@ -193,6 +197,21 @@ else()
endif()

if(NOT BUILD_FRAMEWORK)
foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES})
if (LIB MATCHES "-l.*")
list(APPEND PKG_CXX_LIBS "${LIB}")
else()
list(APPEND PKG_CXX_LIBS "-l${LIB}")
endif()
endforeach()
if(PKG_CXX_LIBS)
# Blacklist for MinGW-w64
list(REMOVE_ITEM PKG_CXX_LIBS
"-lmingw32" "-lgcc_s" "-lgcc" "-lmoldname" "-lmingwex" "-lmingwthrd"
"-lmsvcrt" "-lpthread" "-ladvapi32" "-lshell32" "-luser32" "-lkernel32")
string(REPLACE ";" " " PKG_LIBS "${PKG_CXX_LIBS}")
set(CHROMAPRINT_ADDITIONAL_LIBS "${CHROMAPRINT_ADDITIONAL_LIBS} ${PKG_LIBS}")
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libchromaprint.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libchromaprint.pc)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/libchromaprint.pc
Expand Down
2 changes: 1 addition & 1 deletion libchromaprint.pc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ Name: ${PROJECT_NAME}
Description: Audio fingerprint library
URL: http://acoustid.org/chromaprint
Version: ${PROJECT_VERSION}
Libs: -L${LIB_INSTALL_DIR} -lchromaprint
Libs: -L${LIB_INSTALL_DIR} -lchromaprint @CHROMAPRINT_ADDITIONAL_LIBS@
Cflags: -I${INCLUDE_INSTALL_DIR}