Index: llvm/utils/gn/secondary/BUILD.gn =================================================================== --- llvm/utils/gn/secondary/BUILD.gn +++ llvm/utils/gn/secondary/BUILD.gn @@ -1,20 +1,6 @@ group("default") { deps = [ - "//clang/lib/ARCMigrate", - "//clang/lib/AST", - "//clang/lib/ASTMatchers", - "//clang/lib/CodeGen", - "//clang/lib/CrossTU", - "//clang/lib/Driver", - "//clang/lib/Frontend", - "//clang/lib/Frontend/Rewrite", - "//clang/lib/FrontendTool", - "//clang/lib/Index", - "//clang/lib/Parse", - "//clang/lib/Serialization", - "//clang/lib/StaticAnalyzer/Checkers", - "//clang/lib/StaticAnalyzer/Core", - "//clang/lib/StaticAnalyzer/Frontend", + ":clang", "//clang/tools/clang-format", "//lld/test", "//llvm/tools/llvm-undname", @@ -44,6 +30,11 @@ # update symlinks (in particular, on Windows it doesn't copy the new lld to its # new locations). # That seems simpler, more explicit, and good enough. +group("clang") { + deps = [ + "//clang/tools/driver:symlinks", + ] +} group("lld") { deps = [ "//lld/tools/lld:symlinks", Index: llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn @@ -0,0 +1,163 @@ +import("//clang/utils/TableGen/clang_tablegen.gni") +import("//llvm/version.gni") + +# Generate arm_neon.h +clang_tablegen("arm_neon") { + args = [ "-gen-arm-neon" ] + td_file = "//clang/include/clang/Basic/arm_neon.td" + output_name = "arm_neon.h" +} + +# Generate arm_fp16.h +clang_tablegen("arm_fp16") { + args = [ "-gen-arm-fp16" ] + td_file = "//clang/include/clang/Basic/arm_fp16.td" + output_name = "arm_fp16.h" +} + +output_dir = "$root_out_dir/lib/clang/$llvm_version/include" + +copy("arm_headers") { + visibility = [ ":Headers" ] + deps = [ + ":arm_fp16", + ":arm_neon", + ] + sources = get_target_outputs(":arm_neon") + get_target_outputs(":arm_fp16") + outputs = [ + "$output_dir/{{source_file_part}}", + ] +} + +copy("Headers") { + deps = [ + ":arm_headers", + ] + + # Tell `gn format` to not reorder the sources list: Its order matches CMake, + # and the ordering is alphabetical but ignores leading underscores. + # NOSORT + sources = [ + "adxintrin.h", + "altivec.h", + "ammintrin.h", + "arm_acle.h", + "armintr.h", + "arm64intr.h", + "avx2intrin.h", + "avx512bwintrin.h", + "avx512bitalgintrin.h", + "avx512vlbitalgintrin.h", + "avx512cdintrin.h", + "avx512vpopcntdqintrin.h", + "avx512dqintrin.h", + "avx512erintrin.h", + "avx512fintrin.h", + "avx512ifmaintrin.h", + "avx512ifmavlintrin.h", + "avx512pfintrin.h", + "avx512vbmiintrin.h", + "avx512vbmivlintrin.h", + "avx512vbmi2intrin.h", + "avx512vlvbmi2intrin.h", + "avx512vlbwintrin.h", + "avx512vlcdintrin.h", + "avx512vldqintrin.h", + "avx512vlintrin.h", + "avx512vpopcntdqvlintrin.h", + "avx512vnniintrin.h", + "avx512vlvnniintrin.h", + "avxintrin.h", + "bmi2intrin.h", + "bmiintrin.h", + "__clang_cuda_builtin_vars.h", + "__clang_cuda_cmath.h", + "__clang_cuda_complex_builtins.h", + "__clang_cuda_device_functions.h", + "__clang_cuda_intrinsics.h", + "__clang_cuda_libdevice_declares.h", + "__clang_cuda_math_forward_declares.h", + "__clang_cuda_runtime_wrapper.h", + "cetintrin.h", + "cldemoteintrin.h", + "clzerointrin.h", + "cpuid.h", + "clflushoptintrin.h", + "clwbintrin.h", + "emmintrin.h", + "f16cintrin.h", + "float.h", + "fma4intrin.h", + "fmaintrin.h", + "fxsrintrin.h", + "gfniintrin.h", + "htmintrin.h", + "htmxlintrin.h", + "ia32intrin.h", + "immintrin.h", + "intrin.h", + "inttypes.h", + "invpcidintrin.h", + "iso646.h", + "limits.h", + "lwpintrin.h", + "lzcntintrin.h", + "mm3dnow.h", + "mmintrin.h", + "mm_malloc.h", + "module.modulemap", + "movdirintrin.h", + "msa.h", + "mwaitxintrin.h", + "nmmintrin.h", + "opencl-c.h", + "pconfigintrin.h", + "pkuintrin.h", + "pmmintrin.h", + "popcntintrin.h", + "prfchwintrin.h", + "ptwriteintrin.h", + "rdseedintrin.h", + "rtmintrin.h", + "s390intrin.h", + "sgxintrin.h", + "shaintrin.h", + "smmintrin.h", + "stdalign.h", + "stdarg.h", + "stdatomic.h", + "stdbool.h", + "stddef.h", + "__stddef_max_align_t.h", + "stdint.h", + "stdnoreturn.h", + "tbmintrin.h", + "tgmath.h", + "tmmintrin.h", + "unwind.h", + "vadefs.h", + "vaesintrin.h", + "varargs.h", + "vecintrin.h", + "vpclmulqdqintrin.h", + "waitpkgintrin.h", + "wbnoinvdintrin.h", + "wmmintrin.h", + "__wmmintrin_aes.h", + "__wmmintrin_pclmul.h", + "x86intrin.h", + "xmmintrin.h", + "xopintrin.h", + "xsavecintrin.h", + "xsaveintrin.h", + "xsaveoptintrin.h", + "xsavesintrin.h", + "xtestintrin.h", + "cuda_wrappers/algorithm", + "cuda_wrappers/complex", + "cuda_wrappers/new", + ] + outputs = [ + "$output_dir/{{source_target_relative}}", + ] +} Index: llvm/utils/gn/secondary/clang/tools/clang-offload-bundler/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/tools/clang-offload-bundler/BUILD.gn @@ -0,0 +1,13 @@ +executable("clang-offload-bundler") { + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang/lib/Basic", + "//llvm/lib/Bitcode/Writer", + "//llvm/lib/IR", + "//llvm/lib/Object", + "//llvm/lib/Support", + ] + sources = [ + "ClangOffloadBundler.cpp", + ] +} Index: llvm/utils/gn/secondary/clang/tools/driver/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/tools/driver/BUILD.gn @@ -0,0 +1,72 @@ +import("//llvm/utils/gn/build/symlink_or_copy.gni") + +symlinks = [ + # target_name, symlink_target pairs: GN doesn't support '+' in rule names. + [ + "clangxx", + "clang++", + ], + [ + "clang-cl", + "clang-cl", + ], + [ + "clang-cpp", + "clang-cpp", + ], +] +foreach(target, symlinks) { + symlink_or_copy(target[0]) { + deps = [ + ":clang", + ] + source = "clang" + output = "$root_out_dir/bin/${target[1]}" + } +} + +# //:clang depends on this symlink target, see comment in //BUILD.gn. +group("symlinks") { + deps = [] + foreach(target, symlinks) { + deps += [ ":${target[0]}" ] + } +} + +executable("clang") { + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang/include/clang/Config", + "//clang/lib/Basic", + "//clang/lib/CodeGen", + "//clang/lib/Driver", + "//clang/lib/Frontend", + "//clang/lib/FrontendTool", + "//clang/lib/Headers", + "//clang/tools/clang-offload-bundler", + "//llvm/include/llvm/Config:llvm-config", + "//llvm/lib/Analysis", + "//llvm/lib/CodeGen", + "//llvm/lib/IR", + "//llvm/lib/MC", + "//llvm/lib/MC/MCParser", + "//llvm/lib/Option", + "//llvm/lib/Support", + "//llvm/lib/Target:TargetsToBuild", + "//llvm/lib/Transforms/IPO", + "//llvm/lib/Transforms/InstCombine", + "//llvm/lib/Transforms/Instrumentation", + "//llvm/lib/Transforms/ObjCARC", + "//llvm/lib/Transforms/Scalar", + "//llvm/lib/Transforms/Utils", + "//llvm/lib/Transforms/Vectorize", + ] + sources = [ + "cc1_main.cpp", + "cc1as_main.cpp", + "cc1gen_reproducer_main.cpp", + "driver.cpp", + ] + + # FIXME: Info.plist embedding for mac builds. +}