File: BUILD.gn

package info (click to toggle)
generate-ninja 0.0~git20221212.5e19d2f-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,236 kB
  • sloc: cpp: 83,746; python: 2,007; sh: 204; lisp: 129; objc: 122; makefile: 26
file content (104 lines) | stat: -rw-r--r-- 2,268 bytes parent folder | download | duplicates (7)
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
# Copyright 2019 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("//build/config/ios/deployment_target.gni")

config("compiler") {
  configs = [
    ":include_dirs",
    ":cpp_standard",
    ":objc_use_arc",
    ":objc_abi_version",
  ]
  cflags = [ "-g" ]
  swiftflags = [ "-g" ]
}

config("shared_binary") {
  if (current_os == "ios" || current_os == "mac") {
    configs = [
      ":rpath_config",
      ":swift_libdir",
    ]
  }
}

config("objc_abi_version") {
  cflags_objc = [ "-fobjc-abi-version=2" ]
  cflags_objcc = cflags_objc
  ldflags = [
    "-Xlinker",
    "-objc_abi_version",
    "-Xlinker",
    "2",
  ]
}

config("include_dirs") {
  include_dirs = [
    "//",
    root_gen_dir,
  ]
}

config("objc_use_arc") {
  cflags_objc = [
    "-fobjc-arc",
    "-fobjc-weak",
  ]
  cflags_objcc = cflags_objc
}

config("cpp_standard") {
  cflags_c = [ "--std=c11" ]
  cflags_cc = [
    "--std=c++17",
    "--stdlib=libc++",
  ]
  ldflags = [ "--stdlib=libc++" ]
}

if (current_os == "ios" || current_os == "mac") {
  config("rpath_config") {
    ldflags = [
      "-Xlinker",
      "-rpath",
      "-Xlinker",
      "@executable_path/Frameworks",
      "-Xlinker",
      "-rpath",
      "-Xlinker",
      "@loader_path/Frameworks",
    ]
  }

  _sdk_info = exec_script("//build/config/ios/scripts/sdk_info.py",
                          [
                            "--target-cpu",
                            current_cpu,
                            "--target-environment",
                            target_environment,
                            "--deployment-target",
                            ios_deployment_target,
                          ],
                          "json")

  _lib_swift_dir = "${_sdk_info.toolchain_path}/usr/lib/swift"
  if (current_os == "ios") {
    if (_sdk_info.is_simulator) {
      _system_lib_swift_dir = "$_lib_swift_dir/iphonesimulator"
    } else {
      _system_lib_swift_dir = "$_lib_swift_dir/iphoneos"
    }
  } else {
    _system_lib_swift_dir = "$_lib_swift_dir/macosx"
  }

  config("swift_libdir") {
    lib_dirs = [
      "${_sdk_info.sdk_path}/usr/lib/swift",
      _system_lib_swift_dir,
    ]
  }
}