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

跟著小白一起學(xué)鴻蒙之第一個(gè)OpenHarmony程序

系統(tǒng) OpenHarmony
今天我們來(lái)熟悉下OpenHarmony的編譯框架和如果自己開(kāi)發(fā)一個(gè)HelloWord程序。

??想了解更多關(guān)于開(kāi)源的內(nèi)容,請(qǐng)?jiān)L問(wèn):??

??51CTO 開(kāi)源基礎(chǔ)軟件社區(qū)??

??https://ost.51cto.com??

今天我們來(lái)熟悉下OpenHarmony的編譯框架和如果自己開(kāi)發(fā)一個(gè)HelloWord程序。

簡(jiǎn)介

OpenHarmony的編譯過(guò)程分析

graph LR
build.sh --> build.py --> hb --> gn
hb --> ninja
hb --> clang

#跟著小白一起學(xué)鴻蒙# [二]第一個(gè)OpenHarmony程序-開(kāi)源基礎(chǔ)軟件社區(qū)

名詞解釋

gn: generate ninja工具,在out目錄下生成ninja編譯文件*.ninja,文件位置在prebuilts/build-tools/linux-x86目錄里。

$ ./gn --help
Commands (type "gn help <command>" for more help):
analyze: Analyze which targets are affected by a list of files.
args: Display or configure arguments declared by the build.
check: Check header dependencies.
clean: Cleans the output directory.
desc: Show lots of insightful information about a target or config.
format: Format .gn files.
gen: Generate ninja files.
help: Does what you think.
ls: List matching targets.
meta: List target metadata collection results.
path: Find paths between two targets.
refs: Find stuff referencing a target or file.
……

ninja:構(gòu)建工具,根據(jù)gn生成的*.ninja文件進(jìn)行編譯構(gòu)建,文件位置在prebuilts/build-tools/linux-x86目錄里。

./ninja --help
usage: ninja [options] [targets...]
if targets are unspecified, builds the 'default' target (see manual).
options:
--version print ninja version ("1.10.1")
-v, --verbose show all command lines while building
-C DIR change to DIR before doing anything else
-f FILE specify input build file [default=build.ninja]
-j N run N jobs in parallel (0 means infinity) [default=10 on this system]
-k N keep going until N jobs fail (0 means infinity) [default=1]
-l N do not start new jobs if the load average is greater than N
-n dry run (don't run commands but act like they succeeded)
-d MODE enable debugging (use '-d list' to list modes)
-t TOOL run a subtool (use '-t list' to list subtools)
terminates toplevel options; further flags are passed to the tool
-w FLAG adjust warnings (use '-w list' to list warnings)

clang:編譯器,同gcc兼容。

1、查看.gn并增加應(yīng)用輸出

路徑為:oh32/third_party/libuv/BUILD.gn,找到如下位置增加。

//靜態(tài)庫(kù)
ohos_static_library("uv_static") {
deps = [ ":libuv_source" ]
public_configs = [ ":libuv_config" ]
subsystem_name = "thirdparty"
part_name = "libuv"
}
//動(dòng)態(tài)庫(kù)
ohos_shared_library("uv") {
deps = [ ":libuv_source" ]
public_configs = [ ":libuv_config" ]
subsystem_name = "thirdparty"
part_name = "libuv"
if (is_ohos) {
output_extension = "so"
}
install_images = [
"system",
"updater",
]
}
//增加的新應(yīng)用
ohos_executable("helloworld") {
sources = [ "helloword.c",]
}
2、增加helloworld.c

在oh32/third_party/libuv目錄下增加helloworld.c。

3、增加helloworld編譯生成的入口

在test/xts/acts/graphic/BUILD.gn里增加deps,如下:

import("http://build/ohos_var.gni")
group("graphic") {
testonly = true
if (is_standard_system) {
deps = [
"webGL:webGL_hap_test",
"windowStage:ActsWindowStageTest",
"windowstandard:window_hap_test",
"http://third_party/libuv:helloworld", #引入helloworld程序編譯
]
} else {
deps = [
"appaccount:appaccount_hap",
"osaccount:osaccount_hap",
]
}
}

源碼根目錄執(zhí)行:

./build.sh --product-name rk3568

源碼根目錄執(zhí)行:

./build.sh --product-name rk3568 --gn-args build_xts=true --build-target "acts" --gn-args is_standard_system=true
5、編譯完成后生成的第三方庫(kù)驗(yàn)證程序helloworld使用流程

runtest庫(kù)文件會(huì)輸出helloworld,路徑為:out/rk3568/common/common。

~/oh32/out/rk3568/common/common$ ls
libc libimagePixelmap.so libnativerender.so libsqlite.z.so libteststring.so libusb_shared.z.so helloworld

使用方式如下:

1. 拷貝helloworld到板子上
hdc_std.exe file send helloworld /data/local/tmp
//2. 登錄板子,運(yùn)行helloworld,如果第一次需要給權(quán)限
pc端:hdc_std.exe shell
板子:cd /data/local/tmp
板子:chmod +x helloworld
板子:./helloworld

結(jié)果:

#./helloworld
hello world!#

??想了解更多關(guān)于開(kāi)源的內(nèi)容,請(qǐng)?jiān)L問(wèn):??

??51CTO 開(kāi)源基礎(chǔ)軟件社區(qū)??

??https://ost.51cto.com??。

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

2022-09-30 14:08:26

Hap應(yīng)用鴻蒙

2022-08-19 19:02:20

開(kāi)源鴻蒙操作系統(tǒng)

2023-01-03 15:09:10

鴻蒙常用工具

2022-11-29 16:35:02

Tetris鴻蒙

2022-12-02 14:20:09

Tetris鴻蒙

2022-12-06 15:39:16

鴻蒙主干代碼

2022-09-28 13:57:41

鴻蒙開(kāi)源

2022-11-14 17:01:34

游戲開(kāi)發(fā)畫(huà)布功能

2023-03-30 09:32:27

2022-11-22 15:15:46

Wi-Fi鴻蒙

2022-12-05 15:02:14

鴻蒙用戶鑒權(quán)

2022-11-28 15:42:39

分布式軟總線鴻蒙

2022-11-25 16:48:54

鴻蒙Stage HAP

2022-09-16 15:22:16

測(cè)試套件鴻蒙

2022-11-24 14:34:41

Hap程序鴻蒙

2023-02-27 16:30:32

鴻蒙開(kāi)源協(xié)議分析

2023-03-30 09:19:54

SELinux安全子系統(tǒng)

2023-04-04 09:24:11

鴻蒙HiDumper

2022-10-10 14:47:04

藍(lán)牙應(yīng)用鴻蒙

2022-10-20 16:40:16

JS應(yīng)用控制LED鴻蒙
點(diǎn)贊
收藏

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