Skip to content

Commit

Permalink
Merge pull request #2 from eschmidbauer/main
Browse files Browse the repository at this point in the history
build module from apt install
  • Loading branch information
akscf committed May 15, 2024
2 parents 3d90ab6 + 513cae5 commit 7efbe5d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
```sh
# using freeswitch packages
apt update ; apt install libfreeswitch-dev libfreeswitch1 libfreeswitch1-dbg
cd mod_whisper_asr/sources
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j
make install
```

<p>
Provides offline speech recognition features for the Freeswitch. <br>
Was developed just as a gizmo to checking/playing with the Whisper capabilities. <br>
Expand Down
28 changes: 28 additions & 0 deletions sources/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.18)
project(mod_whisper_asr)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g")

#set(ENV{PKG_CONFIG_PATH} "/usr/local/freeswitch/lib/pkgconfig:/usr/local/ssl/lib/pkgconfig/:$ENV{PKG_CONFIG_PATH}")

find_package(PkgConfig REQUIRED)
pkg_check_modules(FreeSWITCH REQUIRED IMPORTED_TARGET freeswitch)
pkg_get_variable(FS_MOD_DIR freeswitch modulesdir)
message("FreeSWITCH modules dir: ${FS_MOD_DIR}")

if(CMAKE_BUILD_TYPE MATCHES "Release")
# Add linker flags to strip symbols and reduce size of static library
set_target_properties(PROPERTIES LINK_FLAGS_RELEASE "-s -w") #-static-libgcc -static-libstdc++
endif()

add_library(mod_whisper_asr SHARED mod_whisper_asr.c mod_whisper_asr.h whisper_api.h whisper_api.cpp utils.c whisper/ggml.h whisper/ggml.c whisper/whisper.h whisper/whisper.cpp)

set_property(TARGET mod_whisper_asr PROPERTY POSITION_INDEPENDENT_CODE ON)

target_include_directories(mod_whisper_asr PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/whisper)

target_link_libraries(mod_whisper_asr PRIVATE PkgConfig::FreeSWITCH pthread)

install(TARGETS mod_whisper_asr DESTINATION ${FS_MOD_DIR})

0 comments on commit 7efbe5d

Please sign in to comment.