File: BUILD.gn

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (212 lines) | stat: -rw-r--r-- 7,188 bytes parent folder | download | duplicates (6)
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# Copyright 2019 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//device/vr/buildflags/buildflags.gni")

declare_args() {
  # Used to determine whether or not the OpenXR loader is allowed to consider
  # paths specified by a ContentProvider on Android as valid paths to load an
  # OpenXR runtime from. It is more secure, albeit potentially not spec
  # compliant, to set this to false, but more spec compliant to set it to true.
  # When set to true, ContentProvider paths will be considered as valid paths to
  # load an OpenXR runtime from.
  # When set to false, ContentProvider paths will be ignored.
  # For more details see the "Android Active Runtime Location" section from:
  # https://registry.khronos.org/OpenXR/specs/1.0/loader.html#active-runtime-information
  allow_openxr_content_providers = false
}

if (enable_openxr) {
  source_set("openxr_headers") {
    # This visibility is done to help enforce the dependency that
    # openxr_platform.h requires platform headers to be included before it.
    # If you'd like to expand this visibility, you will need to make similar
    # DEPS rules for it as are present in the below locations.
    visibility = [
      "//chrome/browser/vr/*",
      "//chrome/test/*",
      "//components/webxr/*",
      "//device/vr/*",
    ]

    sources = [
      "dev/xr_android.h",
      "src/include/openxr/openxr.h",
      "src/include/openxr/openxr_platform.h",
      "src/include/openxr/openxr_platform_defines.h",
      "src/src/common/hex_and_handles.h",
    ]

    public_configs = [ ":config" ]
  }

  if (is_android) {
    # On Android, the loader comes with a couple more external dependencies.
    source_set("jnipp") {
      sources = [
        "src/src/external/jnipp/jnipp.cpp",
        "src/src/external/jnipp/jnipp.h",
      ]

      cflags_cc = [ "-Wno-shadow" ]

      configs += [
        # JNIPP uses exceptions to communicate failures:
        "//build/config/compiler:exceptions",
      ]
    }

    config("android-jni-wrappers-config") {
      include_dirs = [ "src/src/external/jnipp" ]
    }

    source_set("android-jni-wrappers") {
      sources = [
        "src/src/external/android-jni-wrappers/wrap/ObjectWrapperBase.h",
        "src/src/external/android-jni-wrappers/wrap/android.content.cpp",
        "src/src/external/android-jni-wrappers/wrap/android.content.h",
        "src/src/external/android-jni-wrappers/wrap/android.content.impl.h",
        "src/src/external/android-jni-wrappers/wrap/android.database.cpp",
        "src/src/external/android-jni-wrappers/wrap/android.database.h",
        "src/src/external/android-jni-wrappers/wrap/android.database.impl.h",
        "src/src/external/android-jni-wrappers/wrap/android.net.cpp",
        "src/src/external/android-jni-wrappers/wrap/android.net.h",
        "src/src/external/android-jni-wrappers/wrap/android.net.impl.h",
      ]

      # android-jni-wrappers assume jnipp headers are in the include path and
      # they also do so in the headers that are intended to be included by the
      # consumer of this target, so let's add them to public_configs to
      # propagate the include dirs to our consumers:
      public_configs = [ ":android-jni-wrappers-config" ]

      public_deps = [ ":jnipp" ]
    }
  }

  component("openxr") {
    # This visibility is done to help enforce the dependency that
    # openxr_platform.h requires platform headers to be included before it.
    # If you'd like to expand this visibility, you will need to make similar
    # DEPS rules for it as are present in the below locations.
    visibility = [
      "//chrome/browser/vr/*",
      "//chrome/test/*",
      "//components/webxr/*",
      "//device/vr/*",
    ]
    sources = [
      "dev/xr_android.h",
      "src/include/openxr/openxr.h",
      "src/include/openxr/openxr_platform.h",
      "src/include/openxr/openxr_platform_defines.h",
      "src/src/common/extra_algorithms.h",
      "src/src/common/filesystem_utils.cpp",
      "src/src/common/filesystem_utils.hpp",
      "src/src/common/hex_and_handles.h",
      "src/src/common/object_info.cpp",
      "src/src/common/object_info.h",
      "src/src/common/platform_utils.hpp",
      "src/src/common/xr_dependencies.h",
      "src/src/common/xr_linear.h",
      "src/src/loader/api_layer_interface.cpp",
      "src/src/loader/api_layer_interface.hpp",
      "src/src/loader/exception_handling.hpp",
      "src/src/loader/loader_core.cpp",
      "src/src/loader/loader_init_data.cpp",
      "src/src/loader/loader_init_data.hpp",
      "src/src/loader/loader_instance.cpp",
      "src/src/loader/loader_instance.hpp",
      "src/src/loader/loader_logger.cpp",
      "src/src/loader/loader_logger.hpp",
      "src/src/loader/loader_logger_recorders.cpp",
      "src/src/loader/loader_logger_recorders.hpp",
      "src/src/loader/loader_platform.hpp",
      "src/src/loader/manifest_file.hpp",
      "src/src/loader/runtime_interface.cpp",
      "src/src/loader/runtime_interface.hpp",
      "src/src/loader/xr_generated_loader.cpp",
      "src/src/loader/xr_generated_loader.hpp",
      "src/src/xr_generated_dispatch_table_core.c",
      "src/src/xr_generated_dispatch_table_core.h",
      "src_overrides/src/loader/manifest_file.cpp",
    ]

    if (is_component_build && is_win) {
      sources += [ "openxr.def" ]
    }

    include_dirs = [
      "src/include",
      "src/src/common",
      "src/src",
      "src/src/loader",
    ]

    deps = [ "//third_party/jsoncpp" ]

    public_configs = [ ":config" ]

    defines = [
      "OPENXR_NON_CMAKE_BUILD",
      "DISABLE_STD_FILESYSTEM",
    ]

    if (!allow_openxr_content_providers) {
      defines += [ "XRLOADER_DISABLE_CONTENT_PROVIDERS" ]
    }

    cflags_cc = [
      "-Wno-format",
      "-Wno-microsoft-cast",
      "-Wno-microsoft-include",
      "-Wno-unused-function",
      "-Wno-extra-semi",
    ]

    if (is_android) {
      sources += [
        "dev/xr_android.h",
        "src/src/loader/android_utilities.h",
        "src_overrides/src/loader/android_utilities.cpp",
      ]

      deps += [ ":android-jni-wrappers" ]

      # OpenXR loader on Android assumes that android-jni-wrappers are in the
      # include path:
      include_dirs += [ "src/src/external/android-jni-wrappers" ]

      # OpenXR loader on Android has a bug where there is unconditional try-catch block
      # (in android_utilities.cpp) even when built without exceptions support.
      configs += [ "//build/config/compiler:exceptions" ]

      libs = [
        "android",
        "log",
      ]
    }
  }

  config("config") {
    # These build define flags need to be set for openxr.h to define
    # constants related to Windows and D3D.
    if (is_win) {
      defines = [
        "XRLOADER_DISABLE_EXCEPTION_HANDLING",
        "XR_OS_WINDOWS",
        "XR_USE_PLATFORM_WIN32",
        "XR_USE_GRAPHICS_API_D3D11",
      ]
    } else {
      defines = [
        "XRLOADER_DISABLE_EXCEPTION_HANDLING",
        "XR_KHR_LOADER_INIT_SUPPORT",
        "XR_OS_ANDROID",
        "XR_USE_PLATFORM_ANDROID",
        "XR_USE_GRAPHICS_API_OPENGL_ES",
      ]
    }
  }
}