Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The previous version didn't actually build on ARM64 Windows.
- Loading branch information
Showing
7 changed files
with
180 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module( | ||
name = "blake3", | ||
version = "1.5.1.bcr.1", | ||
compatibility_level = 1, | ||
) | ||
bazel_dep(name = "rules_cc", version = "0.0.6") | ||
|
||
# Required only by `--extra_toolchains=@local_config_cc//:cc-toolchain-arm64_windows` used in CI. | ||
cc_configure = use_extension("@bazel_tools//tools/cpp:cc_configure.bzl", "cc_configure_extension", dev_dependency = True) | ||
use_repo(cc_configure, "local_config_cc") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- /dev/null | ||
+++ BUILD.bazel | ||
@@ -0,0 +1,66 @@ | ||
+load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") | ||
+ | ||
+cc_library( | ||
+ name = "blake3", | ||
+ srcs = [ | ||
+ "c/blake3.c", | ||
+ "c/blake3_dispatch.c", | ||
+ "c/blake3_portable.c", | ||
+ ] + select({ | ||
+ "@bazel_tools//src/conditions:linux_x86_64": [ | ||
+ "c/blake3_avx2_x86-64_unix.S", | ||
+ "c/blake3_avx512_x86-64_unix.S", | ||
+ "c/blake3_sse2_x86-64_unix.S", | ||
+ "c/blake3_sse41_x86-64_unix.S", | ||
+ ], | ||
+ "@bazel_tools//src/conditions:linux_aarch64": [ | ||
+ "c/blake3_neon.c", | ||
+ ], | ||
+ "@bazel_tools//src/conditions:windows_x64": [ | ||
+ "c/blake3_avx2_x86-64_windows_msvc.asm", | ||
+ "c/blake3_avx512_x86-64_windows_msvc.asm", | ||
+ "c/blake3_sse2_x86-64_windows_msvc.asm", | ||
+ "c/blake3_sse41_x86-64_windows_msvc.asm", | ||
+ ], | ||
+ "@bazel_tools//src/conditions:windows_arm64": [ | ||
+ "c/blake3_neon.c", | ||
+ ], | ||
+ "@bazel_tools//src/conditions:darwin_arm64": [ | ||
+ "c/blake3_neon.c", | ||
+ ], | ||
+ "//conditions:default": [], | ||
+ }), | ||
+ hdrs = [ | ||
+ "c/blake3.h", | ||
+ "c/blake3_impl.h", | ||
+ ], | ||
+ copts = select({ | ||
+ "@bazel_tools//src/conditions:linux_x86_64": [], | ||
+ "@bazel_tools//src/conditions:linux_aarch64": [ | ||
+ "-DBLAKE3_USE_NEON=1", | ||
+ ], | ||
+ "@bazel_tools//src/conditions:windows_x64": [], | ||
+ "@bazel_tools//src/conditions:windows_arm64": [ | ||
+ "-DBLAKE3_USE_NEON=1", | ||
+ ], | ||
+ "@bazel_tools//src/conditions:darwin_arm64": [ | ||
+ "-DBLAKE3_USE_NEON=1", | ||
+ ], | ||
+ "//conditions:default": [ | ||
+ "-DBLAKE3_NO_SSE2", | ||
+ "-DBLAKE3_NO_SSE41", | ||
+ "-DBLAKE3_NO_AVX2", | ||
+ "-DBLAKE3_NO_AVX512", | ||
+ ], | ||
+ }), | ||
+ includes = ["."], | ||
+ visibility = ["//visibility:public"], | ||
+) | ||
+ | ||
+platform( | ||
+ name = "internal_ci_only_do_not_use_windows_arm64", | ||
+ constraint_values = [ | ||
+ "@@platforms//os:windows", | ||
+ "@@platforms//cpu:arm64", | ||
+ ], | ||
+) |
46 changes: 46 additions & 0 deletions
46
modules/blake3/1.5.1.bcr.1/patches/fix_windows_arm_build_pr_389.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
commit 0816badf3ada3ec48e712dd4f4cbc2cd60828278 | ||
Author: Javier Blazquez <jblazquez@riotgames.com> | ||
Date: Sat Apr 6 17:30:49 2024 -0700 | ||
|
||
fix Windows ARM64 build and detect ARM64EC as ARM64 | ||
|
||
diff --git c/blake3_dispatch.c c/blake3_dispatch.c | ||
index af6c3da..c9abc13 100644 | ||
--- c/blake3_dispatch.c | ||
+++ c/blake3_dispatch.c | ||
@@ -4,9 +4,12 @@ | ||
|
||
#include "blake3_impl.h" | ||
|
||
-#if defined(IS_X86) | ||
#if defined(_MSC_VER) | ||
#include <Windows.h> | ||
+#endif | ||
+ | ||
+#if defined(IS_X86) | ||
+#if defined(_MSC_VER) | ||
#include <intrin.h> | ||
#elif defined(__GNUC__) | ||
#include <immintrin.h> | ||
diff --git c/blake3_impl.h c/blake3_impl.h | ||
index beab5cf..98611c3 100644 | ||
--- c/blake3_impl.h | ||
+++ c/blake3_impl.h | ||
@@ -28,7 +28,7 @@ enum blake3_flags { | ||
#define INLINE static inline __attribute__((always_inline)) | ||
#endif | ||
|
||
-#if defined(__x86_64__) || defined(_M_X64) | ||
+#if (defined(__x86_64__) || defined(_M_X64)) && !defined(_M_ARM64EC) | ||
#define IS_X86 | ||
#define IS_X86_64 | ||
#endif | ||
@@ -38,7 +38,7 @@ enum blake3_flags { | ||
#define IS_X86_32 | ||
#endif | ||
|
||
-#if defined(__aarch64__) || defined(_M_ARM64) | ||
+#if defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC) | ||
#define IS_AARCH64 | ||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- MODULE.bazel | ||
+++ MODULE.bazel | ||
@@ -0,0 +1,10 @@ | ||
+module( | ||
+ name = "blake3", | ||
+ version = "1.5.1.bcr.1", | ||
+ compatibility_level = 1, | ||
+) | ||
+bazel_dep(name = "rules_cc", version = "0.0.6") | ||
+ | ||
+# Required only by `--extra_toolchains=@local_config_cc//:cc-toolchain-arm64_windows` used in CI. | ||
+cc_configure = use_extension("@bazel_tools//tools/cpp:cc_configure.bzl", "cc_configure_extension", dev_dependency = True) | ||
+use_repo(cc_configure, "local_config_cc") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
matrix: | ||
platform: | ||
- centos7 | ||
- debian10 | ||
- fedora39 | ||
- ubuntu2004 | ||
- macos | ||
- macos_arm64 | ||
- windows | ||
bazel: | ||
- 6.x | ||
- 7.x | ||
tasks: | ||
verify_targets: | ||
name: Verify build targets | ||
platform: ${{ platform }} | ||
bazel: ${{ bazel }} | ||
build_targets: | ||
- '@blake3//:blake3' | ||
verify_targets_windows_arm: | ||
name: Verify build targets for Windows ARM | ||
platform: windows | ||
bazel: ${{ bazel }} | ||
build_targets: | ||
- '@blake3//:blake3' | ||
build_flags: | ||
- '--incompatible_enable_cc_toolchain_resolution' | ||
- '--platforms=@blake3//:internal_ci_only_do_not_use_windows_arm64' | ||
- '--extra_toolchains=@local_config_cc//:cc-toolchain-arm64_windows' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"url": "https://github.com/BLAKE3-team/BLAKE3/archive/refs/tags/1.5.1.tar.gz", | ||
"integrity": "sha256-gizTf3AVLlmFQz0sUMj2suyDqvEaoxvp/nFIapF0Tzc=", | ||
"strip_prefix": "BLAKE3-1.5.1", | ||
"patches": { | ||
"add_build_file.patch": "sha256-BmZOqWOTfHup68uNZXOh2mP+b971CWY3QufbkIe6eEM=", | ||
"module_dot_bazel.patch": "sha256-dKnHpXqvNwW2m7vYxnfWEoBhphBysqbeBxAMVX3b5a0=", | ||
"fix_windows_arm_build_pr_389.patch": "sha256-9G3QDBp5OuyYP7vwPKjqK+uTUZmjhLpKSE7nshz8guc=" | ||
}, | ||
"patch_strip": 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,8 @@ | |
"versions": [ | ||
"1.3.3", | ||
"1.3.3.bcr.1", | ||
"1.5.1" | ||
"1.5.1", | ||
"1.5.1.bcr.1" | ||
], | ||
"yanked_versions": {} | ||
} |