Created
April 2, 2025 04:15
-
-
Save iplanetcn/d6547ff80ef7d390fd0660d91d90c577 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if NDK path is provided | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 /path/to/android-ndk" | |
exit 1 | |
fi | |
NDK_PATH=$1 | |
SFML_DIR=~/SourceCode/SFML | |
# Clone SFML if not exists | |
if [ ! -d "$SFML_DIR" ]; then | |
git clone https://github.com/SFML/SFML.git "$SFML_DIR" | |
cd "$SFML_DIR" || exit 1 | |
else | |
cd "$SFML_DIR" || exit 1 | |
git pull | |
fi | |
# ABIs to build for | |
ABIS="armeabi-v7a arm64-v8a x86 x86_64" | |
# Build for each ABI | |
for ABI in $ABIS; do | |
echo "Building for ABI: $ABI" | |
mkdir -p build/$ABI | |
cd build/$ABI || exit 1 | |
cmake -DCMAKE_SYSTEM_NAME=Android \ | |
-DCMAKE_ANDROID_NDK="$NDK_PATH" \ | |
-DCMAKE_ANDROID_ARCH_ABI="$ABI" \ | |
-DCMAKE_ANDROID_STL_TYPE=c++_static \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
../../ || exit 1 | |
make -j$(nproc) || exit 1 | |
cd ../../ | |
done | |
echo "Build completed for all architectures" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment