OpenHarmony开发者论坛

标题: 基于OpenHarmony编译filter [打印本页]

作者: dongzhengkuan    时间: 2023-11-4 14:20
标题: 基于OpenHarmony编译filter
[md]## 前言

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

## OpenHarmony编译环境搭建

1. 准备ubuntu22以上的编译环境
2. 获取OpenHarmony 4.0Release源码,[获取](https://gitee.com/openharmony/do ... 1%E8%8E%B7%E5%8F%96)
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
```

[/md]




欢迎光临 OpenHarmony开发者论坛 (https://forums.openharmony.cn/) Powered by Discuz! X3.5