brintos

brintos / llvm-project-archived public Read only

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