成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

#2020征文-開發板#移植lua到鴻蒙—在鴻蒙上用lua跑Hello World

系統
文章由鴻蒙社區產出,想要了解更多內容請前往:51CTO和華為官方戰略合作共建的鴻蒙技術社區https://harmonyos.51cto.com/#zz
[[356031]]

想了解更多內容,請訪問:

51CTO和華為官方合作共建的鴻蒙技術社區

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

慣例先放hello world


本項目地址: https://gitee.com/hiharmonica/lua

下載能在鴻蒙上跑的二進制文件

準備環境

1. 安裝 docker

2. docker pull ystyle/open-harmony

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

下載lua官方代碼

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

 編寫BUILD.gn文件

因為要與系統一起編譯, 為了方便,直接用替換掉示例的方法,這樣就只需要寫一個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參照lua/makefile

編譯腳本

創建編譯腳本build-ohos.sh文件 

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

 文件內容如下

  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
  • 腳本會把lua單獨打包出來
  • 單獨的lua可執行文件在bin目錄

### 演示





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

博客內容遵循 知識共享 署名 - 非商業性 - 相同方式共享 4.0協議

想了解更多內容,請訪問:

51CTO和華為官方合作共建的鴻蒙技術社區

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

 

責任編輯:jianghua 來源: 鴻蒙社區
相關推薦

2020-12-29 09:59:01

鴻蒙HarmonyOS智能家居

2020-12-16 10:05:48

鴻蒙開發板Onenet平臺

2020-11-24 11:41:30

websocket

2020-12-15 11:57:49

Hi3861 HarmonyOS開發板

2013-12-12 17:30:03

Lua例子

2020-12-15 09:33:40

鴻蒙Hi3861開發板

2020-12-24 10:05:54

鴻蒙鴻蒙開發Hello World

2020-12-11 12:45:04

鴻蒙Hi3861游戲

2021-12-16 15:14:54

鴻蒙HarmonyOS應用

2011-06-15 14:19:11

QT 移植

2022-01-07 21:11:27

鴻蒙HarmonyOS應用

2021-01-08 10:00:53

鴻蒙訊飛平臺語音控制

2020-12-10 12:12:32

鴻蒙開發板init_lite

2020-12-21 09:57:52

OLED溫濕度計hi3861

2020-12-17 12:06:49

鴻蒙應用鴻蒙開發

2020-11-06 10:15:16

HiBurn

2020-11-25 11:55:47

FlappyBird

2020-12-31 11:48:37

鴻蒙HarmonyOSHello world

2017-09-17 12:21:52

移植Linux系統sqlite3

2021-01-07 11:24:51

鴻蒙HarmonyOS音樂
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 香蕉二区 | 美女久久视频 | 欧美色欧美亚洲另类七区 | 欧美成人h版在线观看 | 97国产在线视频 | 在线精品亚洲欧美日韩国产 | 色婷婷av一区二区三区软件 | 在线免费观看成人 | 亚洲欧美综合 | 欧美aaaaaaaaaa | 古装人性做爰av网站 | 91精产国品一二三区 | 在线日韩欧美 | 久一久| 男人的天堂中文字幕 | 亚洲 中文 欧美 日韩 在线观看 | 成人做爰www免费看 午夜精品久久久久久久久久久久 | 91资源在线 | 久久成人免费视频 | 国产精品久久久久久久免费大片 | 色伊人 | 91xh98hx 在线 国产 | 午夜精品91 | 国产高清在线观看 | 日韩欧美精品 | 精品欧美一区二区在线观看视频 | 精品国产91乱码一区二区三区 | 成人免费大片黄在线播放 | 99爱在线视频 | 亚洲视频欧美视频 | 国产精品久久久久久福利一牛影视 | 每日更新av | 国产欧美精品 | 免费亚洲婷婷 | 国产一区二区在线免费观看 | av片在线观看 | 国产精品久久久久久久久久 | 老司机午夜性大片 | 国产精品高潮呻吟久久aⅴ码 | 久久丁香| 亚洲在线免费 |