专栏名称: 51CTO技术栈
有趣 | 有料 | 有内涵,为您提供最优质的内容,愿我们一起悦享技术,成就人生。
目录
相关文章推荐
51好读  ›  专栏  ›  51CTO技术栈

在鸿蒙上用lua跑hello world,是什么体验

51CTO技术栈  · 公众号  · 程序员  · 2020-12-04 18:05

正文

送 福 利 啦




关注 HarmonyOS技术社区 ,回复 【鸿蒙】 小米小爱音箱mini (数量不多,先到先得) ,还可以 免费下载 鸿蒙 入门资料


👇 扫码 立刻关注 👇

专注开源技术,共建鸿蒙生态


本文作者将给大家分享:移植 lua 到鸿蒙—在鸿蒙上用 lua 跑 hello world。


惯例先放 hello world:

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

下载能在鸿蒙上跑的 二进制文件:
https://gitee.com/hiharmonica/lua/releases/v5.4.2

01

准备环境


  • 安装 docker

  • docker pull ystyle/open-harmony


PS: 本文使用与鸿蒙系统一同编译的方法。如果自己有本地环境,可以把 lua 项目放鸿蒙代码目录里(或者使用软接连


02

下载 lua 官方代码


mkdir -p ~/code/ohos/
cd ~/code/ohos/
git clone https://github.com/lua/lua.git


03

编写 BUILD.gn 文件


因为要与系统一起编译, 为了方便,直接用替换掉示例的方法,这样就只需要写一个 BUILD.gn 就好了。
# Copyright (c) 2020 YSTYLE([email protected])
# 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"






请到「今天看啥」查看全文