• Lv0
    粉丝3

积分69 / 贡献0

提问0答案被采纳0文章5

[经验分享] 基于OpenHarmony编译filter

dongzhengkuan 显示全部楼层 发表于 2023-11-4 14:20:46

前言

  • OpenHarmony打印系统基于CUPS构建打印能力,打印机厂商可以基于Linux打印驱动开发经验,将驱动鸿蒙化适配,编译出arm32位的filter在RK3568开发板上调试

OpenHarmony编译环境搭建

  1. 准备ubuntu22以上的编译环境
  2. 获取OpenHarmony 4.0Release源码,获取
  3. 编译CUPS-Filters默认的filter,编译命令:./build.sh --product-name rk3568 --build-target third_party/cups-filters:third_party_cupsfilters
  4. 如果有编译报错,根据报错下载对应依赖解决

增加驱动filter编译配置,编译arm32位的filter

# 1、在BUILD.gn的group增加具体的xxxfilter
group("third_party_cupsfilters") {
  deps = [
    ":cupsfilters",
    ":cupsfilters.convs",
    ":cupsfilters.types",
    ":imagetoraster",
    ":xxxfilter",
  ]
}

# 2、在BUILD.gn参照imagetoraster添加xxxfilter编译配置
ohos_executable("xxxfilter") {
  # 源码件
  sources = [
    "$CUPS_FILTERS_CODE_DIR/filter/common.c",
    "$CUPS_FILTERS_CODE_DIR/filter/imagetoraster.c",
  ]
  # 依赖
  deps = [
    "//third_party/cups:cups",
    "//third_party/cups-filters:cupsfilters",
  ]

  public_configs = [ ":cups_filters_config" ]

  module_install_dir = "$cups_serverbin_dir/filter"
  install_enable = true
  subsystem_name = "$SUBSYSTEM_NAME"
  part_name = "$PART_NAME"
}

# 3、配置好之后执行编译命令
./build.sh --product-name rk3568 --build-target third_party/cups-filters:third_party_cupsfilters

# 4、获取编译好的xxxfilter
编译好的xxxfilter在:/OH源码目录/out/rk3568/thirdparty/cups-filters/xxxfilter
无用

©著作权归作者所有,转载或内容合作请联系作者

您尚未登录,无法参与评论,登录后可以:
参与开源共建问题交流
认同或收藏高质量问答
获取积分成为开源共建先驱

Copyright   ©2023  OpenHarmony开发者论坛  京ICP备2020036654号-3 |技术支持 Discuz!

返回顶部