OpenHarmony开发者论坛

标题: [Experience Sharing] Compile filter based on OpenHarmony [打印本页]

作者: itDyh12    时间: 2024-4-13 19:49
标题: [Experience Sharing] Compile filter based on OpenHarmony
[md]## 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
```
[/md]




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