Skip to content

Commit

Permalink
feat: Allow bootstrap to work with linux + clang on ARM (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
phated authored Feb 9, 2023
1 parent 3ab0b3b commit 52cb06b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
8 changes: 6 additions & 2 deletions cpp/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,25 @@ cd ./srs_db
cd ..

# Pick native toolchain file.
ARCH=$(uname -m)
if [ "$OS" == "macos" ]; then
export BREW_PREFIX=$(brew --prefix)
# Ensure we have toolchain.
if [ ! "$?" -eq 0 ] || [ ! -f "$BREW_PREFIX/opt/llvm/bin/clang++" ]; 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.
Expand Down
2 changes: 1 addition & 1 deletion cpp/cmake/arch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
6 changes: 6 additions & 0 deletions cpp/cmake/toolchains/aarch64-linux-clang.cmake
Original file line number Diff line number Diff line change
@@ -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++")

0 comments on commit 52cb06b

Please sign in to comment.