xref: /llvm-project/llvm/utils/gn/secondary/compiler-rt/BUILD.gn (revision 998ad085e865f2e5acc589d6bee0e3379042da2e)
1import("//llvm/lib/Target/targets.gni")
2import("//llvm/utils/gn/build/mac_sdk.gni")
3import("//llvm/utils/gn/build/toolchain/compiler.gni")
4
5# In the GN build, compiler-rt is always built by just-built clang and lld.
6# FIXME: For macOS and iOS builds, depend on lib in all needed target arch
7# toolchains and then lipo them together for the final output.
8supported_toolchains = []
9if (current_os == "win" || win_sysroot != "") {
10  supported_toolchains += [ "//llvm/utils/gn/build/toolchain:stage2_win_x64" ]
11  supported_toolchains += [ "//llvm/utils/gn/build/toolchain:stage2_win_x86" ]
12}
13if (current_os != "win") {
14  supported_toolchains += [ "//llvm/utils/gn/build/toolchain:stage2_unix" ]
15}
16supported_toolchains += supported_android_toolchains
17if (llvm_build_AArch64) {
18  supported_toolchains +=
19      [ "//llvm/utils/gn/build/toolchain:stage2_baremetal_aarch64" ]
20}
21group("compiler-rt") {
22  deps = [ "//compiler-rt/include($host_toolchain)" ]
23  foreach(toolchain, supported_toolchains) {
24    deps += [ "//compiler-rt/lib($toolchain)" ]
25  }
26
27  # FIXME: Do this only if a gn arg compiler_rt_enable_ios is set?
28  # That would match the cmake build.
29  if (host_os == "mac" && have_ios_sdks) {
30    if (llvm_build_AArch64) {
31      deps += [ "//compiler-rt/lib/builtins(//llvm/utils/gn/build/toolchain:stage2_ios_aarch64)" ]
32    }
33    if (llvm_build_X86) {
34      deps += [ "//compiler-rt/lib/builtins(//llvm/utils/gn/build/toolchain:stage2_iossim_x64)" ]
35    }
36  }
37}
38