Blame README.win32

Packit 324a5c
Building Cairo on Windows
Packit 324a5c
=========================
Packit 324a5c
There are two primary ways to build Cairo on Windows. You can use a
Packit 324a5c
UNIX emulation based setup, such as Cygwin or MSYS, with the
Packit 324a5c
conventional configure script shipped with Cairo releases. In this
Packit 324a5c
configuration, you will build with GCC and (implicitly) libtool. In
Packit 324a5c
the Cygwin case you end up with a DLL that depends on Cygwin and
Packit 324a5c
should be used only from Cygwin applications. In the MSYS case you end
Packit 324a5c
up with a "normal" Win32 DLL that can be used either from GCC- or
Packit 324a5c
Microsoft Visual C++-compiled code. In theory, this technique is no
Packit 324a5c
different than the ordinary build process for the Cairo library. In
Packit 324a5c
practise there are lots of small details that can go wrong.
Packit 324a5c
Packit 324a5c
The second way is to use a GNU-compatible make, but build using
Packit 324a5c
Microsoft's Visual C++ compiler to produce native libraries.  This is
Packit 324a5c
the setup this README.win32 is written for. Also the DLL produced this
Packit 324a5c
way is usable either from GCC- or MSVC-compiled code.
Packit 324a5c
Packit 324a5c
Tools required
Packit 324a5c
==============
Packit 324a5c
You will need GNU make, version 3.80 or later.  Earlier versions or
Packit 324a5c
other modern make implementations may work, but are not guaranteed to.
Packit 324a5c
Packit 324a5c
You will also need Microsoft Visual C++.  Version 7 has been most
Packit 324a5c
heavily tested, but other versions are likely to work fine.
Packit 324a5c
Packit 324a5c
Libraries required
Packit 324a5c
==================
Packit 324a5c
Cairo requires a compatible version of the pixman library.  Full build
Packit 324a5c
instructions are beyond the scope of this document; however, using the
Packit 324a5c
same tools, it should be possible to build pixman simply by entering
Packit 324a5c
the pixman/src directory and typing:
Packit 324a5c
Packit 324a5c
    make -f Makefile.win32 CFG=release
Packit 324a5c
Packit 324a5c
Depending on your feature set, you may also need zlib and libpng.
Packit 324a5c
Packit 324a5c
Building
Packit 324a5c
========
Packit 324a5c
There are a few files that you will need to edit.  First, you must
Packit 324a5c
determine which features will be built.  Edit
Packit 324a5c
build/Makefile.win32.features and set the features as desired.  Note
Packit 324a5c
that most features have external dependencies; specifically,
Packit 324a5c
CAIRO_HAS_PNG_FUNCTIONS requires libpng to be present, and
Packit 324a5c
CAIRO_HAS_PS_SURFACE and CAIRO_HAS_PDF_SURFACE both require zlib.
Packit 324a5c
Packit 324a5c
To ensure that the compiler can find all dependencies, you may need to
Packit 324a5c
edit build/Makefile.win32.common.  In particular, ensure that
Packit 324a5c
PIXMAN_CFLAGS contains a -I parameter pointing to the location of
Packit 324a5c
your pixman header files and that PIXMAN_LIBS points to the actual
Packit 324a5c
location of your pixman-1.lib file.  You may also need to edit the
Packit 324a5c
various occurrences of CAIRO_LIBS to point to other libraries
Packit 324a5c
correctly.  Note also that if you wish to link statically with zlib,
Packit 324a5c
you should replace zdll.lib with zlib.lib.
Packit 324a5c
Packit 324a5c
Finally, from the top Cairo directory, type:
Packit 324a5c
Packit 324a5c
    make -f Makefile.win32 CFG=release
Packit 324a5c
Packit 324a5c
If this command succeeds, you will end up with src/release/cairo.dll.
Packit 324a5c
To successfully use Cairo from your own programs, you will probably
Packit 324a5c
want to move this file to some central location.  You will also
Packit 324a5c
probably want to copy the Cairo header files.  These should be placed
Packit 324a5c
in a cairo subdirectory (for instance, c:/code/common/include/cairo).
Packit 324a5c
The exact set to copy depends on your features and is reported to you
Packit 324a5c
at the end of the build.