1import("//clang/lib/ARCMigrate/enable.gni") 2import("//llvm/utils/gn/build/symbol_exports.gni") 3import("//llvm/version.gni") 4 5# This build file is just enough to get check-clang to pass, it's missing 6# several things from the CMake build: 7# - a build target copying the Python bindings 8# - the GN build doesn't have LIBCLANG_BUILD_STATIC 9 10action("linker_script_to_exports") { 11 script = "linker-script-to-export-list.py" 12 inputs = [ "libclang.map" ] 13 outputs = [ "$target_gen_dir/libclang.exports" ] 14 args = [ 15 rebase_path(inputs[0], root_build_dir), 16 rebase_path(outputs[0], root_build_dir), 17 ] 18} 19 20symbol_exports("exports") { 21 deps = [ ":linker_script_to_exports" ] 22 exports_file = "$target_gen_dir/libclang.exports" 23} 24 25shared_library("libclang") { 26 configs += [ "//llvm/utils/gn/build:clang_code" ] 27 deps = [ 28 "//clang/include/clang/Config", 29 "//clang/lib/AST", 30 "//clang/lib/Basic", 31 "//clang/lib/ExtractAPI", 32 "//clang/lib/Frontend", 33 "//clang/lib/Headers", 34 "//clang/lib/Index", 35 "//clang/lib/Lex", 36 "//clang/lib/Sema", 37 "//clang/lib/Tooling", 38 "//llvm/include/llvm/Config:llvm-config", 39 "//llvm/lib/IR", 40 "//llvm/lib/Support", 41 "//llvm/lib/Target:TargetsToBuild", 42 "//llvm/lib/TargetParser", 43 ] 44 if (current_os == "win" || current_os == "mac") { 45 deps += [ ":exports" ] 46 } else { 47 inputs = [ "libclang.map" ] 48 ldflags = 49 [ "-Wl,--version-script," + rebase_path(inputs[0], root_build_dir) ] 50 } 51 if (clang_enable_arcmt) { 52 deps += [ "//clang/lib/ARCMigrate" ] 53 } 54 55 defines = [] 56 57 if (host_os == "win") { 58 defines += [ "_CINDEX_LIB_" ] 59 } 60 61 sources = [ 62 "../../include/clang-c/Index.h", 63 "ARCMigrate.cpp", 64 "BuildSystem.cpp", 65 "CIndex.cpp", 66 "CIndexCXX.cpp", 67 "CIndexCodeCompletion.cpp", 68 "CIndexDiagnostic.cpp", 69 "CIndexDiagnostic.h", 70 "CIndexHigh.cpp", 71 "CIndexInclusionStack.cpp", 72 "CIndexUSRs.cpp", 73 "CIndexer.cpp", 74 "CIndexer.h", 75 "CXComment.cpp", 76 "CXCompilationDatabase.cpp", 77 "CXCursor.cpp", 78 "CXCursor.h", 79 "CXExtractAPI.cpp", 80 "CXIndexDataConsumer.cpp", 81 "CXLoadedDiagnostic.cpp", 82 "CXLoadedDiagnostic.h", 83 "CXSourceLocation.cpp", 84 "CXSourceLocation.h", 85 "CXStoredDiagnostic.cpp", 86 "CXString.cpp", 87 "CXString.h", 88 "CXTranslationUnit.h", 89 "CXType.cpp", 90 "CXType.h", 91 "FatalErrorHandler.cpp", 92 "Index_Internal.h", 93 "Indexing.cpp", 94 "Rewrite.cpp", 95 ] 96 if (host_os == "mac") { 97 ldflags = [ 98 "-Wl,-compatibility_version,1", 99 "-Wl,-current_version,$llvm_version", 100 101 # See llvm_setup_rpath() in CMake. 102 "-Wl,-install_name,@rpath/libclang.dylib", 103 "-Wl,-rpath,@loader_path/../lib", 104 ] 105 } 106} 107