Add metrics GYP file

BUG=chromium:220003
TEST=Run emerge-<board> -v platform2 with and without platform2 USE
flag on a range of boards plus the host

Change-Id: I44f15c31a8ac3917f3262912c43419a93652c0d8
Reviewed-on: https://gerrit.chromium.org/gerrit/40316
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Liam McLoughlin <lmcloughlin@chromium.org>
diff --git a/metrics/metrics.gyp b/metrics/metrics.gyp
new file mode 100644
index 0000000..b2644ba
--- /dev/null
+++ b/metrics/metrics.gyp
@@ -0,0 +1,113 @@
+{
+  'target_defaults': {
+      'dependencies': [
+        '../libchromeos/libchromeos-<(libbase_ver).gyp:libchromeos-<(libbase_ver)',
+      ],
+      'variables': {
+        'deps': [
+          'dbus-1',
+          'dbus-glib-1',
+          'glib-2.0',
+          'gobject-2.0',
+          'gthread-2.0',
+          'libchrome-<(libbase_ver)',
+        ]
+      },
+      'cflags_cc': [
+        '-fno-exceptions',
+      ],
+  },
+  'targets': [
+    {
+      'target_name': 'metrics',
+      'type': 'static_library',
+      'sources': [
+        'c_metrics_library.cc',
+        'metrics_library.cc',
+        'timer.cc',
+      ],
+    },
+    {
+      'target_name': 'libmetrics',
+      'type': 'shared_library',
+      'sources': [
+        'c_metrics_library.cc',
+        'metrics_library.cc',
+        'timer.cc',
+      ],
+    },
+    {
+      'target_name': 'libmetrics_daemon',
+      'type': 'static_library',
+      'dependencies': ['libmetrics'],
+      'link_settings': {
+        'libraries': [
+          '-lrootdev',
+          '-lgflags',
+        ],
+      },
+      'sources': [
+        'counter.cc',
+        'metrics_daemon.cc',
+        'metrics_daemon_main.cc',
+      ]
+    },
+    {
+      'target_name': 'metrics_daemon',
+      'type': 'executable',
+      'dependencies': ['libmetrics_daemon'],
+    },
+    {
+      'target_name': 'metrics_client',
+      'type': 'executable',
+      'dependencies': ['libmetrics'],
+      'sources': [
+        'metrics_client.cc',
+      ]
+    },
+  ],
+  'conditions': [
+    ['USE_test == 1', {
+      'targets': [
+        {
+          'target_name': 'metrics_library_test',
+          'type': 'executable',
+          'dependencies': ['libmetrics'],
+          'includes': ['../common-mk/common_test.gypi'],
+          'sources': [
+            'metrics_library_test.cc',
+          ]
+        },
+        {
+          'target_name': 'metrics_daemon_test',
+          'type': 'executable',
+          'dependencies': [
+            'libmetrics_daemon',
+          ],
+          'includes': ['../common-mk/common_test.gypi'],
+          'sources': [
+            'metrics_daemon_test.cc',
+          ]
+        },
+        {
+          'target_name': 'counter_test',
+          'type': 'executable',
+          'includes': ['../common-mk/common_test.gypi'],
+          'sources': [
+            'counter.cc',
+            'counter_test.cc',
+          ]
+        },
+        {
+          'target_name': 'timer_test',
+          'type': 'executable',
+          'includes': ['../common-mk/common_test.gypi'],
+          'sources': [
+            'timer.cc',
+            'timer_test.cc',
+          ]
+        },
+      ],
+    }],
+  ],
+}