[InstCombine] Signed saturation patterns
[llvm-complete.git] / utils / gn / secondary / clang / tools / libclang / BUILD.gn
bloba41a34cb9ef97ae583a685442c18cadfa7b19d32
1 import("//clang/lib/ARCMigrate/enable.gni")
2 import("//llvm/version.gni")
4 # This build file is just enough to get check-clang to pass, it's missing
5 # several things from the CMake build:
6 # - using libclang.exports
7 # - a build target copying the Python bindings
8 # - the GN linux build always builds without -fPIC (as if LLVM_ENABLE_PIC=OFF
9 #   in the CMake build), so libclang is always a static library on linux
10 # - the GN build doesn't have LIBCLANG_BUILD_STATIC
12 libclang_target_type = "shared_library"
13 if (host_os != "win" && host_os != "mac") {
14   # ELF targets need -fPIC to build shared libs but they aren't on by default.
15   # For now, make libclang a static lib there.
16   libclang_target_type = "static_library"
19 target(libclang_target_type, "libclang") {
20   configs += [ "//llvm/utils/gn/build:clang_code" ]
21   deps = [
22     "//clang/include/clang/Config",
23     "//clang/lib/AST",
24     "//clang/lib/Basic",
25     "//clang/lib/Frontend",
26     "//clang/lib/Headers",
27     "//clang/lib/Index",
28     "//clang/lib/Lex",
29     "//clang/lib/Sema",
30     "//clang/lib/Tooling",
31     "//llvm/include/llvm/Config:llvm-config",
32     "//llvm/lib/IR",
33     "//llvm/lib/Support",
34     "//llvm/lib/Target:TargetsToBuild",
35   ]
36   if (clang_enable_arcmt) {
37     deps += [ "//clang/lib/ARCMigrate" ]
38   }
40   defines = []
42   # FIXME: Once the GN build has a way to select which bits to build,
43   # only include this dependency if clang-tools-extra is part of the build.
44   # FIXME: libclang depending on anything in clang-tools-extra seems like
45   # a layering violation.
46   if (true) {
47     defines += [ "CLANG_TOOL_EXTRA_BUILD" ]
48     deps += [
49       "//clang-tools-extra/clang-include-fixer/plugin",
50       "//clang-tools-extra/clang-tidy/plugin",
51     ]
52   }
54   if (host_os == "win") {
55     defines += [ "_CINDEX_LIB_" ]
56   }
58   sources = [
59     "../../include/clang-c/Index.h",
60     "ARCMigrate.cpp",
61     "BuildSystem.cpp",
62     "CIndex.cpp",
63     "CIndexCXX.cpp",
64     "CIndexCodeCompletion.cpp",
65     "CIndexDiagnostic.cpp",
66     "CIndexDiagnostic.h",
67     "CIndexHigh.cpp",
68     "CIndexInclusionStack.cpp",
69     "CIndexUSRs.cpp",
70     "CIndexer.cpp",
71     "CIndexer.h",
72     "CXComment.cpp",
73     "CXCompilationDatabase.cpp",
74     "CXCursor.cpp",
75     "CXCursor.h",
76     "CXIndexDataConsumer.cpp",
77     "CXLoadedDiagnostic.cpp",
78     "CXLoadedDiagnostic.h",
79     "CXSourceLocation.cpp",
80     "CXSourceLocation.h",
81     "CXStoredDiagnostic.cpp",
82     "CXString.cpp",
83     "CXString.h",
84     "CXTranslationUnit.h",
85     "CXType.cpp",
86     "CXType.h",
87     "FatalErrorHandler.cpp",
88     "Index_Internal.h",
89     "Indexing.cpp",
90   ]
91   if (host_os == "mac") {
92     ldflags = [
93       "-Wl,-compatibility_version,1",
94       "-Wl,-current_version,$llvm_version",
96       # See llvm_setup_rpath() in CMake.
97       "-Wl,-install_name,@rpath/libclang.dylib",
98       "-Wl,-rpath,@loader_path/../lib",
99     ]
100   }
102   # FIXME: Use libclang.exports