Skip to content

Commit

Permalink
enable android
Browse files Browse the repository at this point in the history
  • Loading branch information
amakropoulos committed Jul 23, 2024
1 parent 1196f33 commit 8b7d2ab
Showing 1 changed file with 55 additions and 55 deletions.
110 changes: 55 additions & 55 deletions .github/workflows/build_library.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -668,60 +668,60 @@ jobs:

################################ Android ################################

# android-build:
# runs-on: ubuntu-latest
# steps:
# - name: Clone
# id: checkout
# uses: actions/checkout@v4

# - name: Dependencies
# run: |
# sudo apt-get update
# sudo apt-get install build-essential cmake

# - name: Get Variables
# run: |
# echo "NDK=$ANDROID_NDK" >> $GITHUB_ENV

# - name: Clone llama.cpp
# run: |
# git clone https://github.com/ggerganov/llama.cpp llama.cpp
# cd llama.cpp
# git checkout ${{ env.LLAMACPP_VERSION }}
# sed -i 's:utils.hpp:utils_callback.hpp:g' examples/server/server.cpp
# sed -i 's:main(int argc:main_server(int argc:g' examples/server/server.cpp
# cd ..
# mkdir -p build/licenses build/libs
# cp llama.cpp/LICENSE build/licenses/llama.cpp.LICENSE.txt

# - name: Create missing files
# run: |
# cd llama.cpp
# for f in examples/server/public/*;do
# cmake -DINPUT=$f -DOUTPUT=`echo $f|sed -e 's:public/::g'`.hpp -P scripts/xxd.cmake
# done

# - name: Build
# id: cmake_build
# run: |
# sed -i "s:LIBRARY undreamai:LIBRARY undreamai_android:g" CMakeLists.txt
# export LD_LIBRARY_PATH=""
# cd build
# cmake .. -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-23 -DCMAKE_C_FLAGS=-march=armv8.4a+dotprod ${{ env.CMAKE_COMMON_JOBS }} ${{ env.CMAKE_COMMON_DIR }}
# cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS}

# - name: Pack artifacts
# id: pack_artifacts
# run: |
# rm build/libs/undreamai_test build/libs/undreamai_server
# zip -j undreamai-${{ github.ref_name }}-llamacpp-android.zip build/licenses/* build/libs/*

# - name: Upload Artifacts
# uses: actions/upload-artifact@v4
# with:
# name: undreamai-${{ github.ref_name }}-llamacpp-android.zip
# path: undreamai-${{ github.ref_name }}-llamacpp-android.zip
android-build:
runs-on: ubuntu-latest
steps:
- name: Clone
id: checkout
uses: actions/checkout@v4

- name: Dependencies
run: |
sudo apt-get update
sudo apt-get install build-essential cmake
- name: Get Variables
run: |
echo "NDK=$ANDROID_NDK" >> $GITHUB_ENV
- name: Clone llama.cpp
run: |
git clone https://github.com/ggerganov/llama.cpp llama.cpp
cd llama.cpp
git checkout ${{ env.LLAMACPP_VERSION }}
sed -i 's:utils.hpp:utils_callback.hpp:g' examples/server/server.cpp
sed -i 's:main(int argc:main_server(int argc:g' examples/server/server.cpp
cd ..
mkdir -p build/licenses build/libs
cp llama.cpp/LICENSE build/licenses/llama.cpp.LICENSE.txt
- name: Create missing files
run: |
cd llama.cpp
for f in examples/server/public/*;do
cmake -DINPUT=$f -DOUTPUT=`echo $f|sed -e 's:public/::g'`.hpp -P scripts/xxd.cmake
done
- name: Build
id: cmake_build
run: |
sed -i "s:LIBRARY undreamai:LIBRARY undreamai_android:g" CMakeLists.txt
export LD_LIBRARY_PATH=""
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-23 -DCMAKE_C_FLAGS=-march=armv8.4a+dotprod ${{ env.CMAKE_COMMON_JOBS }} ${{ env.CMAKE_COMMON_DIR }}
cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS}
- name: Pack artifacts
id: pack_artifacts
run: |
rm build/libs/undreamai_test build/libs/undreamai_server
zip -j undreamai-${{ github.ref_name }}-llamacpp-android.zip build/licenses/* build/libs/*
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: undreamai-${{ github.ref_name }}-llamacpp-android.zip
path: undreamai-${{ github.ref_name }}-llamacpp-android.zip

################################ Release ################################

Expand All @@ -738,7 +738,7 @@ jobs:
- windows-build
- windows-cuda-build
- windows-hip
# - android-build
- android-build
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down

0 comments on commit 8b7d2ab

Please sign in to comment.