馃憞鎵爜绔嬪埢鍏虫敞馃憞涓撴敞寮€婧愭妧鏈紝鍏卞缓楦胯挋鐢熸€?/span>鈥?鏈枃浣滆€呭皢"/>

Posted 51CTO鎶€鏈爤

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了相关的知识,希望对你有一定的参考价值。

閫?绂?鍒?鍟?/strong>




鍏虫敞HarmonyOS鎶€鏈ぞ鍖?/strong>锛屽洖澶?/span>銆愰缚钂欍€?/span>閫?/span>灏忕背灏忕埍闊崇mini锛堟暟閲忎笉澶氾紝鍏堝埌鍏堝緱锛?/span>锛岃繕鍙互鍏嶈垂涓嬭浇楦胯挋鍏ラ棬璧勬枡锛?br class="mq-43">


馃憞鎵爜绔嬪埢鍏虫敞馃憞

鍦ㄩ缚钂欎笂鐢╨ua璺慼ello world锛屾槸浠€涔堜綋楠?></p> 
     <p class=涓撴敞寮€婧愭妧鏈紝鍏卞缓楦胯挋鐢熸€?/span>


鈥?

鏈枃浣滆€呭皢缁欏ぇ瀹跺垎浜細绉绘 lua 鍒伴缚钂欌€斿湪楦胯挋涓婄敤 lua 璺?hello world銆?/span>


鎯緥鍏堟斁 hello world锛?/span>

鍦ㄩ缚钂欎笂鐢╨ua璺慼ello world锛屾槸浠€涔堜綋楠?></p> 
<section class= 鏈」鐩湴鍧€: 

https://gitee.com/hiharmonica/lua

涓嬭浇鑳藉湪楦胯挋涓婅窇鐨?/span> 浜岃繘鍒舵枃浠讹細
https://gitee.com/hiharmonica/lua/releases/v5.4.2

01

鍑嗗鐜



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 鏂囦欢


鍥犱负瑕佷笌绯荤粺涓€璧风紪璇戯紝 涓轰簡鏂逛究锛岀洿鎺ョ敤鏇挎崲鎺夌ず渚嬬殑鏂规硶锛岃繖鏍峰氨鍙渶瑕佸啓涓€涓?BUILD.gn 灏卞ソ浜嗐€?br>
# 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

缂栬瘧鑴氭湰


鍒涘缓缂栬瘧鑴氭湰 build-ohos.sh 鏂囦欢锛?br>
cd ~/code/ohos/lua
touch build-ohos.sh
chmod +x build-ohos.sh

鏂囦欢鍐呭濡備笅锛?/span>
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!'

涓庨缚钂欎竴璧风紪璇戯紝杩欓噷浣跨敤鎴戜箣鍓嶇殑 docker 闀滃儚銆?/span>
cd ~/code/ohos/lua
./build-ohos.sh
# 鐪嬪埌 ohos ipcamera_hi3516dv300 build success! build success! 灏辩紪璇戞垚鍔熶簡銆?/span>



05

婕旂ず


鍦ㄩ缚钂欎笂鐢╨ua璺慼ello world锛屾槸浠€涔堜綋楠?></p> 
<section class= IO 鎿嶄綔

鍦ㄩ缚钂欎笂鐢╨ua璺慼ello world锛屾槸浠€涔堜綋楠?> 
</section> 
<section class= 瀹樻柟娴嬭瘯鐢ㄤ緥 1

鍦ㄩ缚钂欎笂鐢╨ua璺慼ello world锛屾槸浠€涔堜綋楠?></p> 
<section class= 瀹樻柟娴嬭瘯鐢ㄤ緥 2

瀹樻柟娴嬭瘯鐢ㄤ緥 3


鏈枃閾炬帴锛?/span>
http://ystyle.top/2020/11/07/porting-Lua-to-openharmony/


鐐?/strong>鈥滈槄璇诲師鏂団€?/strong>浜嗚В鏇村

以上是关于的主要内容,如果未能解决你的问题,请参考以下文章

谷歌浏览器调试jsp 引入代码片段,如何调试代码片段中的js

片段和活动之间的核心区别是啥?哪些代码可以写成片段?

VSCode自定义代码片段——.vue文件的模板

VSCode自定义代码片段6——CSS选择器

VSCode自定义代码片段——声明函数

VSCode自定义代码片段8——声明函数