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" ]
22 "//clang/include/clang/Config",
25 "//clang/lib/Frontend",
26 "//clang/lib/Headers",
30 "//clang/lib/Tooling",
31 "//llvm/include/llvm/Config:llvm-config",
34 "//llvm/lib/Target:TargetsToBuild",
36 if (clang_enable_arcmt) {
37 deps += [ "//clang/lib/ARCMigrate" ]
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.
47 defines += [ "CLANG_TOOL_EXTRA_BUILD" ]
49 "//clang-tools-extra/clang-include-fixer/plugin",
50 "//clang-tools-extra/clang-tidy/plugin",
54 if (host_os == "win") {
55 defines += [ "_CINDEX_LIB_" ]
59 "../../include/clang-c/Index.h",
64 "CIndexCodeCompletion.cpp",
65 "CIndexDiagnostic.cpp",
68 "CIndexInclusionStack.cpp",
73 "CXCompilationDatabase.cpp",
76 "CXIndexDataConsumer.cpp",
77 "CXLoadedDiagnostic.cpp",
78 "CXLoadedDiagnostic.h",
79 "CXSourceLocation.cpp",
81 "CXStoredDiagnostic.cpp",
84 "CXTranslationUnit.h",
87 "FatalErrorHandler.cpp",
91 if (host_os == "mac") {
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",
102 # FIXME: Use libclang.exports