[lit] Improve lit.Run class
[llvm-complete.git] / utils / gn / secondary / clang / tools / driver / BUILD.gn
blobd65682e604ae94fc1dd526c60b5ab005c5cdf37f
1 import("//llvm/utils/gn/build/symlink_or_copy.gni")
2 import("//llvm/utils/gn/build/write_cmake_config.gni")
3 import("//llvm/version.gni")
5 symlinks = [
6   # target_name, symlink_target pairs: GN doesn't support '+' in rule names.
7   [
8     "clangxx",
9     "clang++",
10   ],
11   [
12     "clang-cl",
13     "clang-cl",
14   ],
15   [
16     "clang-cpp",
17     "clang-cpp",
18   ],
20 foreach(target, symlinks) {
21   symlink_or_copy(target[0]) {
22     deps = [
23       ":clang",
24     ]
25     source = "clang"
26     output = "$root_out_dir/bin/${target[1]}"
27   }
30 # //:clang depends on this symlink target, see comment in //BUILD.gn.
31 group("symlinks") {
32   deps = []
33   foreach(target, symlinks) {
34     deps += [ ":${target[0]}" ]
35   }
38 if (host_os == "mac") {
39   write_cmake_config("write_info_plist") {
40     input = "Info.plist.in"
41     output = "$target_gen_dir/Info.plist"
42     values = [
43       "TOOL_INFO_BUILD_VERSION=$llvm_version_major.$llvm_version_minor",
44       "TOOL_INFO_NAME=clang",
45       "TOOL_INFO_UTI=org.llvm.clang",
46       "TOOL_INFO_VERSION=$llvm_version",
47     ]
48   }
51 executable("clang") {
52   configs += [ "//llvm/utils/gn/build:clang_code" ]
53   deps = [
54     "//clang/include/clang/Config",
55     "//clang/lib/Basic",
56     "//clang/lib/CodeGen",
57     "//clang/lib/Driver",
58     "//clang/lib/Frontend",
59     "//clang/lib/FrontendTool",
60     "//clang/lib/Headers",
61     "//clang/tools/clang-offload-bundler",
62     "//clang/tools/clang-offload-wrapper",
63     "//llvm/include/llvm/Config:llvm-config",
64     "//llvm/lib/Analysis",
65     "//llvm/lib/CodeGen",
66     "//llvm/lib/IR",
67     "//llvm/lib/MC",
68     "//llvm/lib/MC/MCParser",
69     "//llvm/lib/Option",
70     "//llvm/lib/Support",
71     "//llvm/lib/Target:TargetsToBuild",
72     "//llvm/lib/Transforms/IPO",
73     "//llvm/lib/Transforms/InstCombine",
74     "//llvm/lib/Transforms/Instrumentation",
75     "//llvm/lib/Transforms/ObjCARC",
76     "//llvm/lib/Transforms/Scalar",
77     "//llvm/lib/Transforms/Utils",
78     "//llvm/lib/Transforms/Vectorize",
79   ]
80   if (host_os == "mac") {
81     deps += [ ":write_info_plist" ]
82     plist = get_target_outputs(":write_info_plist")
83     ldflags = [ "-Wl,-sectcreate,__TEXT,__info_plist," +
84                 rebase_path(plist[0], root_out_dir) ]
85   }
86   sources = [
87     "cc1_main.cpp",
88     "cc1as_main.cpp",
89     "cc1gen_reproducer_main.cpp",
90     "driver.cpp",
91   ]