mirror of
https://github.com/ARMSX2/ARMSX3.git
synced 2026-08-24 16:58:52 -07:00
Splits the Android release into legacy / a11 / a13 / a15 so a device can take a build matched to its CPU and OS instead of one binary suiting everything. android/build-variants.sh drives all four from a single table of (ndk, api, -march, apk suffix), and ConfigureCompiler.cmake takes -march per variant rather than hardcoding one. The legacy variant had never been compiled before: every release up to 0.7.2 was built at the gradle default of minSdk 33, so nothing had ever targeted a lower API. Doing so turned up std::aligned_alloc, which is API 28+ -- below that <cstdlib> does not declare it at all and the using-declaration fails to resolve. posix_memalign is the older spelling and its result frees with plain free(), so the rest of the header is unaffected. Kept even though legacy now targets API 30, because it costs nothing and the next person to try a lower floor should not rediscover it. legacy targets armv8.1-a, which is the floor this codebase compiles at rather than a preference: util/simd.hpp uses SQRDMLAH (v8.1 RDMA) and util/asm.hpp has inline LSE atomics, so armv8-a does not build. Its value is cores that are ARMv8.2 without the OPTIONAL fp16 and dotprod extensions the other three variants require. Cortex-A53/A72/A73 class parts stay out of reach until those two paths gain fallbacks.
62 lines
2.4 KiB
Bash
Executable File
62 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# ARMSX3 Android arm64 configure.
|
|
#
|
|
# Configures from the REPO ROOT, not from android/ -- upstream RPCS3 assumes
|
|
# CMAKE_SOURCE_DIR is the repo root (FindWolfSSL.cmake, FindZLIB.cmake,
|
|
# 3rdparty/protobuf, 3rdparty/llvm all build paths off it).
|
|
#
|
|
# Usage: android/configure.sh [extra cmake args...]
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
: "${ANDROID_HOME:=$HOME/Library/Android/sdk}"
|
|
# NDK 29 (clang 21), NOT NDK 28.2 (clang 19.0.1).
|
|
# Upstream's stated floor is clang-19 and 28.2 sits exactly on it, but clang
|
|
# 19.0.1 mis-analyses fmt::throw_exception -- that is a CTAD struct whose
|
|
# constructor AND destructor are [[noreturn]], not a function -- so every switch
|
|
# default: that ends in it trips -Werror,-Wreturn-type. It killed 4 TUs in
|
|
# rpcs3_emu (SPUThread.{h,cpp}, SPULLVMRecompiler.cpp, SPUCommonRecompiler.cpp,
|
|
# lv2.cpp) at 2510/3123. Verified: all 4 compile with 0 errors under clang 21.
|
|
# Do NOT "fix" this with -Wno-error=return-type; the code is fine, the old
|
|
# compiler was not. rpcsx-ui-android pins the NDK 29 line for the same reason.
|
|
: "${NDK_VERSION:=29.0.14206865}"
|
|
: "${CMAKE_VERSION:=3.30.5}"
|
|
: "${ANDROID_API:=33}" # keep in step with armsx3-ui minSdk
|
|
: "${BUILD_DIR:=$ROOT/build-android}"
|
|
|
|
NDK="$ANDROID_HOME/ndk/$NDK_VERSION"
|
|
CM="$ANDROID_HOME/cmake/$CMAKE_VERSION/bin"
|
|
|
|
[ -d "$NDK" ] || { echo "NDK not found: $NDK" >&2; exit 1; }
|
|
[ -x "$CM/cmake" ] || { echo "cmake not found: $CM/cmake" >&2; exit 1; }
|
|
|
|
exec "$CM/cmake" -S "$ROOT" -B "$BUILD_DIR" -G Ninja \
|
|
-DCMAKE_TOOLCHAIN_FILE="$NDK/build/cmake/android.toolchain.cmake" \
|
|
-DANDROID_ABI=arm64-v8a \
|
|
-DANDROID_PLATFORM="android-$ANDROID_API" \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_MAKE_PROGRAM="$CM/ninja" \
|
|
`# wrong-for-cross-compile upstream defaults` \
|
|
-DUSE_NATIVE_INSTRUCTIONS=OFF \
|
|
-DUSE_SDL=OFF \
|
|
-DUSE_SYSTEM_SDL=OFF \
|
|
-DUSE_GAMEMODE=OFF \
|
|
`# no system libs inside the NDK sysroot` \
|
|
-DUSE_SYSTEM_LIBUSB=OFF \
|
|
-DUSE_SYSTEM_CURL=OFF \
|
|
-DUSE_SYSTEM_OPENCV=OFF \
|
|
-DUSE_SYSTEM_FFMPEG=OFF \
|
|
-DUSE_SYSTEM_ZLIB=ON \
|
|
`# desktop-only features` \
|
|
-DUSE_DISCORD_RPC=OFF \
|
|
-DUSE_FAUDIO=OFF \
|
|
-DUSE_LIBEVDEV=OFF \
|
|
`# LLVM 22 from the pinned submodule, statically linked` \
|
|
-DWITH_LLVM=ON \
|
|
-DBUILD_LLVM=ON \
|
|
-DSTATIC_LINK_LLVM=ON \
|
|
`# LTO off for bring-up: large link RAM/disk cost, no benefit while iterating` \
|
|
-DUSE_LTO=OFF \
|
|
-DASMJIT_NO_SHM_OPEN=ON \
|
|
"$@"
|