| 1 |
load(":cc_toolchain_config.bzl", "cc_toolchain_config") |
| 2 |
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") |
| 3 |
|
| 4 |
package(default_visibility = ["//visibility:public"]) |
| 5 |
|
| 6 |
filegroup(name = "empty") |
| 7 |
|
| 8 |
bool_flag( |
| 9 |
name = "release", |
| 10 |
build_setting_default = False, |
| 11 |
) |
| 12 |
|
| 13 |
TOOLCHAINS = { |
| 14 |
"osx-x86_64": "cc-compiler-osx-x86_64", |
| 15 |
"osx-aarch_64": "cc-compiler-osx-aarch_64", |
| 16 |
"linux-aarch_64": "cc-compiler-linux-aarch_64", |
| 17 |
"linux-ppcle_64": "cc-compiler-linux-ppcle_64", |
| 18 |
"linux-s390_64": "cc-compiler-linux-s390_64", |
| 19 |
"linux-x86_32": "cc-compiler-linux-x86_32", |
| 20 |
"linux-x86_64": "cc-compiler-linux-x86_64", |
| 21 |
"win32": "cc-compiler-windows-x86_32", |
| 22 |
"win64": "cc-compiler-windows-x86_64", |
| 23 |
"k8": "cc-compiler-k8", |
| 24 |
} |
| 25 |
|
| 26 |
cc_toolchain_suite( |
| 27 |
name = "clang_suite", |
| 28 |
toolchains = TOOLCHAINS, |
| 29 |
) |
| 30 |
|
| 31 |
[ |
| 32 |
cc_toolchain( |
| 33 |
name = toolchain, |
| 34 |
all_files = ":empty", |
| 35 |
compiler_files = ":empty", |
| 36 |
dwp_files = ":empty", |
| 37 |
dynamic_runtime_lib = ":empty", |
| 38 |
linker_files = ":empty", |
| 39 |
objcopy_files = ":empty", |
| 40 |
output_licenses = ["restricted"], |
| 41 |
static_runtime_lib = ":empty", |
| 42 |
strip_files = ":empty", |
| 43 |
toolchain_config = ":" + cpu + "-config", |
| 44 |
toolchain_identifier = toolchain, |
| 45 |
) |
| 46 |
for cpu, toolchain in TOOLCHAINS.items() |
| 47 |
] |
| 48 |
|
| 49 |
cc_toolchain_config( |
| 50 |
name = "k8-config", |
| 51 |
linker_path = "/usr/bin/ld", |
| 52 |
sysroot = "/opt/manylinux/2014/x86_64", |
| 53 |
target_cpu = "x86_64", |
| 54 |
target_full_name = "x86_64-linux-gnu", |
| 55 |
) |
| 56 |
|
| 57 |
cc_toolchain_config( |
| 58 |
name = "linux-aarch_64-config", |
| 59 |
linker_path = "/usr/bin/ld", |
| 60 |
sysroot = "/opt/manylinux/2014/aarch64", |
| 61 |
target_cpu = "aarch64", |
| 62 |
target_full_name = "aarch64-linux-gnu", |
| 63 |
) |
| 64 |
|
| 65 |
cc_toolchain_config( |
| 66 |
name = "linux-ppcle_64-config", |
| 67 |
linker_path = "/usr/bin/ld", |
| 68 |
sysroot = "/opt/manylinux/2014/ppc64le", |
| 69 |
target_cpu = "ppc64", |
| 70 |
target_full_name = "powerpc64le-linux-gnu", |
| 71 |
) |
| 72 |
|
| 73 |
cc_toolchain_config( |
| 74 |
name = "linux-s390_64-config", |
| 75 |
linker_path = "/usr/bin/ld", |
| 76 |
sysroot = "/opt/manylinux/2014/s390x", |
| 77 |
target_cpu = "systemz", |
| 78 |
target_full_name = "s390x-linux-gnu", |
| 79 |
) |
| 80 |
|
| 81 |
cc_toolchain_config( |
| 82 |
name = "linux-x86_32-config", |
| 83 |
linker_path = "/usr/bin/ld", |
| 84 |
sysroot = "/opt/manylinux/2014/i686", |
| 85 |
target_cpu = "x86_32", |
| 86 |
target_full_name = "i386-linux-gnu", |
| 87 |
) |
| 88 |
|
| 89 |
cc_toolchain_config( |
| 90 |
name = "linux-x86_64-config", |
| 91 |
linker_path = "/usr/bin/ld", |
| 92 |
sysroot = "/opt/manylinux/2014/x86_64", |
| 93 |
target_cpu = "x86_64", |
| 94 |
target_full_name = "x86_64-linux-gnu", |
| 95 |
) |
| 96 |
|
| 97 |
cc_toolchain_config( |
| 98 |
name = "osx-aarch_64-config", |
| 99 |
extra_compiler_flags = [ |
| 100 |
"-I/usr/tools/xcode_14_0/macosx/usr/include/c++/v1", |
| 101 |
"-I/usr/tools/xcode_14_0/macosx/usr/include", |
| 102 |
"-F/usr/tools/xcode_14_0/macosx/System/Library/Frameworks", |
| 103 |
"-Wno-error=nullability-completeness", |
| 104 |
"-Wno-error=availability", |
| 105 |
"-Wno-error=elaborated-enum-base", |
| 106 |
], |
| 107 |
extra_linker_flags = ["-framework CoreFoundation"], |
| 108 |
linker_path = "/usr/tools", |
| 109 |
sysroot = "/usr/tools/xcode_14_0/macosx", |
| 110 |
target_cpu = "aarch64", |
| 111 |
target_full_name = "aarch64-apple-macosx10.9", |
| 112 |
) |
| 113 |
|
| 114 |
cc_toolchain_config( |
| 115 |
name = "osx-x86_64-config", |
| 116 |
extra_compiler_flags = [ |
| 117 |
"-I/usr/tools/xcode_14_0/macosx/usr/include/c++/v1", |
| 118 |
"-I/usr/tools/xcode_14_0/macosx/usr/include", |
| 119 |
"-F/usr/tools/xcode_14_0/macosx/System/Library/Frameworks", |
| 120 |
"-Wno-error=nullability-completeness", |
| 121 |
"-Wno-error=availability", |
| 122 |
"-Wno-error=elaborated-enum-base", |
| 123 |
], |
| 124 |
extra_linker_flags = ["-framework CoreFoundation"], |
| 125 |
linker_path = "/usr/tools", |
| 126 |
sysroot = "/usr/tools/xcode_14_0/macosx", |
| 127 |
target_cpu = "x86_64", |
| 128 |
target_full_name = "x86_64-apple-macosx10.9", |
| 129 |
) |
| 130 |
|
| 131 |
cc_toolchain_config( |
| 132 |
name = "win32-config", |
| 133 |
extra_compiler_flags = [ |
| 134 |
"-isystem/usr/lib/gcc/i686-w64-mingw32/8.3-posix/include/c++", |
| 135 |
"-isystem/usr/lib/gcc/i686-w64-mingw32/8.3-posix/include/c++/i686-w64-mingw32", |
| 136 |
"-fsjlj-exceptions", |
| 137 |
], |
| 138 |
extra_include = "/usr/lib/gcc/i686-w64-mingw32", |
| 139 |
extra_linker_flags = [ |
| 140 |
"-L/usr/lib/gcc/i686-w64-mingw32/8.3-posix", |
| 141 |
"-ldbghelp", |
| 142 |
"-pthread", |
| 143 |
], |
| 144 |
linker_path = "/usr/bin/ld", |
| 145 |
sysroot = "/usr/i686-w64-mingw32", |
| 146 |
target_cpu = "x86_32", |
| 147 |
target_full_name = "i686-w64-mingw32", |
| 148 |
) |
| 149 |
|
| 150 |
cc_toolchain_config( |
| 151 |
name = "win64-config", |
| 152 |
extra_compiler_flags = [ |
| 153 |
"-isystem/usr/lib/gcc/x86_64-w64-mingw32/8.3-posix/include/c++/", |
| 154 |
"-isystem/usr/lib/gcc/x86_64-w64-mingw32/8.3-posix/include/c++/x86_64-w64-mingw32", |
| 155 |
], |
| 156 |
extra_include = "/usr/lib/gcc/x86_64-w64-mingw32/8.3-posix/include", |
| 157 |
extra_linker_flags = [ |
| 158 |
"-L/usr/lib/gcc/x86_64-w64-mingw32/8.3-posix", |
| 159 |
"-ldbghelp", |
| 160 |
], |
| 161 |
linker_path = "/usr/bin/ld", |
| 162 |
sysroot = "/usr/x86_64-w64-mingw32", |
| 163 |
target_cpu = "x86_64", |
| 164 |
target_full_name = "x86_64-w64-mingw32", |
| 165 |
) |