Adding windows toolchains
This commit is contained in:
parent
8608ee97da
commit
73c57034aa
@ -12,6 +12,8 @@ TOOLCHAINS = {
|
||||
"linux-s390_64": "cc-compiler-linux-s390_64",
|
||||
"linux-x86_32": "cc-compiler-linux-x86_32",
|
||||
"linux-x86_64": "cc-compiler-linux-x86_64",
|
||||
"win32": "cc-compiler-windows-x86_32",
|
||||
"win64": "cc-compiler-windows-x86_64",
|
||||
}
|
||||
|
||||
cc_toolchain_suite(
|
||||
@ -135,3 +137,39 @@ cc_toolchain_config(
|
||||
toolchain_dir = "/usr/tools/apple_sdks/xcode_13_0/macosx",
|
||||
toolchain_name = "darwin_x86_64",
|
||||
)
|
||||
|
||||
cc_toolchain_config(
|
||||
name = "win32-config",
|
||||
bit_flag = "-m32",
|
||||
cpp_flag = "-lstdc++",
|
||||
extra_include = "/usr/lib/gcc/i686-w64-mingw32/10-posix/include",
|
||||
extra_linker_flag = "-L/usr/lib/gcc/i686-w64-mingw32/10-posix",
|
||||
include_flag = [
|
||||
"-I/usr/lib/gcc/i686-w64-mingw32/10-posix/include/c++",
|
||||
"-I/usr/lib/gcc/i686-w64-mingw32/10-posix/include/c++/i686-w64-mingw32",
|
||||
"-I/usr/i686-w64-mingw32/include"
|
||||
],
|
||||
linker_path = "/usr/bin/ld",
|
||||
target_cpu = "x86_32",
|
||||
target_full_name = "i686-w64-mingw32",
|
||||
toolchain_dir = "/usr/i686-w64-mingw32/include",
|
||||
toolchain_name = "i686-w64-mingw32",
|
||||
)
|
||||
|
||||
cc_toolchain_config(
|
||||
name = "win64-config",
|
||||
bit_flag = "-m64",
|
||||
cpp_flag = "-lstdc++",
|
||||
extra_include = "/usr/lib/gcc/x86_64-w64-mingw32/10-posix/include",
|
||||
extra_linker_flag = "-L/usr/lib/gcc/x86_64-w64-mingw32/10-posix",
|
||||
include_flag = [
|
||||
"-I/usr/lib/gcc/x86_64-w64-mingw32/10-posix/include/c++/",
|
||||
"-I/usr/lib/gcc/x86_64-w64-mingw32/10-posix/include/c++/x86_64-w64-mingw32",
|
||||
"-I/usr/x86_64-w64-mingw32/include"
|
||||
],
|
||||
linker_path = "/usr/bin/ld",
|
||||
target_cpu = "x86_64",
|
||||
target_full_name = "x86_64-w64-mingw32",
|
||||
toolchain_dir = "/usr/x86_64-w64-mingw32/include",
|
||||
toolchain_name = "x86_64-w64-mingw32",
|
||||
)
|
||||
|
@ -86,6 +86,7 @@ def _impl(ctx):
|
||||
"-B" + ctx.attr.linker_path,
|
||||
ctx.attr.cpp_flag,
|
||||
"--target=" + ctx.attr.target_full_name,
|
||||
ctx.attr.extra_linker_flag,
|
||||
],
|
||||
),
|
||||
],
|
||||
@ -142,6 +143,7 @@ def _impl(ctx):
|
||||
compiler = "clang",
|
||||
cxx_builtin_include_directories = [
|
||||
ctx.attr.toolchain_dir,
|
||||
ctx.attr.extra_include,
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"/usr/local/lib/clang",
|
||||
@ -161,6 +163,8 @@ cc_toolchain_config = rule(
|
||||
"abi_version": attr.string(default = "local"),
|
||||
"bit_flag": attr.string(mandatory = True, values = ["-m32", "-m64"]),
|
||||
"cpp_flag": attr.string(mandatory = True),
|
||||
"extra_include": attr.string(mandatory = False),
|
||||
"extra_linker_flag": attr.string(mandatory = False),
|
||||
"include_flag": attr.string_list(),
|
||||
"linker_path": attr.string(mandatory = True),
|
||||
"sysroot": attr.string(mandatory = False),
|
||||
|
@ -8,3 +8,5 @@ build:linux-x86_32 --config=cross_config --cpu=linux-x86_32
|
||||
build:linux-x86_64 --config=cross_config --cpu=linux-x86_64
|
||||
build:osx-aarch_64 --config=cross_config --cpu=darwin-aarch_64
|
||||
build:osx-x86_64 --config=cross_config --cpu=darwin-x86_64
|
||||
build:win32 --config=cross_config --cpu=win32
|
||||
build:win64 --config=cross_config --cpu=win64
|
||||
|
Loading…
Reference in New Issue
Block a user