• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2015 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/buildflag_header.gni")
6import("//components/nacl/features.gni")
7import("//components/nacl/toolchain.gni")
8import("//mojo/public/tools/bindings/mojom.gni")
9
10if (enable_nacl) {
11  # This is separate so it can be used by ../broker:nacl64.
12  static_library("minimal") {
13    sources = [
14      "nacl_cmd_line.cc",
15      "nacl_cmd_line.h",
16      "nacl_constants.cc",
17      "nacl_constants.h",
18      "nacl_messages.cc",
19      "nacl_messages.h",
20      "nacl_process_type.h",
21      "nacl_service.cc",
22      "nacl_service.h",
23      "nacl_types.cc",
24      "nacl_types.h",
25      "nacl_types_param_traits.cc",
26      "nacl_types_param_traits.h",
27    ]
28
29    public_deps = [
30      ":minimal_content_dummy",
31      ":switches",
32      "//ipc",
33      "//sandbox/policy",
34    ]
35
36    deps = [
37      "//base",
38      "//base:base_static",
39      "//content/public/common:content_descriptors",
40      "//mojo/core/embedder",
41      "//native_client/src/trusted/error_code",
42      "//services/service_manager/public/cpp",
43    ]
44  }
45
46  # This exists just to make 'gn check' happy with :minimal.  It can't
47  # depend on //content/public/common or anything like that, because that
48  # would bring in lots more than counts as "minimal" (stuff that should
49  # not be in the nacl64.exe build).
50  source_set("minimal_content_dummy") {
51    check_includes = false
52    sources = [
53      "//content/public/common/content_descriptors.h",
54      "//content/public/common/content_switches.h",
55      "//content/public/common/process_type.h",
56    ]
57
58    # Deps required by the above headers.
59    deps = [ "//media:media_buildflags" ]
60  }
61
62  static_library("common") {
63    sources = [
64      "nacl_host_messages.cc",
65      "nacl_host_messages.h",
66      "pnacl_types.cc",
67      "pnacl_types.h",
68    ]
69
70    public_deps = [
71      ":minimal",
72      ":mojo_bindings",
73      ":switches",
74      "//ipc",
75    ]
76
77    deps = [
78      "//base",
79      "//build:chromeos_buildflags",
80      "//url",
81      "//url/ipc:url_ipc",
82    ]
83
84    if (is_linux || is_chromeos) {
85      sources += [
86        "nacl_paths.cc",
87        "nacl_paths.h",
88      ]
89
90      defines = [ "__STDC_LIMIT_MACROS=1" ]
91
92      deps += [ "//content/common:sandbox_support_linux" ]
93    }
94  }
95
96  source_set("debug_exception_handler") {
97    sources = []
98
99    deps = [ "//base" ]
100
101    if (is_win) {
102      sources += [
103        "nacl_debug_exception_handler_win.cc",
104        "nacl_debug_exception_handler_win.h",
105      ]
106    }
107  }
108
109  mojom("mojo_bindings") {
110    sources = [ "nacl.mojom" ]
111    cpp_typemaps = [
112      {
113        types = [
114          {
115            mojom = "nacl.mojom.NaClErrorCode"
116            cpp = "::NaClErrorCode"
117          },
118        ]
119        traits_headers =
120            [ "//native_client/src/trusted/service_runtime/nacl_error_code.h" ]
121        traits_private_headers =
122            [ "//components/nacl/common/nacl_types_param_traits.h" ]
123        traits_public_deps = [
124          ":minimal",
125          "//native_client/src/trusted/error_code",
126        ]
127        traits_deps = [ "//ipc" ]
128      },
129    ]
130  }
131}
132
133# Depending on this allows targets to unconditionally include
134# nacl_process_type.h without testing whether nacl is enabled.
135source_set("process_type") {
136  public = [ "nacl_process_type.h" ]
137
138  deps = [ "//content/public/common" ]
139}
140
141static_library("switches") {
142  sources = [
143    "nacl_switches.cc",
144    "nacl_switches.h",
145  ]
146}
147
148buildflag_header("buildflags") {
149  header = "buildflags.h"
150  flags = [
151    "ENABLE_NACL=$enable_nacl",
152    "IS_MINIMAL_TOOLCHAIN=$is_minimal_toolchain",
153  ]
154}
155