summaryrefslogtreecommitdiffstats
path: root/mojo/mojo_application_package.gni
blob: 233ee97c6d96ffd44b9dce01626efe20e2a9576f (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
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//third_party/mojo/src/mojo/public/mojo_application.gni")

# Used for mojo applications that have resources. This creates a directory
# named output_name with the following contents:
#   output_name.mojo : the shared library
#   resources        : resources
template("mojo_application_package") {
  mojo_deps = []
  if (defined(invoker.deps)) {
    mojo_deps += invoker.deps
  }

  if (defined(invoker.resources)) {
    output_name = target_name
    if (defined(invoker.output_name)) {
      output_name = invoker.output_name
    }

    copy("copy_mojo_application_resources") {
      sources = invoker.resources
      outputs = [
        "$root_out_dir/$output_name/resources/{{source_file_part}}",
      ]
    }
    mojo_deps += [ ":copy_mojo_application_resources" ]
  }

  mojo_native_application(target_name) {
    output_name = invoker.target_name
    if (defined(invoker.output_name)) {
      output_name = invoker.output_name
    }
    output_name = output_name + "/" + output_name

    deps = mojo_deps

    if (defined(invoker.cflags)) {
      cflags = invoker.cflags
    }
    if (defined(invoker.cflags_c)) {
      cflags_c = invoker.cflags_c
    }
    if (defined(invoker.cflags_cc)) {
      cflags_cc = invoker.cflags_cc
    }
    if (defined(invoker.cflags_objc)) {
      cflags_objc = invoker.cflags_objc
    }
    if (defined(invoker.cflags_objcc)) {
      cflags_objcc = invoker.cflags_objcc
    }
    if (defined(invoker.defines)) {
      defines = invoker.defines
    }
    if (defined(invoker.include_dirs)) {
      include_dirs = invoker.include_dirs
    }
    if (defined(invoker.ldflags)) {
      ldflags = invoker.ldflags
    }
    if (defined(invoker.lib_dirs)) {
      lib_dirs = invoker.lib_dirs
    }
    if (defined(invoker.libs)) {
      libs = invoker.libs
    }
    if (defined(invoker.data_deps)) {
      data_deps = invoker.data_deps
    }
    if (defined(invoker.forward_dependent_configs_from)) {
      forward_dependent_configs_from = invoker.forward_dependent_configs_from
    }
    if (defined(invoker.public_deps)) {
      public_deps = invoker.public_deps
    }
    if (defined(invoker.all_dependent_configs)) {
      all_dependent_configs = invoker.all_dependent_configs
    }
    if (defined(invoker.public_configs)) {
      public_configs = invoker.public_configs
    }
    if (defined(invoker.check_includes)) {
      check_includes = invoker.check_includes
    }
    if (defined(invoker.configs)) {
      configs = invoker.configs
    }
    if (defined(invoker.data)) {
      data = invoker.data
    }
    if (defined(invoker.inputs)) {
      inputs = invoker.inputs
    }
    if (defined(invoker.public)) {
      public = invoker.public
    }
    if (defined(invoker.sources)) {
      sources = invoker.sources
    }
    if (defined(invoker.testonly)) {
      testonly = invoker.testonly
    }
  }
}