自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

#2020征文-開(kāi)發(fā)板#移植lua到鴻蒙—在鴻蒙上用lua跑Hello World

系統(tǒng)
文章由鴻蒙社區(qū)產(chǎn)出,想要了解更多內(nèi)容請(qǐng)前往:51CTO和華為官方戰(zhàn)略合作共建的鴻蒙技術(shù)社區(qū)https://harmonyos.51cto.com/#zz
[[356031]]

想了解更多內(nèi)容,請(qǐng)?jiān)L問(wèn):

51CTO和華為官方合作共建的鴻蒙技術(shù)社區(qū)

https://harmonyos.51cto.com/#zz

慣例先放hello world


本項(xiàng)目地址: https://gitee.com/hiharmonica/lua

下載能在鴻蒙上跑的二進(jìn)制文件

準(zhǔn)備環(huán)境

1. 安裝 docker

2. docker pull ystyle/open-harmony

  • ps: 本文使用與鴻蒙系統(tǒng)一同編譯的方法。 如果自己有本地環(huán)境,可以把lua項(xiàng)目放鴻蒙代碼目錄里(或者使用軟接連)

下載lua官方代碼

  1. mkdir -p ~/code/ohos/ 
  2.  
  3. cd ~/code/ohos/ 
  4.  
  5. git clone https://github.com/lua/lua.git 

 編寫(xiě)B(tài)UILD.gn文件

