diff --git a/cpp/bootstrap.sh b/cpp/bootstrap.sh index 42cf25f6fc..83020fc2c7 100755 --- a/cpp/bootstrap.sh +++ b/cpp/bootstrap.sh @@ -32,6 +32,7 @@ cd ./srs_db cd .. # Pick native toolchain file. +ARCH=$(uname -m) if [ "$OS" == "macos" ]; then export BREW_PREFIX=$(brew --prefix) # Ensure we have toolchain. @@ -39,14 +40,17 @@ if [ "$OS" == "macos" ]; then echo "Default clang not sufficient. Install homebrew, and then: brew install llvm libomp clang-format" exit 1 fi - ARCH=$(uname -m) if [ "$ARCH" = "arm64" ]; then TOOLCHAIN=arm-apple-clang else TOOLCHAIN=x86_64-apple-clang fi else - TOOLCHAIN=x86_64-linux-clang + if [ "$ARCH" = "aarch64" ]; then + TOOLCHAIN=aarch64-linux-clang + else + TOOLCHAIN=x86_64-linux-clang + fi fi # Build native. diff --git a/cpp/cmake/arch.cmake b/cpp/cmake/arch.cmake index 8850cbc346..1812e8eb3e 100644 --- a/cpp/cmake/arch.cmake +++ b/cpp/cmake/arch.cmake @@ -5,6 +5,6 @@ if(WASM) add_compile_options(-fno-exceptions -fno-slp-vectorize) endif() -if(NOT WASM AND NOT APPLE) +if(NOT WASM AND NOT APPLE AND NOT ARM) add_compile_options(-march=skylake) endif() diff --git a/cpp/cmake/toolchains/aarch64-linux-clang.cmake b/cpp/cmake/toolchains/aarch64-linux-clang.cmake new file mode 100644 index 0000000000..e876c0c038 --- /dev/null +++ b/cpp/cmake/toolchains/aarch64-linux-clang.cmake @@ -0,0 +1,6 @@ +set(ARM ON) +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR aarch64) + +set(CMAKE_C_COMPILER "clang") +set(CMAKE_CXX_COMPILER "clang++")