diff --git a/.zed/settings.json b/.zed/settings.json index 955aea11..48325ec7 100644 --- a/.zed/settings.json +++ b/.zed/settings.json @@ -1,7 +1,3 @@ -// Folder-specific settings -// -// For a full list of overridable settings, and general information on folder-specific settings, -// see the documentation: https://zed.dev/docs/configuring-zed#settings-files { "languages": { "Zig": { diff --git a/examples/.bazelrc b/examples/.bazelrc index ff9d96f5..8bbc5100 100644 --- a/examples/.bazelrc +++ b/examples/.bazelrc @@ -18,6 +18,9 @@ common --experimental_remote_cache_eviction_retries=5 # Self explanatory common --enable_platform_specific_config +# Setup host platform +common --host_platform=@zml//platforms:host + # Ensure host tools are built optimized build --host_compilation_mode=opt @@ -120,3 +123,12 @@ common:release --compilation_mode=opt common:release --copt=-Ofast common:release --@rules_zig//zig/settings:mode=release_fast common:release --@rules_zig//zig/settings:copt=-fomit-frame-pointer + +build:lto --copt=-flto +build:lto --@rules_zig//zig/settings:copt=-flto +build:lto --@rules_zig//zig/settings:copt=-flld +build:lto --@rules_rust//rust/settings:lto=fat + +build:native --copt=-march=native +build:native --@rules_zig//zig/settings:copt=-mcpu=native +build:native --@rules_rust//rust/settings:extra_rustc_flag=-Ctarget-cpu=native diff --git a/platforms/BUILD.bazel b/platforms/BUILD.bazel index 57756f40..97b4c906 100644 --- a/platforms/BUILD.bazel +++ b/platforms/BUILD.bazel @@ -1,44 +1,30 @@ -alias( +load("@platforms//host:constraints.bzl", "HOST_CONSTRAINTS") + +GLIBC = "@toolchains_llvm_bootstrapped//constraints/libc:gnu.2.34" +IS_LINUX = "@platforms//os:linux" in HOST_CONSTRAINTS + +platform( name = "host", - actual = select({ - "@platforms//os:linux": ":host_linux", - "//conditions:default": ":host_other", - }), -) - -platform( - name = "host_other", parents = ["@platforms//host"], - visibility = ["//visibility:public"], -) - - -platform( - name = "host_linux", - parents = ["@platforms//host"], - constraint_values = [ - "@toolchains_llvm_bootstrapped//constraints/libc:gnu.2.31", - ], + constraint_values = [GLIBC] if IS_LINUX else [], visibility = ["//visibility:public"], ) platform( name = "linux_amd64", constraint_values = [ - "@platforms//cpu:x86_64", "@platforms//os:linux", - "@toolchains_llvm_bootstrapped//constraints/libc:gnu.2.31", - ], + "@platforms//cpu:x86_64", + ] + [GLIBC] if IS_LINUX else [], visibility = ["//visibility:public"], ) platform( name = "linux_arm64", constraint_values = [ - "@platforms//cpu:aarch64", "@platforms//os:linux", - "@toolchains_llvm_bootstrapped//constraints/libc:gnu.2.31", - ], + "@platforms//cpu:aarch64", + ] + [GLIBC] if IS_LINUX else [], visibility = ["//visibility:public"], )