| load("@bazel_skylib//rules:run_binary.bzl", "run_binary") |
| load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test") |
| load("@rules_python//python:defs.bzl", "py_binary") |
| |
| filegroup( |
| name = "selected_test_sources", |
| # Minimal set of tests that work with the available deps. |
| srcs = ["png.c"], |
| ) |
| |
| py_binary( |
| name = "make-cairo-test-constructors", |
| srcs = ["make-cairo-test-constructors.py"], |
| main = "make-cairo-test-constructors.py", |
| ) |
| |
| run_binary( |
| name = "cairo_test_constructors_src", |
| srcs = [":selected_test_sources"], |
| outs = ["cairo-test-constructors.c"], |
| args = [ |
| "$(location cairo-test-constructors.c)", |
| "$(locations :selected_test_sources)", |
| ], |
| tool = ":make-cairo-test-constructors", |
| ) |
| |
| cc_library( |
| name = "pdiff", |
| srcs = [ |
| "pdiff/lpyramid.c", |
| "pdiff/pdiff.c", |
| ], |
| hdrs = [ |
| "pdiff/lpyramid.h", |
| "pdiff/pdiff.h", |
| ], |
| includes = ["."], |
| visibility = ["//visibility:public"], |
| deps = [ |
| "//:config", |
| "//src:cairo", |
| ], |
| ) |
| |
| cc_test( |
| name = "cairo_tests", |
| srcs = [ |
| "buffer-diff.c", |
| "buffer-diff.h", |
| "cairo-test.h", |
| "cairo-test-private.h", |
| "cairo-test-runner.c", |
| ":cairo_test_constructors_src", |
| ":selected_test_sources", |
| ] + select({ |
| "@platforms//os:windows": [], |
| "//conditions:default": ["cairo-test.c"], |
| }), |
| copts = select({ |
| "@rules_cc//cc/compiler:clang": [ |
| "-Wno-incompatible-pointer-types-discards-qualifiers", |
| "-Wno-unused-const-variable", |
| "-Wno-unused-variable", |
| ], |
| "//conditions:default": [], |
| }), |
| data = glob( |
| ["**/*"], |
| exclude = [ |
| "**/*.c", |
| "**/*.h", |
| "**/*.py", |
| "**/*.rsp", |
| "**/BUILD.bazel", |
| ], |
| ), |
| includes = [ |
| ".", |
| "pdiff", |
| ], |
| linkopts = select({ |
| "@platforms//os:windows": [], |
| "//conditions:default": [ |
| "-lm", |
| "-pthread", |
| ], |
| }), |
| linkstatic = True, |
| local_defines = [ |
| "_GNU_SOURCE", |
| ], |
| visibility = ["//visibility:public"], |
| deps = [ |
| ":pdiff", |
| "//:config", |
| "//boilerplate:cairo_boilerplate", |
| "//src:cairo", |
| "@libpng", |
| "@pixman", |
| "@zlib", |
| ], |
| ) |
| |
| # Render a synthetic glyph through both public FreeType/fontconfig APIs. |
| cc_test( |
| name = "ft_smoke", |
| size = "small", |
| srcs = ["ft-smoke.c"], |
| env = { |
| "FONTCONFIG_FILE": "/nonexistent/fonts.conf", |
| "FONTCONFIG_PATH": "/nonexistent", |
| }, |
| linkstatic = True, |
| deps = [ |
| "//src:cairo", |
| "@fontconfig", |
| "@freetype", |
| ], |
| ) |
| |
| cc_test( |
| name = "glyph_positioning", |
| size = "small", |
| srcs = ["glyph-positioning.c"], |
| linkstatic = True, |
| deps = ["//src:cairo"], |
| ) |