Skip to content

Commit d603b22

Browse files
committed
Soft-support recent conda-forge builds of cairo.
1 parent ebc21d6 commit d603b22

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

README.rst

+13-9
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,17 @@ The following additional dependencies are required:
218218

219219
- cairo headers and import and dynamic libraries (``cairo.lib`` and
220220
``cairo.dll``) *with FreeType support*. Note that this excludes, in
221-
particular, the Anaconda and conda-forge builds: they do not include
221+
particular, most Anaconda and conda-forge builds: they do not include
222222
FreeType support.
223223

224-
I am in fact not aware of any such build available online, with the exception
225-
of https://github.com/preshing/cairo-windows/releases; however, this specific
226-
build appears to `misrender pdfs`_. Instead, a solution is to get the
227-
headers e.g. from a Linux distribution package, the DLL from Christoph
228-
Gohlke's cairocffi_ build, and generate the import library oneself using
229-
``dumpbin`` and ``lib``.
224+
The currently preferred solution is to get the headers e.g. from a Linux
225+
distribution package, the DLL from Christoph Gohlke's cairocffi_ build, and
226+
generate the import library oneself using ``dumpbin`` and ``lib``.
227+
228+
Alternatively, very recent conda-forge builds (≥1.16.0 build 1005) do
229+
include FreeType support. In order to use them, the include path needs to be
230+
modified as described below. (This is currently intentionally disabled by
231+
default to avoid confusing errors if the cairo build is too old.)
230232

231233
- FreeType headers and import and dynamic libraries (``freetype.lib`` and
232234
``freetype.dll``), which can be retrieved from
@@ -235,7 +237,6 @@ The following additional dependencies are required:
235237

236238
conda install -y freetype
237239

238-
.. _misrender pdfs: https://preshing.com/20170529/heres-a-standalone-cairo-dll-for-windows/#IDComment1047546463
239240
.. _cairocffi: https://www.lfd.uci.edu/~gohlke/pythonlibs/#cairocffi
240241

241242
The (standard) |CL|_ and |LINK|_ environment variables (which always get
@@ -245,14 +246,17 @@ should be set as follows::
245246
set CL=/IC:\path\to\dir\containing\cairo.h /IC:\same\for\ft2build.h
246247
set LINK=/LIBPATH:C:\path\to\dir\containing\cairo.lib /LIBPATH:C:\same\for\freetype.lib
247248

249+
In particular, in order to use a conda-forge cairo (as described above),
250+
``{sys.prefix}\Library\include\cairo`` needs to be added to the include path.
251+
248252
Moreover, we also need to find ``cairo.dll`` and ``freetype.dll`` and copy
249253
them next to ``mplcairo``'s extension module. As the dynamic libraries are
250254
typically found next to import libraries, we search the ``/LIBPATH:`` entries
251255
in the ``LINK`` environment variable and copy the first ``cairo.dll`` and
252256
``freetype.dll`` found there.
253257

254258
The script ``tools/build-windows-wheel.py`` automates the retrieval of the
255-
cairo (assuming that a Gohlke cairocffi is already installed) and FreeType and
259+
cairo (assuming that a Gohlke cairocffi is already installed) and FreeType, and
256260
the wheel build.
257261

258262
.. |CL| replace:: ``CL``

0 commit comments

Comments
 (0)