| # Copyright 2026 The PDFium Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("../../pdfium.gni") |
| import("../../testing/test.gni") |
| |
| if (pdf_enable_rust_png) { |
| import("//build/rust/rust_static_library.gni") |
| |
| rust_static_library("png_codec_rust_ffi") { |
| testonly = true |
| crate_name = "png_codec_rust_ffi" |
| sources = [ "png_codec_rust_ffi.rs" ] |
| crate_root = "png_codec_rust_ffi.rs" |
| cxx_bindings = [ "png_codec_rust_ffi.rs" ] |
| allow_unsafe = true |
| deps = [ |
| "//build/rust:cxx_cppdeps", |
| "//third_party/rust/png/v0_18:lib", |
| ] |
| } |
| } |
| |
| source_set("png_codec") { |
| testonly = true |
| sources = [ "png_codec.h" ] |
| deps = [] |
| |
| if (pdf_enable_rust_png) { |
| sources += [ "png_codec_rust.cpp" ] |
| include_dirs = [ "$target_gen_dir/../.." ] |
| deps += [ |
| ":png_codec_rust_ffi", |
| "//build/rust:cxx_cppdeps", |
| ] |
| } else { |
| sources += [ "png_codec_libpng.cpp" ] |
| deps += [ |
| "../../third_party:png", |
| "../../third_party:zlib", |
| ] |
| } |
| |
| configs += [ |
| "../../:pdfium_strict_config", |
| "../../:pdfium_noshorten_config", |
| ] |
| public_deps = [ "../../core/fxcrt" ] |
| } |
| |
| pdfium_unittest_source_set("unittests") { |
| sources = [ "png_codec_unittest.cpp" ] |
| deps = [ ":png_codec" ] |
| pdfium_root_dir = "../../" |
| } |