• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1rpicamsrc_sources = [
2  'gstrpicamsrc.c',
3  'gstrpicamsrcdeviceprovider.c',
4  'RaspiCapture.c',
5  'RaspiCamControl.c',
6  'RaspiPreview.c',
7  'RaspiCLI.c',
8]
9
10if host_system != 'linux' or (host_cpu != 'arm' and host_cpu != 'aarch64')
11  assert(not get_option('rpicamsrc').enabled(), 'rpicamsrc was enabled by options but will not be built')
12  subdir_done()
13endif
14
15if get_option('rpicamsrc').disabled()
16  subdir_done()
17endif
18
19rpi_inc_path = get_option('rpi-header-dir')
20rpi_lib_path = get_option('rpi-lib-dir')
21
22rpi_inc_args = [
23  '-I' + rpi_inc_path,
24  '-I' + join_paths(rpi_inc_path, 'interface', 'vcos', 'pthreads'),
25  '-I' + join_paths(rpi_inc_path, 'interface', 'vmcs_host', 'linux'),
26]
27
28if not cc.has_header('bcm_host.h', args: rpi_inc_args)
29  if get_option('rpicamsrc').enabled()
30    error('Could not find bcm_host.h. Please pass the location of this header via -Drpi-header-dir=/path')
31  else
32    subdir_done()
33  endif
34endif
35
36thread_dep = dependency('threads')
37rt_dep = cxx.find_library('rt', required : false)
38
39mmal_deps = [thread_dep, rt_dep]
40foreach rpi_lib : ['mmal_core', 'mmal_util', 'mmal_vc_client', 'vcos', 'vchostif', 'vchiq_arm', 'bcm_host']
41  l = cc.find_library(rpi_lib, dirs: rpi_lib_path, required: false)
42  if not l.found()
43    if get_option('rpicamsrc').enabled()
44      error('''
45            Could not find lib@0@ in standard library paths and @1@.
46	    Please pass the location of these libs via -Dwith-rpi-lib-dir=/path.
47	    '''.format(rpi_lib, rpi_lib_path))
48    else
49      subdir_done()
50    endif
51  endif
52  mmal_deps += [l]
53endforeach
54
55rpi_warn_flags = cc.get_supported_arguments([
56  # vcos/mmal headers
57  '-Wno-redundant-decls',
58  # RaspiCapture.c + RaspiCamControl.c
59  '-Wno-discarded-qualifiers',
60  '-Wno-declaration-after-statement',
61  '-Wno-missing-prototypes',
62  '-Wno-missing-declarations',
63  '-Wno-stringop-truncation',
64])
65
66rpi_link_flags = cc.get_supported_link_arguments(['-Wl,--no-as-needed'])
67
68gnome = import('gnome')
69
70enums = gnome.mkenums_simple('gstrpicam-enum-types',
71  sources: 'gstrpicam_types.h',
72  identifier_prefix: 'GstRpiCamSrc',
73  symbol_prefix: 'gst_rpi_cam_src')
74
75gstrpicamsrc = library('gstrpicamsrc',
76  rpicamsrc_sources, enums,
77  c_args: [gst_plugins_good_args, rpi_inc_args, rpi_warn_flags],
78  link_args: rpi_link_flags,
79  include_directories: [configinc, libsinc],
80  dependencies: [gst_dep, gstbase_dep, gstvideo_dep] + mmal_deps,
81  override_options: ['b_asneeded=false'],
82  install_dir: plugins_install_dir,
83  install: true)
84
85pkgconfig.generate(gstrpicamsrc, install_dir: plugins_pkgconfig_install_dir)
86plugins += [gstrpicamsrc]
87