summaryrefslogtreecommitdiff
path: root/peerd.gyp
blob: a8a6825bbcfee2631751437602193316ca252a93 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
{
  'target_defaults': {
    'variables': {
      'deps': [
        'dbus-1',
        'libchrome-<(libbase_ver)',
        'libchromeos-<(libbase_ver)',
      ],
    },
  },
  'targets': [
    {
      'target_name': 'peerd_common',
      'type': 'static_library',
      'variables': {
        'dbus_adaptors_out_dir': 'include/dbus_bindings',
        'dbus_service_config': 'dbus_bindings/dbus-service-config.json',
      },
      'sources': [
        'avahi_client.cc',
        'avahi_service_discoverer.cc',
        'avahi_service_publisher.cc',
        'constants.cc',
        'dbus_constants.cc',
        'dbus_bindings/org.chromium.peerd.Manager.dbus-xml',
        'dbus_bindings/org.chromium.peerd.Peer.dbus-xml',
        'dbus_bindings/org.chromium.peerd.Service.dbus-xml',
        'discovered_peer.cc',
        'manager.cc',
        'peer.cc',
        'peer_manager_impl.cc',
        'published_peer.cc',
        'service.cc',
        'technologies.cc',
        'typedefs.cc',
      ],
      'includes': ['../common-mk/generate-dbus-adaptors.gypi'],
      'actions': [
        {
          # Import D-Bus bindings from Avahi.
          'action_name': 'generate-avahi-proxies',
          'variables': {
            'dbus_service_config': 'dbus_bindings/avahi-service-config.json',
            'proxy_output_file': 'include/avahi/dbus-proxies.h',
            'shared_interface_dir': '<(sysroot)/usr/share/dbus-1/interfaces',
          },
          'sources': [
            '<(shared_interface_dir)/org.freedesktop.Avahi.EntryGroup.xml',
            '<(shared_interface_dir)/org.freedesktop.Avahi.Server.xml',
            '<(shared_interface_dir)/org.freedesktop.Avahi.ServiceBrowser.xml',
            '<(shared_interface_dir)/org.freedesktop.Avahi.ServiceResolver.xml',
          ],
          'includes': ['../common-mk/generate-dbus-proxies.gypi'],
        },
        {
          # Generate D-Bus proxies for peerd.
          'action_name': 'generate-peerd-proxies',
          'variables': {
            'dbus_service_config': 'dbus_bindings/dbus-service-config.json',
            'proxy_output_file': 'include/peerd/dbus-proxies.h',
            'mock_output_file': 'include/peerd/dbus-proxy-mocks.h',
            'proxy_path_in_mocks': 'peerd/dbus-proxies.h',
          },
          'sources': [
            'dbus_bindings/org.chromium.peerd.Manager.dbus-xml',
            'dbus_bindings/org.chromium.peerd.Peer.dbus-xml',
            'dbus_bindings/org.chromium.peerd.Service.dbus-xml',
          ],
          'includes': ['../common-mk/generate-dbus-proxies.gypi'],
        },
      ],
    },
    {
      'target_name': 'peerd',
      'type': 'executable',
      'sources': [
        'main.cc',
      ],
      'dependencies': [
        'peerd_common',
      ],
    },
  ],
  'conditions': [
    ['USE_test == 1', {
      'targets': [
        {
          'target_name': 'peerd_testrunner',
          'type': 'executable',
          'dependencies': [
            'peerd_common',
          ],
          'variables': {
            'deps': [
              'libchrome-test-<(libbase_ver)',
            ],
          },
          'includes': ['../common-mk/common_test.gypi'],
          'sources': [
            'avahi_client_unittest.cc',
            'avahi_service_publisher_unittest.cc',
            'discovered_peer_unittest.cc',
            'manager_unittest.cc',
            'peer_manager_impl_unittest.cc',
            'peer_unittest.cc',
            'published_peer_unittest.cc',
            'peerd_testrunner.cc',
            'service_unittest.cc',
            'test_util.cc',
          ],
        },
      ],
    }],
  ],
}