• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1asio_sources = [
2  'gstasiodeviceprovider.cpp',
3  'gstasioobject.cpp',
4  'gstasioringbuffer.cpp',
5  'gstasiosink.cpp',
6  'gstasiosrc.cpp',
7  'gstasioutils.cpp',
8  'plugin.c',
9]
10
11asio_option = get_option('asio')
12if asio_option.disabled() or host_system != 'windows'
13  subdir_done()
14endif
15
16# FIXME: non-msvc is not tested, and unlikely supported yet because of
17# tool-chain issue
18if cxx.get_id() != 'msvc'
19  if asio_option.enabled()
20    error('asio plugin can only be built with MSVC')
21  else
22    subdir_done ()
23  endif
24endif
25
26winapi_desktop = cxx.compiles('''#include <winapifamily.h>
27    #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
28    #error "not win32"
29    #endif''',
30    name: 'building for Win32')
31
32if not winapi_desktop
33  if asio_option.enabled()
34    error('asio plugin requires WINAPI_PARTITION_DESKTOP')
35  else
36    subdir_done ()
37  endif
38endif
39
40avrt_lib = cc.find_library('avrt', required: asio_option)
41if not avrt_lib.found()
42  subdir_done ()
43endif
44
45winmm_lib = cc.find_library('winmm', required: asio_option)
46if not winmm_lib.found()
47  subdir_done ()
48endif
49
50# Checking SDK headers. User should install ASIO sdk on system, and
51# this plugin requires asio.h, asiosys.h and iasiodrv.h headers
52asio_sdk_root = get_option ('asio-sdk-path')
53if asio_sdk_root == ''
54  if asio_option.enabled()
55    error('asio sdk path is needed, pass with -Dasio-sdk-path=C:/path/to/sdk')
56  else
57    subdir_done ()
58  endif
59endif
60
61asio_inc_dir = include_directories(join_paths(asio_sdk_root, 'common'), is_system : true)
62has_asio_header = cxx.has_header('asio.h', include_directories: asio_inc_dir)
63has_asiosys_header = cxx.has_header('asiosys.h', include_directories: asio_inc_dir)
64has_iasiodrv_header = cxx.has_header('iasiodrv.h', include_directories: asio_inc_dir)
65if not has_asio_header or not has_asiosys_header or not has_iasiodrv_header
66  if asio_option.enabled()
67    error('Failed to find required SDK header(s)')
68  else
69    subdir_done ()
70  endif
71endif
72
73asio_deps = [gstaudio_dep, avrt_lib, winmm_lib]
74
75gstasio = library('gstasio',
76    asio_sources,
77    include_directories : [configinc, asio_inc_dir],
78    dependencies : asio_deps,
79    c_args : gst_plugins_bad_args,
80    cpp_args : gst_plugins_bad_args,
81    install : true,
82    install_dir : plugins_install_dir)
83pkgconfig.generate(gstasio, install_dir : plugins_pkgconfig_install_dir)
84plugins += [gstasio]