llvm.org GIT mirror llvm / 0470456
[gn build] Add build files for clang/tools/{c-arcmt-test,c-index-test} and their dependency clang/tools/libclang libclang is somewhat incomplete. It's just enough to get check-clang to pass, but that requires it to be pretty complete. The biggest thing is that it's not built as a shared library on Linux. The libclang/BUILD.gn file has a comment with details on what else is missing. Differential Revision: https://reviews.llvm.org/D56059 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350054 91177308-0d34-0410-b5e6-96231b3b80d8 Nico Weber 9 months ago
4 changed file(s) with 132 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
33 group("default") {
44 deps = [
55 ":clang",
6 "//clang/tools/c-index-test",
67 "//clang/tools/clang-diff",
78 "//clang/tools/clang-format",
89 "//clang/tools/clang-import-test",
2021 "//llvm/tools/llvm-undname",
2122 ]
2223 if (clang_enable_arcmt) {
23 deps += [ "//clang/tools/arcmt-test" ]
24 deps += [
25 "//clang/tools/arcmt-test",
26 "//clang/tools/c-arcmt-test",
27 ]
2428 }
2529 if (clang_enable_static_analyzer) {
2630 deps += [
0 executable("c-arcmt-test") {
1 configs += [ "//llvm/utils/gn/build:clang_code" ]
2 deps = [
3 "//clang/tools/libclang",
4 ]
5 sources = [
6 "c-arcmt-test.c",
7 ]
8
9 # See comment at top of clang/tools/libclang/BUILD.gn for why this isn't
10 # needed on Linux.
11 if (host_os == "mac") {
12 ldflags = [ "-Wl,-rpath,@loader_path/../lib" ]
13 }
14 }
0 executable("c-index-test") {
1 configs += [ "//llvm/utils/gn/build:clang_code" ]
2 deps = [
3 "//clang/include/clang/Config",
4 "//clang/lib/AST",
5 "//clang/lib/Basic",
6 "//clang/lib/CodeGen",
7 "//clang/lib/Frontend",
8 "//clang/lib/Index",
9 "//clang/lib/Serialization",
10 "//clang/tools/libclang",
11 "//llvm/lib/Support",
12 "//llvm/utils/gn/build/libs/xml",
13 ]
14 if (host_os != "win") {
15 cflags_c = [ "-std=gnu89" ]
16 }
17 sources = [
18 "c-index-test.c",
19 "core_main.cpp",
20 ]
21
22 # See comment at top of clang/tools/libclang/BUILD.gn for why this isn't
23 # needed on Linux.
24 if (host_os == "mac") {
25 ldflags = [ "-Wl,-rpath,@loader_path/../lib" ]
26 }
27 }
0 import("//clang/lib/ARCMigrate/enable.gni")
1 import("//llvm/version.gni")
2
3 # This build file is just enough to get check-clang to pass, it's missing
4 # several things from the CMake build:
5 # - linking in clangTidyPlugin and clangIncludeFixerPlugin from
6 # clang-tools-extra (which doesn't have any GN build files yet)
7 # - using libclang.exports
8 # - an build target copying the Python bindings
9 # - the GN linux build always builds without -fPIC (as if LLVM_ENABLE_PIC=OFF
10 # in the CMake build), so libclang is always a static library on linux
11 # - the GN build doesn't have LIBCLANG_BUILD_STATIC
12
13 libclang_target_type = "shared_library"
14 if (host_os == "linux") {
15 # Linux needs -fPIC to build shared libs but they aren't on by default.
16 # For now, make libclang a static lib there.
17 libclang_target_type = "static_library"
18 }
19
20 target(libclang_target_type, "libclang") {
21 configs += [ "//llvm/utils/gn/build:clang_code" ]
22 deps = [
23 "//clang/include/clang/Config",
24 "//clang/lib/AST",
25 "//clang/lib/Basic",
26 "//clang/lib/Frontend",
27 "//clang/lib/Headers",
28 "//clang/lib/Index",
29 "//clang/lib/Lex",
30 "//clang/lib/Sema",
31 "//clang/lib/Tooling",
32 "//llvm/include/llvm/Config:llvm-config",
33 "//llvm/lib/IR",
34 "//llvm/lib/Support",
35 "//llvm/lib/Target:TargetsToBuild",
36 ]
37 if (clang_enable_arcmt) {
38 deps += [ "//clang/lib/ARCMigrate" ]
39 }
40
41 if (host_os == "win") {
42 defines = [ "_CINDEX_LIB_" ]
43 }
44
45 sources = [
46 "ARCMigrate.cpp",
47 "BuildSystem.cpp",
48 "CIndex.cpp",
49 "CIndexCXX.cpp",
50 "CIndexCodeCompletion.cpp",
51 "CIndexDiagnostic.cpp",
52 "CIndexDiagnostic.h",
53 "CIndexHigh.cpp",
54 "CIndexInclusionStack.cpp",
55 "CIndexUSRs.cpp",
56 "CIndexer.cpp",
57 "CIndexer.h",
58 "CXComment.cpp",
59 "CXCompilationDatabase.cpp",
60 "CXCursor.cpp",
61 "CXCursor.h",
62 "CXIndexDataConsumer.cpp",
63 "CXLoadedDiagnostic.cpp",
64 "CXLoadedDiagnostic.h",
65 "CXSourceLocation.cpp",
66 "CXSourceLocation.h",
67 "CXStoredDiagnostic.cpp",
68 "CXString.cpp",
69 "CXString.h",
70 "CXTranslationUnit.h",
71 "CXType.cpp",
72 "CXType.h",
73 "Index_Internal.h",
74 "Indexing.cpp",
75 ]
76 if (host_os == "mac") {
77 ldflags = [
78 "-Wl,-compatibility_version,1",
79 "-Wl,-current_version,$llvm_version",
80 "-Wl,-install_name,@rpath/libclang.dylib",
81 ]
82 }
83 }