diff --git a/llvm/utils/gn/secondary/clang-tools-extra/clangd/BUILD.gn b/llvm/utils/gn/secondary/clang-tools-extra/clangd/BUILD.gn --- a/llvm/utils/gn/secondary/clang-tools-extra/clangd/BUILD.gn +++ b/llvm/utils/gn/secondary/clang-tools-extra/clangd/BUILD.gn @@ -1,7 +1,29 @@ +import("//clang-tools-extra/clangd/xpc/enable.gni") +import("//llvm/utils/gn/build/write_cmake_config.gni") + +config("features_config") { + # To pick up the generated inc files. + include_dirs = [ target_gen_dir ] + visibility = [ ":features" ] +} + +write_cmake_config("features") { + input = "Features.inc.in" + output = "$target_gen_dir/Features.inc" + values = [] + if (clangd_build_xpc) { + values += [ "CLANGD_BUILD_XPC=1" ] + } else { + values += [ "CLANGD_BUILD_XPC=0" ] + } + public_configs = [ ":features_config" ] +} + static_library("clangd") { output_name = "clangDaemon" configs += [ "//llvm/utils/gn/build:clang_code" ] deps = [ + ":features", "//clang-tools-extra/clang-tidy/abseil", "//clang-tools-extra/clang-tidy/android", "//clang-tools-extra/clang-tidy/boost", diff --git a/llvm/utils/gn/secondary/clang-tools-extra/clangd/tool/BUILD.gn b/llvm/utils/gn/secondary/clang-tools-extra/clangd/tool/BUILD.gn --- a/llvm/utils/gn/secondary/clang-tools-extra/clangd/tool/BUILD.gn +++ b/llvm/utils/gn/secondary/clang-tools-extra/clangd/tool/BUILD.gn @@ -1,24 +1,11 @@ import("//clang-tools-extra/clangd/xpc/enable.gni") -import("//llvm/utils/gn/build/write_cmake_config.gni") - -write_cmake_config("features") { - # FIXME: Try moving Features.inc.in to tools, seems like a better location. - input = "../Features.inc.in" - output = "$target_gen_dir/Features.inc" - values = [] - if (clangd_build_xpc) { - values += [ "CLANGD_BUILD_XPC=1" ] - } else { - values += [ "CLANGD_BUILD_XPC=0" ] - } -} executable("clangd") { configs += [ "//llvm/utils/gn/build:clang_code" ] deps = [ - ":features", "//clang-tools-extra/clang-tidy", "//clang-tools-extra/clangd", + "//clang-tools-extra/clangd:features", "//clang-tools-extra/clangd/refactor/tweaks", "//clang/lib/AST", "//clang/lib/Basic", @@ -36,12 +23,7 @@ ] } - include_dirs = [ - "..", - - # To pick up the generated inc files. - "$target_gen_dir", - ] + include_dirs = [ ".." ] sources = [ "ClangdMain.cpp", ] diff --git a/llvm/utils/gn/secondary/clang-tools-extra/unittests/clangd/BUILD.gn b/llvm/utils/gn/secondary/clang-tools-extra/unittests/clangd/BUILD.gn --- a/llvm/utils/gn/secondary/clang-tools-extra/unittests/clangd/BUILD.gn +++ b/llvm/utils/gn/secondary/clang-tools-extra/unittests/clangd/BUILD.gn @@ -5,6 +5,7 @@ deps = [ "//clang-tools-extra/clang-tidy", "//clang-tools-extra/clangd", + "//clang-tools-extra/clangd:features", "//clang-tools-extra/clangd/refactor/tweaks", "//clang/lib/AST", "//clang/lib/Basic",