想了解更多内容,请访问:
https://harmonyos.51cto.com/#zz
惯例先放hello world
本项目地址: https://gitee.com/hiharmonica/lua
下载能在鸿蒙上跑的二进制文件
准备环境
1. 安装 docker
2. docker pull ystyle/open-harmony
下载lua官方代码
- mkdir -p ~/code/ohos/
- cd ~/code/ohos/
- git clone https://github.com/lua/lua.git
编写BUILD.gn文件
因为要与系统一起编译, 为了方便,直接用替换掉示例的方法,这样就只需要写一个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
编译脚本
创建编译脚本build-ohos.sh文件
- 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!'
与鸿蒙一起编译,这里使用我之前的docker镜像
- cd ~/code/ohos/lua
- ./build-ohos.sh
- # 看到 ohos ipcamera_hi3516dv300 build success! build success! 就编译成功了。
### 演示
本文链接:http://ystyle.top/2020/11/07/porting-Lua-to-openharmony/
博客内容遵循 知识共享 署名 - 非商业性 - 相同方式共享 4.0协议
https://harmonyos.51cto.com/#zz
一、简介 本设计为硬币图像识别统计装置通过数码相机获取平铺无重叠堆积的硬币的...
git工作区,暂存区,版本库之间的关系: 我们建立的项目文件夹就是工作区,在初...
大家好,今天我们来简单的聊一聊缓存问题。什么是缓存呢?它在系统设计中是在一个...
本文实例讲述了jsp中page指令用法。分享给大家供大家参考。具体如下: 一、JSP ...
从功能测试、性能测试、界面测试、安全性测试、易用性、兼容性测试、震动测试七...
首先给扑克牌中每张牌设定一个编号,下面算法实现的编号规则如下: u 红桃按照从...
一、MVC MVC模式的意思是,软件可以分成三个部分。 视图(View):用户界面。 控...
今日国内领先的智能数据服务运营商觉非科技完成近亿元A轮融资。本轮融资由和高资...
我们知道微软将会在今年给Windows10更换全新设计的UI,让Windows10的界面更加整...
前言 关于Window,你了解多少呢?看看下面这些问题你都能答上来吗。 如果你遇到这...