当前位置: 首页 > wzjs >正文

江油网站建设开发公司资料管理

江油网站建设,开发公司资料管理,北京网站seo公司,查看wordpress版本对应的php上一篇中说明了Openharmony V3.1的编译构建流程,如何在标准系统即L2设备添加一个模块呢,在Openharmony上如何编译与运行HelloWorld此篇中有所提及,此篇对此进行详细的说明。一、标准系统添加一个模块在Openharmony中添加模块可以分以下三种情…

上一篇中说明了Openharmony V3.1的编译构建流程,如何在标准系统即L2设备添加一个模块呢,在Openharmony上如何编译与运行HelloWorld此篇中有所提及,此篇对此进行详细的说明。

一、标准系统添加一个模块

在Openharmony中添加模块可以分以下三种情况,对原有的配置文件时行不同程度的修改

  • 在原有的部件中添加一个模块

  • 新建部件并在其中添加模块

  • 新建子系统并在该子系统的部件下添加模块

以下分三种方式对添加一个模块的过程来分别分析。

二、 在原有部件中添加一个模块

1.在模块目录下配置BUILD.gn,根据类型选择对应的模板

支持的模板类型:

ohos_executable		#可执行程序
ohos_shared_library #动态库
ohos_static_library #静态库# 预编译模板
ohos_prebuilt_executable 		#预编译可执行程序
ohos_prebuilt_shared_library 	#预编译动态库
ohos_prebuilt_etc				#预编译配置

以下例子中对BUILD.gn文件中各模板的属性及配置项的注释说明

例子:

ohos_shared_library示例

import("//build/ohos.gni")
ohos_shared_library("helloworld") {source = ["",""]		# 包含的C或C++文件include_dir = ["",""] # 包含的头文件cflags = []			# 编译选项cflags_c = []cflags_CC = []ldflags = []configs = []deps = []				# 部件内模块依赖external_deps = ["part_name:module_name",]# 跨部件模块依赖定义# 定义格式为 "部件名:模块名称"# 这里依赖的模块必须是部件声明在inner_kits中的模块defines += ["",""]	# 宏定义output_name = "" 		# 可选,模块输出名output_extension = "" # 可选,模块名后缀module_install_dir = ""	# 可选,缺省在/system/lib64或/system/lib下,模块安装路径,模块安装路径,从system/,vendor/后开始指定relative_install_dir = ""	# 可选,模块安装相对路径,相对于/system/lib64或/system/lib;如果有module_install_dir配置时,该配置项不生效part_name = ""		# 必选,所属部件名称subsystem_name = ""	# 可选,子系统名称
}

ohos_executable示例

ohos_executable模板属性和ohos_shared_library基本一致。

ohos_executable("helloworld") {source = ["",""]		# 包含的C或C++文件include_dir = ["",""] # 包含的头文件
...install_enable = true	# 编译后的镜像烧录后,可执行模块默认是不安装在开发板内,如果要安装需要指定install_enable为true.
}

ohos_prebuilt_etc示例

ohos_prebuilt_etc就是将预编译的文件安装在开发板内,一般会是配置文件,例如xml,cfg等。

ohos_prebuilt_etc("helloworld") {source = ""		deps = [] 	# 部件内模块依赖module_install_dir = ""	# 可选,模块安装路径,从system/,vendor/后开始指定relative_install_dir = ""	# 可选,模块安装相对路径,相对于/system/etc;如果有module_install_dir配置时,该配置项不生效part_name = ""		# 必选,所属部件名称
}

2.修改包含该模块所属部件的bundle.json

以base/account/os_account/bundle.json为例:

此模块的BUILD.gn文件所在目录为//base/account/os_account/,

则在“sub_component”中添加"//base/account/os_account:helloworld"。

{"name": "@ohos/os_account","description": "Allowing apps to use OS account-related functions","version": "3.1","license": "Apache License 2.0","publishAs": "code-segment","segment": {"destPath": "base/account/os_account"},
..."component": {"name": "os_account_standard","subsystem": "account",
..."build": {"sub_component": ["//base/account/os_account/services:services_target","//base/account/os_account/services/accountmgr/src/appaccount:app_account_service_core","//base/account/os_account/frameworks/appaccount/native:app_account_innerkits","//base/account/os_account/frameworks/osaccount/core:os_account_core","//base/account/os_account/frameworks/common:common_target","//base/account/os_account/frameworks/osaccount/native:os_account_innerkits","//base/account/os_account/interfaces/kits/napi/appaccount:appaccount","//base/account/os_account/interfaces/kits/napi/distributedaccount:distributedaccount","//base/account/os_account/interfaces/kits/napi/osaccount:osaccount","//base/account/os_account/sa_profile:account_sa_profile","//base/account/os_account/tools:os_account_tools","//base/account/os_account:helloworld"],
...}}
}

此时再在Openharmony里执行

./build.sh --product-name rk3568

编译完成后,在//out/rk3568/account/os_account_standard/目录下可以找到编译完成的可执行文件与动态库。

三、新建部件并在其中添加模块

  1. 在模块目录下配置BUILD.gn,根据类型选择需要的模板

此步与在原部件中添加一个模块的方法基本上一致,只需要注意该模块对应BUILD.gn文件中的part_name为新建部件的名称即可。

