Skip to content

Commit b097b13

Browse files
committed
[Embedded][Concurrency] Workaround for Gyb+concurrency module+embedded
1 parent 91b2aaf commit b097b13

File tree

1 file changed

+35
-29
lines changed

1 file changed

+35
-29
lines changed

cmake/modules/SwiftSetIfArchBitness.cmake

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,45 @@ function(set_if_arch_bitness var_name)
66
"" # multi-value args
77
${ARGN})
88

9-
if("${SIA_ARCH}" STREQUAL "avr")
9+
# FIXME: This is a workaround for Concurrency/CMakeLists.txt setting the GYB_SOURCES in embedded-concurrency
10+
# Need to figure out why the SIA_ARCH we get from there isn't right, and undo this workaround.
11+
# Extract first part of the SIA_ARCH (e.g., "x86_64" from "x86_64-apple-macos")
12+
string(REPLACE "-" ";" SIA_ARCH_LIST "${SIA_ARCH}")
13+
list(GET SIA_ARCH_LIST 0 SIA_ARCH_HEAD)
14+
15+
if("${SIA_ARCH_HEAD}" STREQUAL "avr")
1016
set("${var_name}" "${SIA_CASE_16_BIT}" PARENT_SCOPE)
11-
elseif("${SIA_ARCH}" STREQUAL "i386" OR
12-
"${SIA_ARCH}" STREQUAL "i686" OR
13-
"${SIA_ARCH}" STREQUAL "x86" OR
14-
"${SIA_ARCH}" STREQUAL "armv4t" OR
15-
"${SIA_ARCH}" STREQUAL "armv5" OR
16-
"${SIA_ARCH}" STREQUAL "armv6" OR
17-
"${SIA_ARCH}" STREQUAL "armv6m" OR
18-
"${SIA_ARCH}" STREQUAL "armv7" OR
19-
"${SIA_ARCH}" STREQUAL "armv7k" OR
20-
"${SIA_ARCH}" STREQUAL "arm64_32" OR
21-
"${SIA_ARCH}" STREQUAL "armv7m" OR
22-
"${SIA_ARCH}" STREQUAL "armv7em" OR
23-
"${SIA_ARCH}" STREQUAL "armv7s" OR
24-
"${SIA_ARCH}" STREQUAL "m68k" OR
25-
"${SIA_ARCH}" STREQUAL "riscv32" OR
26-
"${SIA_ARCH}" STREQUAL "wasm32" OR
27-
"${SIA_ARCH}" STREQUAL "powerpc")
17+
elseif("${SIA_ARCH_HEAD}" STREQUAL "i386" OR
18+
"${SIA_ARCH_HEAD}" STREQUAL "i686" OR
19+
"${SIA_ARCH_HEAD}" STREQUAL "x86" OR
20+
"${SIA_ARCH_HEAD}" STREQUAL "armv4t" OR
21+
"${SIA_ARCH_HEAD}" STREQUAL "armv5" OR
22+
"${SIA_ARCH_HEAD}" STREQUAL "armv6" OR
23+
"${SIA_ARCH_HEAD}" STREQUAL "armv6m" OR
24+
"${SIA_ARCH_HEAD}" STREQUAL "armv7" OR
25+
"${SIA_ARCH_HEAD}" STREQUAL "armv7k" OR
26+
"${SIA_ARCH_HEAD}" STREQUAL "arm64_32" OR
27+
"${SIA_ARCH_HEAD}" STREQUAL "armv7m" OR
28+
"${SIA_ARCH_HEAD}" STREQUAL "armv7em" OR
29+
"${SIA_ARCH_HEAD}" STREQUAL "armv7s" OR
30+
"${SIA_ARCH_HEAD}" STREQUAL "m68k" OR
31+
"${SIA_ARCH_HEAD}" STREQUAL "riscv32" OR
32+
"${SIA_ARCH_HEAD}" STREQUAL "wasm32" OR
33+
"${SIA_ARCH_HEAD}" STREQUAL "powerpc")
2834
set("${var_name}" "${SIA_CASE_32_BIT}" PARENT_SCOPE)
29-
elseif("${SIA_ARCH}" STREQUAL "x86_64" OR
30-
"${SIA_ARCH}" STREQUAL "amd64" OR
31-
"${SIA_ARCH}" STREQUAL "arm64" OR
32-
"${SIA_ARCH}" STREQUAL "arm64e" OR
33-
"${SIA_ARCH}" STREQUAL "aarch64" OR
34-
"${SIA_ARCH}" STREQUAL "powerpc64" OR
35-
"${SIA_ARCH}" STREQUAL "powerpc64le" OR
36-
"${SIA_ARCH}" STREQUAL "s390x" OR
37-
"${SIA_ARCH}" STREQUAL "riscv64" OR
38-
"${SIA_ARCH}" STREQUAL "wasm64")
35+
elseif("${SIA_ARCH_HEAD}" STREQUAL "x86_64" OR
36+
"${SIA_ARCH_HEAD}" STREQUAL "amd64" OR
37+
"${SIA_ARCH_HEAD}" STREQUAL "arm64" OR
38+
"${SIA_ARCH_HEAD}" STREQUAL "arm64e" OR
39+
"${SIA_ARCH_HEAD}" STREQUAL "aarch64" OR
40+
"${SIA_ARCH_HEAD}" STREQUAL "powerpc64" OR
41+
"${SIA_ARCH_HEAD}" STREQUAL "powerpc64le" OR
42+
"${SIA_ARCH_HEAD}" STREQUAL "s390x" OR
43+
"${SIA_ARCH_HEAD}" STREQUAL "riscv64" OR
44+
"${SIA_ARCH_HEAD}" STREQUAL "wasm64")
3945
set("${var_name}" "${SIA_CASE_64_BIT}" PARENT_SCOPE)
4046
else()
41-
message(FATAL_ERROR "Unknown architecture: ${SIA_ARCH}")
47+
message(FATAL_ERROR "Unknown architecture: ${SIA_ARCH_HEAD} (prefix of ${SIA})")
4248
endif()
4349
endfunction()
4450

0 commit comments

Comments
 (0)