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