From 4a62efbb952959ff9f52c4faab1e6046d6fc8ee4 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Wed, 26 Jun 2024 21:42:39 +0300 Subject: [PATCH] cmake : minor fixes --- cmake/DefaultTargetOptions.cmake | 2 +- cmake/FindFFmpeg.cmake | 4 ++-- cmake/whisper-config.cmake.in | 36 ++++++++++++++++---------------- examples/CMakeLists.txt | 2 +- examples/ffmpeg-transcode.cpp | 2 +- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/cmake/DefaultTargetOptions.cmake b/cmake/DefaultTargetOptions.cmake index b4e93e3c..fc118a2b 100644 --- a/cmake/DefaultTargetOptions.cmake +++ b/cmake/DefaultTargetOptions.cmake @@ -13,5 +13,5 @@ set_target_properties(${TARGET} PROPERTIES EXPORT_COMPILE_COMMANDS ON RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" - INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" ) diff --git a/cmake/FindFFmpeg.cmake b/cmake/FindFFmpeg.cmake index 19dc7516..bb6aff6c 100644 --- a/cmake/FindFFmpeg.cmake +++ b/cmake/FindFFmpeg.cmake @@ -36,7 +36,7 @@ include(FindPackageHandleStandardArgs) # The default components were taken from a survey over other FindFFMPEG.cmake files if (NOT FFmpeg_FIND_COMPONENTS) - set(FFmpeg_FIND_COMPONENTS AVFORMAT AVCODEC AVUTIL SWRESAMPLE) + set(FFmpeg_FIND_COMPONENTS AVFORMAT AVCODEC AVUTIL SWRESAMPLE) endif() # @@ -84,7 +84,7 @@ macro(find_component _component _pkgconfig _library _header) # CMake's default is to search first for shared libraries and then for static libraries. # Todo later: add option to prefer static libs over dynamic: - find_library(${_component}_LIBRARIES NAMES ${_library} lib${_library}.a + find_library(${_component}_LIBRARIES NAMES ${_library} lib${_library}.a HINTS ${PC_${_component}_LIBDIR} ${PC_${_component}_LIBRARY_DIRS} diff --git a/cmake/whisper-config.cmake.in b/cmake/whisper-config.cmake.in index 2e7da2f8..6a3fa227 100644 --- a/cmake/whisper-config.cmake.in +++ b/cmake/whisper-config.cmake.in @@ -1,7 +1,7 @@ -set(LLAMA_VERSION @LLAMA_INSTALL_VERSION@) -set(LLAMA_BUILD_COMMIT @LLAMA_BUILD_COMMIT@) -set(LLAMA_BUILD_NUMBER @LLAMA_BUILD_NUMBER@) -set(LLAMA_SHARED_LIB @BUILD_SHARED_LIBS@) +set(WHISPER_VERSION @WHISPER_INSTALL_VERSION@) +set(WHISPER_BUILD_COMMIT @WHISPER_BUILD_COMMIT@) +set(WHISPER_BUILD_NUMBER @WHISPER_BUILD_NUMBER@) +set(WHISPER_SHARED_LIB @BUILD_SHARED_LIBS@) set(GGML_BLAS @GGML_BLAS@) set(GGML_CUDA @GGML_CUDA@) @@ -11,9 +11,9 @@ set(GGML_ACCELERATE @GGML_ACCELERATE@) @PACKAGE_INIT@ -set_and_check(LLAMA_INCLUDE_DIR "@PACKAGE_LLAMA_INCLUDE_INSTALL_DIR@") -set_and_check(LLAMA_LIB_DIR "@PACKAGE_LLAMA_LIB_INSTALL_DIR@") -set_and_check(LLAMA_BIN_DIR "@PACKAGE_LLAMA_BIN_INSTALL_DIR@") +set_and_check(WHISPER_INCLUDE_DIR "@PACKAGE_WHISPER_INCLUDE_INSTALL_DIR@") +set_and_check(WHISPER_LIB_DIR "@PACKAGE_WHISPER_LIB_INSTALL_DIR@") +set_and_check(WHISPER_BIN_DIR "@PACKAGE_WHISPER_BIN_INSTALL_DIR@") # Ensure transient dependencies satisfied @@ -43,23 +43,23 @@ if (GGML_HIPBLAS) find_package(rocblas REQUIRED) endif() -find_library(llama_LIBRARY llama +find_library(whisper_LIBRARY whisper REQUIRED - HINTS ${LLAMA_LIB_DIR}) + HINTS ${WHISPER_LIB_DIR}) -set(_llama_link_deps "Threads::Threads" "@LLAMA_EXTRA_LIBS@") -set(_llama_transient_defines "@LLAMA_TRANSIENT_DEFINES@") +set(_whisper_link_deps "Threads::Threads" "@WHISPER_EXTRA_LIBS@") +set(_whisper_transient_defines "@WHISPER_TRANSIENT_DEFINES@") -add_library(llama UNKNOWN IMPORTED) +add_library(whisper UNKNOWN IMPORTED) -set_target_properties(llama +set_target_properties(whisper PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${LLAMA_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${_llama_link_deps}" - INTERFACE_COMPILE_DEFINITIONS "${_llama_transient_defines}" + INTERFACE_INCLUDE_DIRECTORIES "${WHISPER_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${_whisper_link_deps}" + INTERFACE_COMPILE_DEFINITIONS "${_whisper_transient_defines}" IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_LOCATION "${llama_LIBRARY}" + IMPORTED_LOCATION "${whisper_LIBRARY}" INTERFACE_COMPILE_FEATURES cxx_std_11 POSITION_INDEPENDENT_CODE ON ) -check_required_components(Llama) +check_required_components(whisper) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index ab1e5aa3..cc091d71 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -40,7 +40,7 @@ if (WHISPER_FFMPEG) message(STATUS "Found ffmpeg libs: ${FFMPEG_LIBRARIES}") message(STATUS "Found ffmpeg headers in: ${FFMPEG_INCLUDE_DIRS}") message(STATUS "ffmpeg definitions: ${FFMPEG_DEFINITIONS}") - message(STATUS "Found avformat ${AVFORMAT_VERSION}") + message(STATUS "Found avformat ${AVFORMAT_VERSION}") include_directories(${FFMPEG_INCLUDE_DIRS}) add_compile_definitions(WHISPER_FFMPEG) diff --git a/examples/ffmpeg-transcode.cpp b/examples/ffmpeg-transcode.cpp index 910cdf57..f800db66 100644 --- a/examples/ffmpeg-transcode.cpp +++ b/examples/ffmpeg-transcode.cpp @@ -321,7 +321,7 @@ int ffmpeg_decode_audio(const std::string &ifname, std::vector& owav_da LOG("Couldn't map input file %s\n", ifname.c_str()); return err; } - LOG("Mapped input file: %x size: %d\n", ibuf, ibuf_size); + LOG("Mapped input file: %s size: %d\n", ibuf, (int) ibuf_size); struct audio_buffer inaudio_buf; inaudio_buf.ptr = ibuf; inaudio_buf.size = ibuf_size;