meson.build 1.7 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-nu',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. #install folder
  21. install_folder = 'sdenoise.lv2'
  22. #get the build operating system and configure install path and shared object extension
  23. current_os = build_machine.system()
  24. if current_os == 'darwin' #mac
  25. extension = '.dylib'
  26. else #unix like
  27. extension = '.so'
  28. endif #windows
  29. if current_os == 'windows'
  30. extension = '.dll'
  31. endif
  32. #build of the shared object
  33. shared_library(lv2_name,src,name_prefix: '',include_directories: inc_rnnoise,dependencies: nr_dep,c_args: cflags,install: true,install_dir : install_folder)
  34. #Configure manifest ttl in order to replace the correct shared object extension
  35. manifest_conf = configuration_data()
  36. manifest_conf.set('LIB_EXT',extension)
  37. configure_file(input : 'lv2ttl/manifest.ttl.in',output : 'manifest.ttl',configuration : manifest_conf)
  38. #add manifest.ttl and nrepel.ttl to be installed with the shared object
  39. install_data(['build/manifest.ttl', 'lv2ttl/sdenoise.ttl'],install_dir : install_folder)