-
Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathSwiftSetIfArchBitness.cmake
37 lines (35 loc) · 1.29 KB
/
SwiftSetIfArchBitness.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function(set_if_arch_bitness var_name)
cmake_parse_arguments(
SIA # prefix
"" # options
"ARCH;CASE_32_BIT;CASE_64_BIT" # single-value args
"" # multi-value args
${ARGN})
if("${SIA_ARCH}" STREQUAL "i386" OR
"${SIA_ARCH}" STREQUAL "i686" OR
"${SIA_ARCH}" STREQUAL "x86" OR
"${SIA_ARCH}" STREQUAL "armv5" OR
"${SIA_ARCH}" STREQUAL "armv6" OR
"${SIA_ARCH}" STREQUAL "armv7" OR
"${SIA_ARCH}" STREQUAL "armv7k" OR
"${SIA_ARCH}" STREQUAL "arm64_32" OR
"${SIA_ARCH}" STREQUAL "armv7m" OR
"${SIA_ARCH}" STREQUAL "armv7em" OR
"${SIA_ARCH}" STREQUAL "armv7s" OR
"${SIA_ARCH}" STREQUAL "wasm32" OR
"${SIA_ARCH}" STREQUAL "powerpc")
set("${var_name}" "${SIA_CASE_32_BIT}" PARENT_SCOPE)
elseif("${SIA_ARCH}" STREQUAL "x86_64" OR
"${SIA_ARCH}" STREQUAL "amd64" OR
"${SIA_ARCH}" STREQUAL "arm64" OR
"${SIA_ARCH}" STREQUAL "arm64e" OR
"${SIA_ARCH}" STREQUAL "aarch64" OR
"${SIA_ARCH}" STREQUAL "powerpc64" OR
"${SIA_ARCH}" STREQUAL "powerpc64le" OR
"${SIA_ARCH}" STREQUAL "s390x" OR
"${SIA_ARCH}" STREQUAL "riscv64")
set("${var_name}" "${SIA_CASE_64_BIT}" PARENT_SCOPE)
else()
message(FATAL_ERROR "Unknown architecture: ${SIA_ARCH}")
endif()
endfunction()