[llvm] r350054 - [gn build] Add build files for clang/tools/{c-arcmt-test, c-index-test} and their dependency clang/tools/libclang
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 24 07:45:04 PST 2018
Author: nico
Date: Mon Dec 24 07:45:04 2018
New Revision: 350054
URL: http://llvm.org/viewvc/llvm-project?rev=350054&view=rev
Log:
[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
Added:
llvm/trunk/utils/gn/secondary/clang/tools/c-arcmt-test/
llvm/trunk/utils/gn/secondary/clang/tools/c-arcmt-test/BUILD.gn
llvm/trunk/utils/gn/secondary/clang/tools/c-index-test/
llvm/trunk/utils/gn/secondary/clang/tools/c-index-test/BUILD.gn
llvm/trunk/utils/gn/secondary/clang/tools/libclang/
llvm/trunk/utils/gn/secondary/clang/tools/libclang/BUILD.gn
Modified:
llvm/trunk/utils/gn/secondary/BUILD.gn
Modified: llvm/trunk/utils/gn/secondary/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/BUILD.gn?rev=350054&r1=350053&r2=350054&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/BUILD.gn (original)
+++ llvm/trunk/utils/gn/secondary/BUILD.gn Mon Dec 24 07:45:04 2018
@@ -4,6 +4,7 @@ import("//clang/lib/StaticAnalyzer/Front
group("default") {
deps = [
":clang",
+ "//clang/tools/c-index-test",
"//clang/tools/clang-diff",
"//clang/tools/clang-format",
"//clang/tools/clang-import-test",
@@ -21,7 +22,10 @@ group("default") {
"//llvm/tools/llvm-undname",
]
if (clang_enable_arcmt) {
- deps += [ "//clang/tools/arcmt-test" ]
+ deps += [
+ "//clang/tools/arcmt-test",
+ "//clang/tools/c-arcmt-test",
+ ]
}
if (clang_enable_static_analyzer) {
deps += [
Added: llvm/trunk/utils/gn/secondary/clang/tools/c-arcmt-test/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/clang/tools/c-arcmt-test/BUILD.gn?rev=350054&view=auto
==============================================================================
--- llvm/trunk/utils/gn/secondary/clang/tools/c-arcmt-test/BUILD.gn (added)
+++ llvm/trunk/utils/gn/secondary/clang/tools/c-arcmt-test/BUILD.gn Mon Dec 24 07:45:04 2018
@@ -0,0 +1,15 @@
+executable("c-arcmt-test") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang/tools/libclang",
+ ]
+ sources = [
+ "c-arcmt-test.c",
+ ]
+
+ # See comment at top of clang/tools/libclang/BUILD.gn for why this isn't
+ # needed on Linux.
+ if (host_os == "mac") {
+ ldflags = [ "-Wl,-rpath, at loader_path/../lib" ]
+ }
+}
Added: llvm/trunk/utils/gn/secondary/clang/tools/c-index-test/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/clang/tools/c-index-test/BUILD.gn?rev=350054&view=auto
==============================================================================
--- llvm/trunk/utils/gn/secondary/clang/tools/c-index-test/BUILD.gn (added)
+++ llvm/trunk/utils/gn/secondary/clang/tools/c-index-test/BUILD.gn Mon Dec 24 07:45:04 2018
@@ -0,0 +1,28 @@
+executable("c-index-test") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang/include/clang/Config",
+ "//clang/lib/AST",
+ "//clang/lib/Basic",
+ "//clang/lib/CodeGen",
+ "//clang/lib/Frontend",
+ "//clang/lib/Index",
+ "//clang/lib/Serialization",
+ "//clang/tools/libclang",
+ "//llvm/lib/Support",
+ "//llvm/utils/gn/build/libs/xml",
+ ]
+ if (host_os != "win") {
+ cflags_c = [ "-std=gnu89" ]
+ }
+ sources = [
+ "c-index-test.c",
+ "core_main.cpp",
+ ]
+
+ # See comment at top of clang/tools/libclang/BUILD.gn for why this isn't
+ # needed on Linux.
+ if (host_os == "mac") {
+ ldflags = [ "-Wl,-rpath, at loader_path/../lib" ]
+ }
+}
Added: llvm/trunk/utils/gn/secondary/clang/tools/libclang/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/clang/tools/libclang/BUILD.gn?rev=350054&view=auto
==============================================================================
--- llvm/trunk/utils/gn/secondary/clang/tools/libclang/BUILD.gn (added)
+++ llvm/trunk/utils/gn/secondary/clang/tools/libclang/BUILD.gn Mon Dec 24 07:45:04 2018
@@ -0,0 +1,84 @@
+import("//clang/lib/ARCMigrate/enable.gni")
+import("//llvm/version.gni")
+
+# This build file is just enough to get check-clang to pass, it's missing
+# several things from the CMake build:
+# - linking in clangTidyPlugin and clangIncludeFixerPlugin from
+# clang-tools-extra (which doesn't have any GN build files yet)
+# - using libclang.exports
+# - an build target copying the Python bindings
+# - the GN linux build always builds without -fPIC (as if LLVM_ENABLE_PIC=OFF
+# in the CMake build), so libclang is always a static library on linux
+# - the GN build doesn't have LIBCLANG_BUILD_STATIC
+
+libclang_target_type = "shared_library"
+if (host_os == "linux") {
+ # Linux needs -fPIC to build shared libs but they aren't on by default.
+ # For now, make libclang a static lib there.
+ libclang_target_type = "static_library"
+}
+
+target(libclang_target_type, "libclang") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang/include/clang/Config",
+ "//clang/lib/AST",
+ "//clang/lib/Basic",
+ "//clang/lib/Frontend",
+ "//clang/lib/Headers",
+ "//clang/lib/Index",
+ "//clang/lib/Lex",
+ "//clang/lib/Sema",
+ "//clang/lib/Tooling",
+ "//llvm/include/llvm/Config:llvm-config",
+ "//llvm/lib/IR",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target:TargetsToBuild",
+ ]
+ if (clang_enable_arcmt) {
+ deps += [ "//clang/lib/ARCMigrate" ]
+ }
+
+ if (host_os == "win") {
+ defines = [ "_CINDEX_LIB_" ]
+ }
+
+ sources = [
+ "ARCMigrate.cpp",
+ "BuildSystem.cpp",
+ "CIndex.cpp",
+ "CIndexCXX.cpp",
+ "CIndexCodeCompletion.cpp",
+ "CIndexDiagnostic.cpp",
+ "CIndexDiagnostic.h",
+ "CIndexHigh.cpp",
+ "CIndexInclusionStack.cpp",
+ "CIndexUSRs.cpp",
+ "CIndexer.cpp",
+ "CIndexer.h",
+ "CXComment.cpp",
+ "CXCompilationDatabase.cpp",
+ "CXCursor.cpp",
+ "CXCursor.h",
+ "CXIndexDataConsumer.cpp",
+ "CXLoadedDiagnostic.cpp",
+ "CXLoadedDiagnostic.h",
+ "CXSourceLocation.cpp",
+ "CXSourceLocation.h",
+ "CXStoredDiagnostic.cpp",
+ "CXString.cpp",
+ "CXString.h",
+ "CXTranslationUnit.h",
+ "CXType.cpp",
+ "CXType.h",
+ "Index_Internal.h",
+ "Indexing.cpp",
+ ]
+ if (host_os == "mac") {
+ ldflags = [
+ "-Wl,-compatibility_version,1",
+ "-Wl,-current_version,$llvm_version",
+ "-Wl,-install_name, at rpath/libclang.dylib",
+ ]
+ }
+}
More information about the llvm-commits
mailing list