diff options
author | Mathias Preiner <mathias.preiner@gmail.com> | 2021-03-02 00:26:29 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-02 08:26:29 +0000 |
commit | 0d5ab1705324e91d9788185cd16e1d4e6bf54fbe (patch) | |
tree | 3480e9df08b5a6d250a1e19d96fc7142702eb018 /configure.sh | |
parent | 968ba63bab1709096f09efcdf84651c8c1481110 (diff) |
Add aarch64 (ARM64) cross-compile support. (#6033)
This commit adds support for cross-compiling for aarch64 platforms and simplifies cross-compilation handling for Windows. The configure script now automatically downloads and cross-compiles the required dependencies ANTLR3 and GMP when passing option --arm64 or --win64.
Fixes #1479 #5769.
Diffstat (limited to 'configure.sh')
-rwxr-xr-x | configure.sh | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/configure.sh b/configure.sh index 1e036e548..e7a858486 100755 --- a/configure.sh +++ b/configure.sh @@ -22,6 +22,7 @@ General options; --name=STR use custom build directory name (optionally: +path) --best turn on dependencies known to give best performance --gpl permit GPL dependencies, if available + --arm64 cross-compile for Linux ARM 64 bit --win64 cross-compile for Windows 64 bit --ninja use Ninja build system @@ -151,6 +152,7 @@ ubsan=default unit_testing=default valgrind=default win64=default +arm64=default werror=default abc_dir=default @@ -244,7 +246,8 @@ do --no-kissat) kissat=OFF;; --win64) win64=ON;; - --no-win64) win64=OFF;; + + --arm64) arm64=ON;; --ninja) ninja=ON;; @@ -358,6 +361,20 @@ do done #--------------------------------------------------------------------------# +# Automatically set up dependencies based on configure options +#--------------------------------------------------------------------------# + +if [ "$arm64" == "ON" ]; then + echo "Setting up dependencies for ARM 64-bit build" + HOST="aarch64-linux-gnu" contrib/get-antlr-3.4 || exit 1 + HOST="aarch64-linux-gnu" contrib/get-gmp-dev || exit 1 +elif [ "$win64" == "ON" ]; then + echo "Setting up dependencies for Windows 64-bit build" + HOST="x86_64-w64-mingw32" contrib/get-antlr-3.4 || exit 1 + HOST="x86_64-w64-mingw32" contrib/get-gmp-dev || exit 1 +fi + +#--------------------------------------------------------------------------# if [ $werror != default ]; then export CFLAGS=-Werror @@ -393,6 +410,8 @@ cmake_opts="" && cmake_opts="$cmake_opts -DENABLE_GPL=$gpl" [ $win64 != default ] \ && cmake_opts="$cmake_opts -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw64.cmake" +[ $arm64 != default ] \ + && cmake_opts="$cmake_opts -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-aarch64.cmake" [ $ninja != default ] && cmake_opts="$cmake_opts -G Ninja" [ $muzzle != default ] \ && cmake_opts="$cmake_opts -DENABLE_MUZZLE=$muzzle" @@ -478,6 +497,7 @@ root_dir=$(pwd) # The cmake toolchain can't be changed once it is configured in $build_dir. # Thus, remove $build_dir and create an empty directory. [ $win64 = ON ] && [ -e "$build_dir" ] && rm -r "$build_dir" +[ $arm64 = ON ] && [ -e "$build_dir" ] && rm -r "$build_dir" mkdir -p "$build_dir" cd "$build_dir" |