Posted 51CTO鎶€鏈爤
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了相关的知识,希望对你有一定的参考价值。
閫?绂?鍒?鍟?/strong>
鍏虫敞HarmonyOS鎶€鏈ぞ鍖?/strong>锛屽洖澶?/span>銆愰缚钂欍€?/span>閫?/span>灏忕背灏忕埍闊崇mini锛堟暟閲忎笉澶氾紝鍏堝埌鍏堝緱锛?/span>锛岃繕鍙互鍏嶈垂涓嬭浇楦胯挋鍏ラ棬璧勬枡锛?br class="mq-43">
馃憞鎵爜绔嬪埢鍏虫敞馃憞
涓撴敞寮€婧愭妧鏈紝鍏卞缓楦胯挋鐢熸€?/span>
鏈枃浣滆€呭皢缁欏ぇ瀹跺垎浜細绉绘 lua 鍒伴缚钂欌€斿湪楦胯挋涓婄敤 lua 璺?hello world銆?/span>
鏈」鐩湴鍧€:
01 鍑嗗鐜https://gitee.com/hiharmonica/lua
https://gitee.com/hiharmonica/lua/releases/v5.4.2
瀹夎 docker
docker pull ystyle/open-harmony
PS锛?/span>鏈枃浣跨敤涓庨缚钂欑郴缁熶竴鍚岀紪璇戠殑鏂规硶銆傚鏋滆嚜宸辨湁鏈湴鐜锛屽彲浠ユ妸 lua 椤圭洰鏀鹃缚钂欎唬鐮佺洰褰曢噷锛堟垨鑰呬娇鐢ㄨ蒋鎺ヨ繛锛?/span>銆?/span>
02
涓嬭浇 lua 瀹樻柟浠g爜
mkdir -p ~/code/ohos/
cd ~/code/ohos/
git clone https://github.com/lua/lua.git
03
缂栧啓 BUILD.gn 鏂囦欢
# Copyright (c) 2020 YSTYLE(lxy5266@live.com)
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/lite/config/component/lite_component.gni")
import("//build/lite/ndk/ndk.gni")
static_library("hello_world") {
sources = [
"lapi.c",
"lauxlib.c",
"lbaselib.c",
"lcode.c",
"lcorolib.c",
"lctype.c",
"ldblib.c",
"ldebug.c",
"ldo.c",
"ldump.c",
"lfunc.c",
"lgc.c",
"linit.c",
"liolib.c",
"llex.c",
"lmathlib.c",
"lmem.c",
"loadlib.c",
"lobject.c",
"lopcodes.c",
"loslib.c",
"lparser.c",
"lstate.c",
"lstring.c",
"lstrlib.c",
"ltable.c",
"ltablib.c",
"ltests.c",
"ltm.c",
"lua.c",
"lundump.c",
"lutf8lib.c",
"lvm.c",
"lzio.c"
]
include_dirs = [
"include",
]
}
lite_component("camera_app") {
target_type = "executable"
features = [
":hello_world",
]
}
ndk_lib("app_sample") {
deps = [
":hello_world"
]
head_files = [
"include"
]
}
static_library 閲岀殑 source 鍙傜収 lua/makefile銆?/span>
04
缂栬瘧鑴氭湰
cd ~/code/ohos/lua
touch build-ohos.sh
chmod +x build-ohos.sh
set -e
rm -rf ./out ./bin
docker run --rm -ti
-e HARDWARE=ipcamera_hi3516dv300
-v ${PWD}/out:/OpenHarmony/out
-v ${PWD}:/OpenHarmony/applications/sample/camera/app
ystyle/open-harmony
mkdir -p ./bin
cp ./out/ipcamera_hi3516dv300/bin/camera_app ./bin/lua
tar -zcf lua-5.4.2-ohos.tar.gz ./bin
echo 'build success!'
cd ~/code/ohos/lua
./build-ohos.sh
# 鐪嬪埌 ohos ipcamera_hi3516dv300 build success! build success! 灏辩紪璇戞垚鍔熶簡銆?/span>
缂栬瘧鍚庤蒋浠跺湪楦胯挋鐨?./out/ipcamera_hi3516dv300/bin/camera_app
鑴氭湰浼氭妸 lua 鍗曠嫭鎵撳寘鍑烘潵
鍗曠嫭鐨?lua 鍙墽琛屾枃浠跺湪 bin 鐩綍
05
婕旂ず
IO 鎿嶄綔
瀹樻柟娴嬭瘯鐢ㄤ緥 2
瀹樻柟娴嬭瘯鐢ㄤ緥 3
http://ystyle.top/2020/11/07/porting-Lua-to-openharmony/
鐐?/strong>鈥滈槄璇诲師鏂団€?/strong>浜嗚В鏇村
以上是关于的主要内容,如果未能解决你的问题,请参考以下文章