trunks.gyp revision 469ec33d58271390c7a5b77030b5e92f4e982a5e
1#
2# Copyright (C) 2014 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17{
18  'target_defaults': {
19    'includes': ['../../../../platform2/common-mk/common.gypi'],
20    'variables': {
21      'deps': [  # This is a list of pkg-config dependencies
22        'libbrillo-<(libbase_ver)',
23        'libchrome-<(libbase_ver)',
24        'openssl',
25        'protobuf-lite',
26      ],
27    },
28    'include_dirs': [
29      # We need this include dir because we include all the local code as
30      # "trunks/...".
31      '<(platform2_root)/../aosp/system/tpm/',
32    ],
33  },
34  'targets': [
35    {
36      'target_name': 'interface_proto',
37      'type': 'static_library',
38      'variables': {
39        'proto_in_dir': '.',
40        'proto_out_dir': 'include/trunks',
41      },
42      'sources': [
43        '<(proto_in_dir)/interface.proto',
44      ],
45      'includes': ['../../../../platform2/common-mk/protoc.gypi'],
46    },
47    {
48      'target_name': 'trunks',
49      'type': 'shared_library',
50      'sources': [
51        'background_command_transceiver.cc',
52        'blob_parser.cc',
53        'error_codes.cc',
54        'hmac_authorization_delegate.cc',
55        'hmac_session_impl.cc',
56        'password_authorization_delegate.cc',
57        'policy_session_impl.cc',
58        'session_manager_impl.cc',
59        'scoped_key_handle.cc',
60        'tpm_generated.cc',
61        'tpm_state_impl.cc',
62        'tpm_utility_impl.cc',
63        'trunks_factory_impl.cc',
64        'trunks_dbus_proxy.cc',
65      ],
66      'dependencies': [
67        'interface_proto',
68      ],
69      'conditions': [
70        ['USE_ftdi_tpm == 1', {
71            'sources': [
72              'ftdi/mpsse.c',
73              'ftdi/support.c',
74              'trunks_ftdi_spi.cc',
75            ],
76            'libraries': [
77              '-lftdi1',
78            ],
79            'defines': [
80              'SPI_OVER_FTDI=1',
81            ],
82          },
83        ],
84      ],
85    },
86    {
87      'target_name': 'trunks_test',
88      'type': 'static_library',
89      'standalone_static_library': 1,
90      'sources': [
91        'mock_authorization_delegate.cc',
92        'mock_blob_parser.cc',
93        'mock_command_transceiver.cc',
94        'mock_hmac_session.cc',
95        'mock_policy_session.cc',
96        'mock_session_manager.cc',
97        'mock_tpm.cc',
98        'mock_tpm_state.cc',
99        'mock_tpm_utility.cc',
100        'trunks_factory_for_test.cc',
101      ],
102    },
103    {
104      'target_name': 'trunks_client',
105      'type': 'executable',
106      'sources': [
107        'trunks_client.cc',
108        'trunks_client_test.cc',
109      ],
110      'dependencies': [
111        'trunks',
112      ],
113    },
114    {
115      'target_name': 'trunksd_lib',
116      'type': 'static_library',
117      'sources': [
118        'resource_manager.cc',
119        'tpm_handle.cc',
120        'tpm_simulator_handle.cc',
121        'trunks_dbus_service.cc',
122      ],
123      'dependencies': [
124        'interface_proto',
125      ],
126    },
127    {
128      'target_name': 'trunksd',
129      'type': 'executable',
130      'sources': [
131        'trunksd.cc',
132      ],
133      'variables': {
134        'deps': [
135          'libminijail',
136        ],
137      },
138      'dependencies': [
139        'interface_proto',
140        'trunks',
141        'trunksd_lib',
142      ],
143      'conditions': [
144        ['USE_ftdi_tpm == 1', {
145            'defines': [
146              'SPI_OVER_FTDI=1',
147            ],
148          },
149        ],
150      ],
151    },
152  ],
153  'conditions': [
154    ['USE_test == 1', {
155      'targets': [
156        {
157          'target_name': 'trunks_testrunner',
158          'type': 'executable',
159          'includes': ['../../../../platform2/common-mk/common_test.gypi'],
160          'sources': [
161            'background_command_transceiver_test.cc',
162            'hmac_authorization_delegate_test.cc',
163            'hmac_session_test.cc',
164            'password_authorization_delegate_test.cc',
165            'policy_session_test.cc',
166            'resource_manager_test.cc',
167            'scoped_key_handle_test.cc',
168            'session_manager_test.cc',
169            'tpm_generated_test.cc',
170            'tpm_state_test.cc',
171            'tpm_utility_test.cc',
172            'trunks_testrunner.cc',
173          ],
174          'dependencies': [
175            'trunks',
176            'trunks_test',
177            'trunksd_lib',
178          ],
179        },
180      ],
181    }],
182  ],
183}
184