Skip to content

Commit

Permalink
platform: add support for Windows (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
jayconrod authored Sep 28, 2023
1 parent 7bc092a commit c35ceb7
Show file tree
Hide file tree
Showing 3 changed files with 1,540 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ build:remote_macos_x64 --apple_crosstool_top=@local_config_apple_cc//:toolchain
build:remote_macos_x64 --crosstool_top=@local_config_apple_cc//:toolchain
build:remote_macos_x64 --host_crosstool_top=@local_config_apple_cc//:toolchain

build:remote_windows_x64 --host_platform=//platform/windows_x64
build:remote_windows_x64 --platforms=//platform/windows_x64
build:remote_windows_x64 --host_crosstool_top=//platform/windows_x64:toolchain
build:remote_windows_x64 --crosstool_top=//platform/windows_x64:toolchain
build:remote_windows_x64 --host_cpu=x64_windows
build:remote_windows_x64 --cpu=x64_windows
build:remote_windows_x64 --host_compiler=msvc
build:remote_windows_x64 --compiler=msvc
build:remote_windows_x64 --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
build:remote_windows_x64 --extra_execution_platforms=//platform/windows_x64
build:remote_windows_x64 --extra_toolchains=//platform/windows_x64:cc-toolchain

# Options for private EngFlow clusters.
# To use on your own cluster, change the URLs to your own endpoint.
build:opal --config=engflow_common
Expand Down
106 changes: 106 additions & 0 deletions platform/windows_x64/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
load(":windows_cc_toolchain_config.bzl", "cc_toolchain_config")
load("@rules_cc//cc:defs.bzl", "cc_toolchain", "cc_toolchain_suite")

package(default_visibility = ["//visibility:public"])

platform(
name = "windows_x64",
constraint_values = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
"@bazel_tools//tools/cpp:msvc",
"@io_bazel_rules_go//go/toolchain:cgo_off",
"@io_bazel_rules_dotnet//dotnet/toolchain:6.0.101",
],
exec_properties = {
"container-image": "docker://645088952840.dkr.ecr.eu-west-1.amazonaws.com/engflow-re/windows-x64:engflow_worker@sha256:bb3d3e9d908f1cfcefdf74b553f210eab5c4f46b8812aa91b6d971c016f23cfa",
"Pool": "windows",
},
)

toolchain(
name = "cc-toolchain",
exec_compatible_with = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
"@bazel_tools//tools/cpp:msvc",
],
target_compatible_with = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
"@bazel_tools//tools/cpp:msvc",
],
toolchain = ":msvc_cc_toolchain",
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)

cc_toolchain_suite(
name = "toolchain",
toolchains = {
"x64_windows|msvc": ":msvc_cc_toolchain",
"x64_windows": ":msvc_cc_toolchain",
},
)

cc_toolchain(
name = "msvc_cc_toolchain",
all_files = ":empty",
ar_files = ":empty",
as_files = ":empty",
compiler_files = ":empty",
dwp_files = ":empty",
linker_files = ":empty",
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 1,
toolchain_config = ":msvc_cc_toolchain_config",
toolchain_identifier = "msvc-cl",
)

cc_toolchain_config(
name = "msvc_cc_toolchain_config",
abi_libc_version = "local",
abi_version = "local",
archiver_flags = ["/MACHINE:X64"],
compiler = "msvc-cl",
cpu = "x64_windows",
cxx_builtin_include_directories = [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\include",
"C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\ucrt",
"C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\shared",
"C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\um",
"C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\winrt",
"C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\cppwinrt",
],
dbg_mode_debug_flag = "/DEBUG:FULL",
default_link_flags = ["/MACHINE:X64"],
fastbuild_mode_debug_flag = "/DEBUG:FASTLINK",
host_system_name = "local",
msvc_cl_path = "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/cl.exe",
msvc_env_include = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\include;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\ucrt;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\shared;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\um;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\winrt;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\cppwinrt",
msvc_env_lib = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\lib\\x64;C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.19041.0\\ucrt\\x64;C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.19041.0\\um\\x64",
msvc_env_path = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX64\\x64;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\Common7\\IDE\\VC\\VCPackages;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Current\\bin\\Roslyn;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\Common7\\Tools\\devinit;C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.19041.0\\x64;C:\\Program Files (x86)\\Windows Kits\\10\\bin\\x64;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\\\MSBuild\\Current\\Bin;C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\Common7\\IDE\\;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\Common7\\Tools\\;;C:\\Windows\\system32;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake\\bin;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\Ninja",
msvc_env_tmp = "C:\\Windows\\TEMP",
msvc_lib_path = "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/lib.exe",
msvc_link_path = "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/link.exe",
msvc_ml_path = "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/ml64.exe",
target_libc = "msvcrt",
target_system_name = "local",
tool_paths = {
"ar": "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/lib.exe",
"ml": "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/ml64.exe",
"cpp": "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/cl.exe",
"gcc": "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/cl.exe",
"gcov": "wrapper/bin/msvc_nop.bat",
"ld": "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/link.exe",
"nm": "wrapper/bin/msvc_nop.bat",
"objcopy": "wrapper/bin/msvc_nop.bat",
"objdump": "wrapper/bin/msvc_nop.bat",
"strip": "wrapper/bin/msvc_nop.bat",
},
toolchain_identifier = "msvc-cl",
)

filegroup(
name = "empty",
)
Loading

0 comments on commit c35ceb7

Please sign in to comment.