[经验分享] [Experience Sharing] Compile filter based on OpenHarmony

itDyh12 显示全部楼层 发表于 2024-4-13 19:49:23

preface

  • The OpenHarmony printing system is based on CUPS to build printing capabilities, and printer manufacturers can adapt the driver to HarmonyOS based on the Linux printing driver development experience, compile an arm32-bit filter and debug it on the RK3568 development board

OpenHarmony compilation environment

  1. Prepare the compilation environment of ubuntu22 or later
  2. Get the OpenHarmony 4.0Release source code
  3. To compile the default filter of CUPS-Filters, compile the command:./build.sh --product-name rk3568 --build-target third_party/cups-filters:third_party_cupsfilters
  4. If there is a compilation error, the error is resolved based on the corresponding download dependency

Add driver filter compilation configuration to compile arm32-bit 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!

返回顶部