Skip to content

Commit f5339fb

Browse files
authored
Add assembly files for Windows (#3275)
Add assembly files for Windows ### Motivation: These assembly files are now required to build on Windows Arm64. ### Modifications: * The Windows assembly files are now handled in `update-cmake-lists.sh`. ### Result: The assembly source files will be properly updated in `swift-crypto`.
1 parent 15dfe08 commit f5339fb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

scripts/update-cmake-lists.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function update_cmakelists_source() {
5151
do
5252
exts_arg+=(-o -name "${src_exts[$i]}")
5353
done
54-
54+
5555
# Build an array with the rest of the arguments
5656
shift
5757
exceptions=("$@")
@@ -85,20 +85,26 @@ function update_cmakelists_assembly() {
8585

8686
mac_x86_64_asms=$($find "${src_root}" -type f \( -name "*x86_64*" -or -name "*avx2*" \) -name "*apple*" -name "*.S" -printf ' %P\n' | LC_ALL=POSIX sort)
8787
linux_x86_64_asms=$($find "${src_root}" -type f \( -name "*x86_64*" -or -name "*avx2*" \) -name "*linux*" -name "*.S" -printf ' %P\n' | LC_ALL=POSIX sort)
88+
win_x86_64_asms=$($find "${src_root}" -type f \( -name "*x86_64*" -or -name "*avx2*" \) -name "*win*" -name "*.S" -printf ' %P\n' | LC_ALL=POSIX sort)
8889
mac_aarch64_asms=$($find "${src_root}" -type f -name "*armv8*" -name "*apple*" -name "*.S" -printf ' %P\n' | LC_ALL=POSIX sort)
8990
linux_aarch64_asms=$($find "${src_root}" -type f -name "*armv8*" -name "*linux*" -name "*.S" -printf ' %P\n' | LC_ALL=POSIX sort)
91+
win_aarch64_asms=$($find "${src_root}" -type f -name "*armv8*" -name "*win*" -name "*.S" -printf ' %P\n' | LC_ALL=POSIX sort)
9092
log "$mac_x86_64_asms"
9193
log "$linux_x86_64_asms"
94+
log "$win_x86_64_asms"
9295
log "$mac_aarch64_asms"
9396
log "$linux_aarch64_asms"
94-
97+
log "$win_aarch64_asms"
98+
9599
# Update list of assembly files in CMakeLists.txt
96100
# The first part in `BEGIN` (i.e., `undef $/;`) is for working with multi-line;
97101
# the second is so that we can pass in a variable to replace with.
98102
perl -pi -e 'BEGIN { undef $/; $replace = shift } s/Darwin([^\)]+)x86_64"\)\n target_sources\(([^\n]+)\n([^\)]+)/Darwin$1x86_64"\)\n target_sources\($2\n$replace/' "$mac_x86_64_asms" "$src_root/CMakeLists.txt"
99103
perl -pi -e 'BEGIN { undef $/; $replace = shift } s/Linux([^\)]+)x86_64"\)\n target_sources\(([^\n]+)\n([^\)]+)/Linux$1x86_64"\)\n target_sources\($2\n$replace/' "$linux_x86_64_asms" "$src_root/CMakeLists.txt"
104+
perl -pi -e 'BEGIN { undef $/; $replace = shift } s/Windows([^\)]+)x86_64"\)\n target_sources\(([^\n]+)\n([^\)]+)/Windows$1x86_64"\)\n target_sources\($2\n$replace/' "$win_x86_64_asms" "$src_root/CMakeLists.txt"
100105
perl -pi -e 'BEGIN { undef $/; $replace = shift } s/Darwin([^\)]+)aarch64"\)\n target_sources\(([^\n]+)\n([^\)]+)/Darwin$1aarch64"\)\n target_sources\($2\n$replace/' "$mac_aarch64_asms" "$src_root/CMakeLists.txt"
101106
perl -pi -e 'BEGIN { undef $/; $replace = shift } s/Linux([^\)]+)aarch64"\)\n target_sources\(([^\n]+)\n([^\)]+)/Linux$1aarch64"\)\n target_sources\($2\n$replace/' "$linux_aarch64_asms" "$src_root/CMakeLists.txt"
107+
perl -pi -e 'BEGIN { undef $/; $replace = shift } s/Windows([^\)]+)aarch64"\)\n target_sources\(([^\n]+)\n([^\)]+)/Windows$1aarch64"\)\n target_sources\($2\n$replace/' "$win_aarch64_asms" "$src_root/CMakeLists.txt"
102108
log "Updated $src_root/CMakeLists.txt"
103109
}
104110

@@ -107,7 +113,7 @@ echo "$config" | jq -c '.targets[]' | while read -r target; do
107113
type="$(echo "$target" | jq -r .type)"
108114
exceptions=("$(echo "$target" | jq -r .exceptions | jq -r @sh)")
109115
log "Updating cmake list for ${name}"
110-
116+
111117
case "$type" in
112118
source)
113119
update_cmakelists_source "$name" "${exceptions[@]}"

0 commit comments

Comments
 (0)