因?yàn)橐c系統(tǒng)一起編譯, 為了方便,直接用替換掉示例的方法,這樣就只需要寫(xiě)一個(gè)BUILD.gn就好了 

  1. # Copyright (c) 2020 YSTYLE(lxy5266@live.com) 
  2.  
  3. # Licensed under the Apache License, Version 2.0 (the "License"); 
  4.  
  5. # you may not use this file except in compliance with the License. 
  6.  
  7. # You may obtain a copy of the License at 
  8.  
  9.  
  10. # http://www.apache.org/licenses/LICENSE-2.0 
  11.  
  12.  
  13. # Unless required by applicable law or agreed to in writing, software 
  14.  
  15. # distributed under the License is distributed on an "AS IS" BASIS, 
  16.  
  17. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
  18.  
  19. # See the License for the specific language governing permissions and 
  20.  
  21. # limitations under the License. 
  22.  
  23. import("//build/lite/config/component/lite_component.gni"
  24.  
  25. import("//build/lite/ndk/ndk.gni"
  26.  
  27. static_library("hello_world") { 
  28.  
  29. sources = [ 
  30.  
  31. "lapi.c"
  32.  
  33. "lauxlib.c"
  34.  
  35. "lbaselib.c"
  36.  
  37. "lcode.c"
  38.  
  39. "lcorolib.c"
  40.  
  41. "lctype.c"
  42.  
  43. "ldblib.c"
  44.  
  45. "ldebug.c"
  46.  
  47. "ldo.c"
  48.  
  49. "ldump.c"
  50.  
  51. "lfunc.c"
  52.  
  53. "lgc.c"
  54.  
  55. "linit.c"
  56.  
  57. "liolib.c"
  58.  
  59. "llex.c"
  60.  
  61. "lmathlib.c"
  62.  
  63. "lmem.c"
  64.  
  65. "loadlib.c"
  66.  
  67. "lobject.c"
  68.  
  69. "lopcodes.c"
  70.  
  71. "loslib.c"
  72.  
  73. "lparser.c"
  74.  
  75. "lstate.c"
  76.  
  77. "lstring.c"
  78.  
  79. "lstrlib.c"
  80.  
  81. "ltable.c"
  82.  
  83. "ltablib.c"
  84.  
  85. "ltests.c"
  86.  
  87. "ltm.c"
  88.  
  89. "lua.c"
  90.  
  91. "lundump.c"
  92.  
  93. "lutf8lib.c"
  94.  
  95. "lvm.c"
  96.  
  97. "lzio.c" 
  98.  
  99.  
  100. include_dirs = [ 
  101.  
  102. "include"
  103.  
  104.  
  105.  
  106. lite_component("camera_app") { 
  107.  
  108. target_type = "executable" 
  109.  
  110. features = [ 
  111.  
  112. ":hello_world"
  113.  
  114.  
  115.  
  116. ndk_lib("app_sample") { 
  117.  
  118. deps = [ 
  119.  
  120. ":hello_world" 
  121.  
  122.  
  123. head_files = [ 
  124.  
  125. "include" 
  126.  
  127.  

 static_library里的source參照l(shuí)ua/makefile

編譯腳本

創(chuàng)建編譯腳本build-ohos.sh文件 

  1. cd ~/code/ohos/lua 
  2.  
  3. touch build-ohos.sh 
  4.  
  5. chmod +x build-ohos.sh 

 文件內(nèi)容如下

  1. set -e 
  2.  
  3. rm -rf ./out ./bin 
  4.  
  5. docker run --rm -ti \ 
  6.  
  7. -e HARDWARE=ipcamera_hi3516dv300 \ 
  8.  
  9. -v ${PWD}/out:/OpenHarmony/out \ 
  10.  
  11. -v ${PWD}:/OpenHarmony/applications/sample/camera/app \ 
  12.  
  13. ystyle/open-harmony 
  14.  
  15. mkdir -p ./bin 
  16.  
  17. cp ./out/ipcamera_hi3516dv300/bin/camera_app ./bin/lua 
  18.  
  19. tar -zcf lua-5.4.2-ohos.tar.gz ./bin 
  20.  
  21. echo 'build success!' 

 與鴻蒙一起編譯,這里使用我之前的docker鏡像

  1. cd ~/code/ohos/lua 
  2.  
  3. ./build-ohos.sh 
  4.  
  5. # 看到 ohos ipcamera_hi3516dv300 build success! build success! 就編譯成功了。 

  • 編譯后軟件在鴻蒙的 ./out/ipcamera_hi3516dv300/bin/camera_app
  • 腳本會(huì)把lua單獨(dú)打包出來(lái)
  • 單獨(dú)的lua可執(zhí)行文件在bin目錄

### 演示





本文鏈接:http://ystyle.top/2020/11/07/porting-Lua-to-openharmony/

博客內(nèi)容遵循 知識(shí)共享 署名 - 非商業(yè)性 - 相同方式共享 4.0協(xié)議

想了解更多內(nèi)容,請(qǐng)?jiān)L問(wèn):

51CTO和華為官方合作共建的鴻蒙技術(shù)社區(qū)

https://harmonyos.51cto.com/#zz

 

責(zé)任編輯:jianghua 來(lái)源: 鴻蒙社區(qū)
相關(guān)推薦

2020-12-29 09:59:01

鴻蒙HarmonyOS智能家居

2020-12-16 10:05:48

鴻蒙開(kāi)發(fā)板Onenet平臺(tái)

2020-12-15 11:57:49

Hi3861 HarmonyOS開(kāi)發(fā)板

2020-11-24 11:41:30

websocket

2013-12-12 17:30:03

Lua例子

2020-12-24 10:05:54

鴻蒙鴻蒙開(kāi)發(fā)Hello World

2020-12-15 09:33:40

鴻蒙Hi3861開(kāi)發(fā)板

2021-12-16 15:14:54

鴻蒙HarmonyOS應(yīng)用

2020-12-11 12:45:04

鴻蒙Hi3861游戲

2011-06-15 14:19:11

QT 移植

2022-01-07 21:11:27

鴻蒙HarmonyOS應(yīng)用

2020-12-10 12:12:32

鴻蒙開(kāi)發(fā)板init_lite

2021-01-07 11:24:51

鴻蒙HarmonyOS音樂(lè)

2020-12-21 09:57:52

OLED溫濕度計(jì)hi3861

2021-01-08 10:00:53

鴻蒙訊飛平臺(tái)語(yǔ)音控制

2017-09-17 12:21:52

移植Linux系統(tǒng)sqlite3

2020-10-14 09:37:03

HiBurn鴻蒙.bin文件

2020-11-06 10:15:16

HiBurn

2020-11-17 12:15:36

MQTT開(kāi)發(fā)

2020-11-25 11:55:47

FlappyBird
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)