2.修改或者新建bundle.json

在原有子系统中添加一个新的部件,有两种方法,一种就是如第二点所述,在原有的bundle.json文件中添加该部件。另一种就是新建一个。注意无论哪种方式该bundle.json文件均在对应子系统所在的文件目录下。除非你修改了//build/subsystem_config.json中关于此子系统对应的路径信息。参考Openharmony的编译构建--基础篇。

以account子系统为例,添加新的子部件os_account_test.

  • 首先base/account下创建目录os_account_test,此目录下新建bundle.json。内容如下

{"name": "@ohos/os_account","description": "Allowing apps to use OS account-related functions","version": "3.1","license": "Apache License 2.0","publishAs": "code-segment","segment": {"destPath": "base/account/os_account"},
..."component": {"name": "os_account_test",		# 新建的部件名称"subsystem": "account",			# 所属的子系统
...},"build": {"sub_component": [			# 部件包含的模块的gn目标
...                                  ],"inner_kits": [
...],"test": [
...]}}
}
  • 添加BUILD.gn

如果在base/account/os_account_test新建BUILD.gn,则sub_component添加如下

"//base/account/os_account_test:helloworld"
  • inner_kits与test

假如有提供给其它部件的接口,需要在inner_kits说明,假如有测试用例,需要在test中说明,inner_kits与test不是必选项,可以不添加。

3.//productdefine/common/products/rk3568.json文件添加部件"account:os_account_test":{}

{"product_name": "rk3568","product_company": "hihope","product_device": "rk3568","version": "2.0","type": "standard","product_build_path": "device/hihope/build","parts":{"ace:ace_engine_standard":{},"ace:napi":{},"account:os_account_standard":{},"account:os_account_test":{},"barrierfree:accessibility":{},
......}
}

至此,重新编译。在//out/rk3568/account/os_account_test/目录下会得到新增的模块下可执行文件或动态库。

后续更精彩

1.Openharmony编译构建--进阶篇2


文章转载自:

http://mrOSCYmH.gynLs.cn
http://UPv39Hqx.gynLs.cn
http://qFzwzTMN.gynLs.cn
http://32CV9wbe.gynLs.cn
http://45VSKgqB.gynLs.cn
http://E6xNTo84.gynLs.cn
http://QdQJRxmW.gynLs.cn
http://qHxsHyAQ.gynLs.cn
http://AQczPj8Q.gynLs.cn
http://KRswgztc.gynLs.cn
http://4iaYQUOH.gynLs.cn
http://KtodiTNK.gynLs.cn
http://yFXyG0oz.gynLs.cn
http://GyqaIJXl.gynLs.cn
http://a22qVFRT.gynLs.cn
http://UmIibqXp.gynLs.cn
http://1mijL8ZB.gynLs.cn
http://hZ5V0Lju.gynLs.cn
http://8XECoJRW.gynLs.cn
http://zVTibfMp.gynLs.cn
http://AoVUW3cX.gynLs.cn
http://PptQHxPc.gynLs.cn
http://s6Epsm55.gynLs.cn
http://ZotUGI7N.gynLs.cn
http://NvAMaurm.gynLs.cn
http://2baZjBRk.gynLs.cn
http://nlomdTHo.gynLs.cn
http://ycEcL3PM.gynLs.cn
http://vGiurcOj.gynLs.cn
http://AMBA3jEt.gynLs.cn
http://www.dtcms.com/wzjs/776432.html

相关文章:

  • 广安网站设计公司成都网站建设科技公司
  • 建站公司论坛怎么在微信公众号上做网站
  • 网站开发平台软件asp网站开发培训
  • xyz域名注册局官方网站高性能网站建设进阶
  • 企业网站优化报价无锡市规划建设局网站
  • 建筑网站招聘html5做网站好吗
  • 做网站哪家企业为什么需要流程管理
  • 哪个网站专门做邮轮旅游的网业分离后运营商命运
  • 上海红酒网站建设免费ppt课件下载网站
  • 企业网站优化方法包括展览搭建设计网站
  • a站是指哪个网站泰安正规的网站建设
  • 做牙网站手机网站页面设计要求
  • 2015做哪些网站致富建盏公司简介
  • 北京企业网站建设公司哪家好网站开发建设成本
  • 网站建设岗位说明书网络营销策划是什么
  • 做游戏的php网站有哪些前程无忧网广州网站建设类岗位
  • 郑州网站的建设品牌网站建站
  • 韩国做暖暖网站什么是电子商务专业
  • 网站设计实施方案如何百度搜到网站
  • 在源码之家下载的网站模板可以作为自己的网站吗现在公众号做电影网站的发展
  • 爬虫怎么看网站开发者模式WordPress网站主题升级
  • 湖州 网站建设网站登录不了怎么办
  • 苏州电子商务网站开发公司ui培训多少学费
  • 回收手表网站西安前端培训机构推荐
  • 中山专业门户网站制作咨询中小型企业的数据查询
  • 腾讯合作网站建设有哪些公司网站建设企业网站制作平台
  • 腾讯学生服务器做网站商丘做网站seo
  • 洛阳做网站排名站长之家网址ip查询
  • 广告网站开发背景杭州python做网站
  • 古典水墨网站环球网