meson.build 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. project('speech-denoiser','c',default_options: 'c_std=c99')
  2. #shared object name
  3. lv2_name = 'sdenoise'
  4. #source to compile
  5. src = 'src/sdenoise.c'
  6. #get compiler
  7. cc = meson.get_compiler('c')
  8. #handling rnnoise static library
  9. lib_rnnoise = cc.find_library('rnnoise',dirs: meson.current_source_dir() + '/rnnoise/.libs/',required : true)
  10. inc_rnnoise = include_directories('rnnoise/include')
  11. #dependencies for speech denoise
  12. m_dep = cc.find_library('m', required : true)
  13. lv2_dep = dependency('lv2', required : true)
  14. nr_dep = [m_dep,lv2_dep,lib_rnnoise]
  15. #compiler optimization flags
  16. if meson.get_compiler('c').get_id() == 'clang'
  17. add_global_arguments('-mrecip', language : 'c')
  18. endif
  19. cflags = ['-msse','-msse2','-mfpmath=sse','-ffast-math','-fomit-frame-pointer','-fno-finite-math-only']
  20. #get the build operating system and configure install path and shared object extension
  21. current_os = build_machine.system()
  22. if current_os == 'darwin' #mac
  23. i_path = '/Library/Audio/Plug-Ins/LV2/sdenoise.lv2'
  24. extension = '.dylib'
  25. else #unix like
  26. i_path = '/usr/local/lib/lv2/sdenoise.lv2'
  27. extension = '.so'
  28. endif #windows
  29. if current_os == 'windows'
  30. i_path = '%COMMONPROGRAMFILES%/LV2/sdenoise.lv2'
  31. extension = '.dll'
  32. endif
  33. #build of the shared object
  34. shared_library(lv2_name,src,name_prefix: '',include_directories: inc_rnnoise,dependencies: nr_dep,c_args: cflags,install: true,install_dir : i_path)
  35. #Configure manifest ttl in order to replace the correct shared object extension
  36. manifest_conf = configuration_data()
  37. manifest_conf.set('LIB_EXT',extension)
  38. configure_file(input : 'lv2ttl/manifest.ttl.in',output : 'manifest.ttl',configuration : manifest_conf)
  39. #add manifest.ttl and nrepel.ttl to be installed with the shared object
  40. install_data(['build/manifest.ttl', 'lv2ttl/sdenoise.ttl'],install_dir : i_path)