summaryrefslogtreecommitdiff
path: root/subprojects/shotwell-facedetect/meson.build
blob: 70570e4e797257d5a9f5d8e328ecac55c9d0d4d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
project('shotwell-facedetect', ['c', 'cpp'], default_options : ['cpp_std=c++17'])
gnome = import('gnome')
facedetect_dep = dependency('opencv4', version : ['>= 4.0.0'], required : false)
if not facedetect_dep.found()
    facedetect_dep = dependency('opencv', version : ['>= 3.4.0'], required : true)
endif
cpp = meson.get_compiler('cpp')
has_dnn = cpp.has_header('opencv2/dnn.hpp', dependencies: facedetect_dep)
if has_dnn
  dnn_define = declare_dependency(compile_args: '-DHAS_OPENCV_DNN')
else
  dnn_define = []
endif

libexecdir = join_paths(get_option('libexecdir'), 'shotwell')

gio = dependency('gio-2.0', version: '>= 2.40')
gio_unix = dependency('gio-unix-2.0', required : true)
gdbus_src = gnome.gdbus_codegen('dbus-interface',
  sources: 'org.gnome.ShotwellFaces1.xml',
  interface_prefix : 'org.gnome.')

con = configuration_data()
con.set('libexecdir', join_paths(get_option('prefix'), libexecdir))

if meson.is_subproject()
    config_incdir = include_directories('../..')
else
    config_incdir = include_directories('.')
    configure_file(
        input: 'org.gnome.Shotwell.Faces1.desktop.in',
        output: 'org.gnome.Shotwell.Faces1.desktop',
        configuration: con,
        install: true,
        install_dir : join_paths(get_option('datadir'), 'applications')
    )
endif

executable('shotwell-facedetect',
           'shotwell-facedetect.cpp', 'facedetect-opencv.cpp', gdbus_src,
           dependencies : [facedetect_dep, gio, gio_unix, dnn_define],
           install : true,
           include_directories: config_incdir,
           install_dir : libexecdir)
install_data('haarcascade_frontalface_alt.xml',
              install_dir : join_paths(get_option('datadir'), 'shotwell', 'facedetect'))
install_data('haarcascade_profileface.xml',
              install_dir : join_paths(get_option('datadir'), 'shotwell', 'facedetect'))
install_data(
  'openface.nn4.small2.v1.t7',
  install_dir: join_paths(get_option('datadir'), 'shotwell', 'facedetect')
)

install_data('deploy.prototxt', install_dir: join_paths(get_option('datadir'), 'shotwell', 'facedetect'))

configure_file(
    input : 'org.gnome.Shotwell.Faces1.service.in',
    output : 'org.gnome.Shotwell.Faces1.service',
    configuration: con,
    install: true,
    install_dir : join_paths(get_option('datadir'), 'dbus-1', 'services')
    )