Skip to content
  • Chun-wei Fan's avatar
    build: Add fallbacks for finding non-GNOME deps on MSVC · 18fb749d
    Chun-wei Fan authored
    Many of Pango's dependencies do not support a build system for Visual
    Studio that would generate the pkg-config files for them, so we need to
    try to look for them using cc.has_header() and cc.find_library() for
    them, namely for Cairo, FreeType, FontConfig and HarfBuzz as fallbacks.
    
    For Cairo, things are more complicated as there are multiple build
    options and configurations for it, so we need to check for those that we
    need after we find the Cairo headers and libraries by:
    
    -Including the respective headers (for cairo-win32.h, cairo-ps.h,
     cairo-pdf.h, cairo-quartz.h and cairo-xlib.h, since these features
     must have been enabled when Cairo is built and installed in order for
     those headers to be succesfully included)
    -For pangocairo with FreeType support, we need to check whether the
     FontConfig support is built into Cairo as well, as FontConfig support
     is actually required in Cairo for this.
    -For Cairo/PNG output surface support, check whether Cairo is built with
     PNG output surface support.
    
    We also need to update how pangocairo.pc and pangoft2 are generated:
    -On builds where pkg-config files can be found for cairo, freetype,
     fontconfig and/or harfbuzz:
     Generate it with "Requires: pango <depedencies>" as before, otherwise
     for MSVC builds where we find these libraries manually, we don't put
     these packages under "Requires:..." or "Requires.private:...", but
     instead put them under "Libs:", linking to each dep as -l<.lib file
     name>
    
    This is so that pangocairo.pc and pangooft2.pc can be correctly used by
    items that need to make use of it, such as g-ir-scanner.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783274
    18fb749d