[PATCH] D55981: [gn build] Add build files for clang, clang-offload-bundler, and clang/lib/Headers
thakis created this revision. thakis added a reviewer: phosek. Herald added a subscriber: jfb. thakis added a parent revision: D55980: [gn build] Add build file for clang/lib/FrontendTool. With this, the GN build can build clang! https://reviews.llvm.org/D55981 Files: llvm/utils/gn/secondary/BUILD.gn llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn llvm/utils/gn/secondary/clang/tools/clang-offload-bundler/BUILD.gn llvm/utils/gn/secondary/clang/tools/driver/BUILD.gn 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. +} 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/lib/Headers/BUILD.gn === --- /dev/null +++ llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn @@ -0,0 +1,161 @@ +import("//clang/utils/TableGen/clang_tablegen.gni") +import("//llvm/version.gni") + +output_dir = "$root_out_dir/lib/clang/$llvm_version/include" + +files = [ + "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", + "p
[PATCH] D55981: [gn build] Add build files for clang, clang-offload-bundler, and clang/lib/Headers
phosek added inline comments. Comment at: llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn:6 + +files = [ + "adxintrin.h", Why not just inline this? This variable doesn't seem to be used from anywhere else? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55981/new/ https://reviews.llvm.org/D55981 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D55981: [gn build] Add build files for clang, clang-offload-bundler, and clang/lib/Headers
thakis marked 2 inline comments as done. thakis added inline comments. Comment at: llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn:6 + +files = [ + "adxintrin.h", phosek wrote: > Why not just inline this? This variable doesn't seem to be used from anywhere > else? Good question. No good reason, done. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55981/new/ https://reviews.llvm.org/D55981 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D55981: [gn build] Add build files for clang, clang-offload-bundler, and clang/lib/Headers
thakis updated this revision to Diff 179404. thakis marked an inline comment as done. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55981/new/ https://reviews.llvm.org/D55981 Files: llvm/utils/gn/secondary/BUILD.gn llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn llvm/utils/gn/secondary/clang/tools/clang-offload-bundler/BUILD.gn llvm/utils/gn/secondary/clang/tools/driver/BUILD.gn 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. +} 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/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_fu
[PATCH] D55981: [gn build] Add build files for clang, clang-offload-bundler, and clang/lib/Headers
phosek accepted this revision. phosek added a comment. This revision is now accepted and ready to land. LGTM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55981/new/ https://reviews.llvm.org/D55981 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D55981: [gn build] Add build files for clang, clang-offload-bundler, and clang/lib/Headers
This revision was automatically updated to reflect the committed changes. Closed by commit rL349991: [gn build] Add build files for clang, clang-offload-bundler, and… (authored by nico, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D55981?vs=179404&id=179407#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55981/new/ https://reviews.llvm.org/D55981 Files: llvm/trunk/utils/gn/secondary/BUILD.gn llvm/trunk/utils/gn/secondary/clang/lib/Headers/BUILD.gn llvm/trunk/utils/gn/secondary/clang/tools/clang-offload-bundler/BUILD.gn llvm/trunk/utils/gn/secondary/clang/tools/driver/BUILD.gn Index: llvm/trunk/utils/gn/secondary/clang/lib/Headers/BUILD.gn === --- llvm/trunk/utils/gn/secondary/clang/lib/Headers/BUILD.gn +++ llvm/trunk/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/trunk/utils/gn/secondary/clang/tools/clang-offload-bundler/BUILD.gn === --- llvm/trunk/utils/gn/secondary/clang/tools/clang-offload-bu