Skip to content

Commit

Permalink
添加鸿蒙编译,fix #1125
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed Jun 7, 2024
1 parent 273c202 commit 5626e22
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,34 @@ jobs:
with:
path: ./build/plugin_luajit/**/*
name: plugin_luajit

ohos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install NDK
run: |
cd ~
cd ~
curl -O https://repo.huaweicloud.com/harmonyos/os/4.1-Release/ohos-sdk-windows_linux-public.tar.gz
tar xvfz ohos-sdk-windows_linux-public.tar.gz
cd ohos-sdk/linux
unzip -o -d ./ native-linux-x64-4.1.7.5-Release.zip
- name: Build
run: |
cd build
./make_ohos_lua54.sh
./make_ohos_lua53.sh
- name: Upload
uses: actions/upload-artifact@v2
with:
path: ./build/plugin_lua54/**/*
name: plugin_lua54
- name: Upload53
uses: actions/upload-artifact@v2
with:
path: ./build/plugin_lua53/**/*
name: plugin_lua53

linux:
runs-on: ubuntu-latest
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,34 @@ jobs:
with:
path: ./build/plugin_lua53/**/*
name: plugin_lua53

ohos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install NDK
run: |
cd ~
cd ~
curl -O https://repo.huaweicloud.com/harmonyos/os/4.1-Release/ohos-sdk-windows_linux-public.tar.gz
tar xvfz ohos-sdk-windows_linux-public.tar.gz
cd ohos-sdk/linux
unzip -o -d ./ native-linux-x64-4.1.7.5-Release.zip
- name: Build
run: |
cd build
./make_ohos_lua54.sh
./make_ohos_lua53.sh
- name: Upload
uses: actions/upload-artifact@v2
with:
path: ./build/plugin_lua54/**/*
name: plugin_lua54
- name: Upload53
uses: actions/upload-artifact@v2
with:
path: ./build/plugin_lua53/**/*
name: plugin_lua53

android_luajit:
runs-on: ubuntu-latest
Expand Down
23 changes: 23 additions & 0 deletions build/make_ohos_lua53.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

if [ -n "$OHOS_NDK" ]; then
export NDK=${OHOS_NDK}
elif [ -n "$OHOS_NDK_HOME" ]; then
export NDK=${OHOS_NDK_HOME}
else
export NDK=~/ohos-sdk/linux/native
fi

export PATH=${NDK}/build-tools/cmake/bin:$PATH

function build() {
ABI=$1
BUILD_PATH=build.OHOS.${ABI}
cmake -H. -DOHOS_STL=c++_shared -B${BUILD_PATH} -DOHOS_ARCH=${ABI} -DOHOS_PLATFORM=OHOS -DCMAKE_TOOLCHAIN_FILE=${NDK}/build/cmake/ohos.toolchain.cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
cmake --build ${BUILD_PATH} --config Release
mkdir -p plugin_lua53/Plugins/OpenHarmony/libs/${ABI}/
cp ${BUILD_PATH}/libxlua.so plugin_lua53/Plugins/OpenHarmony/libs/${ABI}/libxlua.so
}

build armeabi-v7a
build arm64-v8a
23 changes: 23 additions & 0 deletions build/make_ohos_lua54.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

if [ -n "$OHOS_NDK" ]; then
export NDK=${OHOS_NDK}
elif [ -n "$OHOS_NDK_HOME" ]; then
export NDK=${OHOS_NDK_HOME}
else
export NDK=~/ohos-sdk/linux/native
fi

export PATH=${NDK}/build-tools/cmake/bin:$PATH

function build() {
ABI=$1
BUILD_PATH=build54.OHOS.${ABI}
cmake -H. -DLUA_VERSION=5.4.1 -DOHOS_STL=c++_shared -B${BUILD_PATH} -DOHOS_ARCH=${ABI} -DOHOS_PLATFORM=OHOS -DCMAKE_TOOLCHAIN_FILE=${NDK}/build/cmake/ohos.toolchain.cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
cmake --build ${BUILD_PATH} --config Release
mkdir -p plugin_lua54/Plugins/OpenHarmony/libs/${ABI}/
cp ${BUILD_PATH}/libxlua.so plugin_lua54/Plugins/OpenHarmony/libs/${ABI}/libxlua.so
}

build armeabi-v7a
build arm64-v8a

0 comments on commit 5626e22

Please sign in to comment.