Skip to content

Commit

Permalink
use if defined elseif for sherpa_onnx.pas
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj committed Aug 16, 2024
1 parent dad70ee commit 3dc040d
Showing 1 changed file with 31 additions and 33 deletions.
64 changes: 31 additions & 33 deletions sherpa-onnx/pascal-api/sherpa_onnx.pas
Original file line number Diff line number Diff line change
Expand Up @@ -316,44 +316,42 @@ implementation
- https://downloads.freepascal.org/fpc/docs-pdf/CinFreePascal.pdf
}

{$IFDEF WINDOWS}
{$if defined(WINDOWS)}
{ For windows, we always use dynamic link. See
https://forum.lazarus.freepascal.org/index.php/topic,15712.msg84781.html#msg84781
We need to rebuild the static lib for windows using Mingw or cygwin
}
SherpaOnnxLibName = 'sherpa-onnx-c-api.dll';
{$ELSE}
{$IFNDEF SHERPA_ONNX_USE_SHARED_LIBS}
{static link for linux and macos}
{$linklib sherpa-onnx-c-api}
{$linklib sherpa-onnx-core}
{$linklib kaldi-decoder-core}
{$linklib sherpa-onnx-kaldifst-core}
{$linklib sherpa-onnx-fstfar}
{$linklib sherpa-onnx-fst}
{$linklib kaldi-native-fbank-core}
{$linklib piper_phonemize}
{$linklib espeak-ng}
{$linklib ucd}
{$linklib onnxruntime}
{$linklib ssentencepiece_core}

{$IFDEF LINUX}
{$linklib m}
{$LINKLIB stdc++}
{$LINKLIB gcc_s}
{$ENDIF}

{$IFDEF DARWIN}
{$linklib c++}
{$ENDIF}
SherpaOnnxLibName = '';
{$ELSE}
{dynamic link for linux and macos}
SherpaOnnxLibName = 'sherpa-onnx-c-api';
{$linklib sherpa-onnx-c-api}
{$ENDIF}
{$ENDIF}
{$elseif not defined(SHERPA_ONNX_USE_SHARED_LIBS)}
{static link for linux and macos}
{$linklib sherpa-onnx-c-api}
{$linklib sherpa-onnx-core}
{$linklib kaldi-decoder-core}
{$linklib sherpa-onnx-kaldifst-core}
{$linklib sherpa-onnx-fstfar}
{$linklib sherpa-onnx-fst}
{$linklib kaldi-native-fbank-core}
{$linklib piper_phonemize}
{$linklib espeak-ng}
{$linklib ucd}
{$linklib onnxruntime}
{$linklib ssentencepiece_core}

{$ifdef LINUX}
{$linklib m}
{$LINKLIB stdc++}
{$LINKLIB gcc_s}
{$endif}

{$ifdef DARWIN}
{$linklib c++}
{$endif}
SherpaOnnxLibName = '';
{$else}
{dynamic link for linux and macos}
SherpaOnnxLibName = 'sherpa-onnx-c-api';
{$linklib sherpa-onnx-c-api}
{$endif}

type
SherpaOnnxWave = record
Expand Down

0 comments on commit 3dc040d

Please sign in to comment.