mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2026-10-25 15:46:41 +08:00
\`cmake/arch.cmake\` matched \`CMAKE_SYSTEM_PROCESSOR\` first and only fell through to the \`Emscripten\` branch. That works with the default Emscripten toolchain, which sets the processor to \`x86\` - a value none of the host-CPU regexes claim - but it is fragile: \`-DEMSCRIPTEN_SYSTEM_PROCESSOR=x86_64\` (or \`arm64\`) makes a WebAssembly configure select \`ARCH_AMD64\` instead, and with it the host-only paths such as Boost.Context assembly and \`-march=\` flags. Test the target name first, and correct the comment, which claimed Emscripten leaves the processor as the host's. Verified with Emscripten 6.0.5: \`ARCH_WASM\` is set both with the default processor and with \`-DEMSCRIPTEN_SYSTEM_PROCESSOR=x86_64\`, and a native configure is unchanged.
28 lines
1.3 KiB
CMake
28 lines
1.3 KiB
CMake
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
|
|
# This file runs before target.cmake, so `OS_WASM` is not set yet; recognize the toolchain by
|
|
# name instead, and do it before every processor match. `CMAKE_SYSTEM_PROCESSOR` says nothing
|
|
# about a WebAssembly target: Emscripten sets it to `x86` by default, and a user can override it
|
|
# to anything with `-DEMSCRIPTEN_SYSTEM_PROCESSOR=`, including a value that a host-CPU regex
|
|
# below would claim.
|
|
set (ARCH_WASM 1)
|
|
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|i386")
|
|
if (CMAKE_LIBRARY_ARCHITECTURE MATCHES "i386")
|
|
message (FATAL_ERROR "32bit platforms are not supported")
|
|
endif ()
|
|
set (ARCH_AMD64 1)
|
|
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*|arm64.*|ARM64.*)")
|
|
set (ARCH_AARCH64 1)
|
|
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc64le.*|ppc64le.*|PPC64LE.*)")
|
|
set (ARCH_PPC64LE 1)
|
|
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^(s390x.*|S390X.*)")
|
|
set (ARCH_S390X 1)
|
|
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "riscv64")
|
|
set (ARCH_RISCV64 1)
|
|
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64")
|
|
set (ARCH_LOONGARCH64 1)
|
|
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "e2k")
|
|
set (ARCH_E2K 1)
|
|
else ()
|
|
message (FATAL_ERROR "Platform ${CMAKE_SYSTEM_PROCESSOR} is not supported")
|
|
endif ()
|