[cairo] Another win32 build attempt
Hans Breuer
hans at breuer.org
Fri Aug 5 10:43:18 PDT 2005
On 05.08.2005 18:20, Carl Worth wrote:
> On Sun, 10 Apr 2005 22:03:31 +0100, "Hans Breuer" wrote:
>
>> Being enough annoyed of auto*tools versus hand-written or hand-clicked
>> makefiles I've succesfully tried a different approach with cairo.
>>
>> It is supposed to give you the best of both worlds. Be dynamic where it
>> needs to. But use native tools where it can. The tool is called CMake
>> [1].
>>
>> And the patch (again including some minor build fixes for win32) is
>> here:
>>
>> http://hans.breuer.org/gtk/cairo-2005-04-10-hb.diff
>
>
> Hi Hans,
>
> Sorry for the long delay on this one.
>
> I notice in the patch that packaging/cmake/libcairo.symbols includes and
> uses definitions from cairo-features.h. If using this cmake-based build
> system, how is that file expected to be generated?
>
With a simple rule in cairo/src/CMakeLists.txt. [The only file which
apparently *must* be in the source directory.]
Look for CONFIGURE_FILE. It takes all the previously defined variables
and does the appropriate replacements. My current CMakeLists.txt is
attached.
> Earlier today I committed a patch to cairo from John Ehresman that should
> remove some of the stdint.h and vsnprintf hoops your patch had to jump
> through.
>
My latest 'hoops' at least did not make any source modifications
necessary, from CMakeLists.txt :
IF (WIN32)
# not win32 but msvc (could also use CMAKE_COMPILER_IS_GNUCC?)
IF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/stdint.h.msvc
${CMAKE_BINARY_DIR}/stdint.h COPYONLY)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
ADD_DEFINITIONS(-DHAVE_STDINT_H
-DHAVE_UINT64_T=1
-DM_PI=3.1415926535897932384626433832795028841971693993751
-Dsnprintf=_snprintf)
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
LINK_LIBRARIES(
${CMAKE_SOURCE_DIR}/../../libpixman/packaging/cmake/release/libpixman.lib
oldnames.lib
)
ENDIF(WIN32)
>
>> It would be a pleasant suprise if this one can be included with cairo
>> cvs. And YES I am volunteering to maintain it.
>
>
> I'm still unsure about if and how to provide multiple build systems within
> the cairo source tree. I feel a one vs. infinity[*] pull here,
IMO this rule doesn't apply very well here, or is having one (instead
of no) build system an exception instead of a necessity?
> and I'm much more inclined to have one build system in the tree rather
> than an arbitrary number.
>
Which may finally cause an infinite number of different cairo source
distribitutions. If I ever start my own it'll probably include my
wmf based cairo backend as well. BTW: how does your 0,1,infinity
rule apply there? [1]
> Meanwhile, I notice that your patch also has an unrelated change for the
> win32 backend. It would really help to have things like that presented in
> separate patches/messages so they don't get lost.
>
Something along the line of :
https://bugs.freedesktop.org/show_bug.cgi?id=3926
https://bugs.freedesktop.org/show_bug.cgi?id=3927
Sure I can split my patch into smaller chuncks. And for critical issues
I always did, e.g. [2]
But doing so is extra work on my side and often seems to be wasted
time - cause every patch will be finally outdated if it is just
pending long enough ...
Regards,
Hans
[1] http://lists.freedesktop.org/archives/cairo/2005-February/002928.html
[2] http://lists.freedesktop.org/archives/cairo/2005-February/002932.html
-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to
get along without it. -- Dilbert
-------------- next part --------------
PROJECT(cairo)
# base sources only depending on libpixman
SET(CAIRO_SOURCE
cairo-arc.c cairo-array.c cairo-cache.c cairo-color.c cairo-fixed.c
cairo-font.c cairo-font-options.c
cairo-gstate.c cairo-hull.c cairo-image-surface.c cairo-matrix.c
cairo-meta-surface.c cairo-output-stream.c
cairo-path-bounds.c cairo-path-data.c
cairo-path-fill.c cairo-path-stroke.c cairo-path.c cairo-pattern.c
cairo-pen.c cairo-polygon.c cairo-slope.c cairo-spline.c
cairo-surface.c cairo-traps.c cairo-unicode.c cairo-wideint.c cairo.c)
IF(APPLE)
SET(CAIRO_SOURCE ${CAIRO_SOURCE} cairo-atsui-font.c cairo-quartz-surface.c)
SET(ATSUI_FONT_FEATURE "#define CAIRO_HAS_ATSUI_FONT 1")
SET(QUARTZ_SURFACE_FEATURE "#define CAIRO_HAS_QUARTZ_SURFACE 1")
ELSE(APPLE)
SET(ATSUI_FONT_FEATURE "#define CAIRO_HAS_NO_ATSUI_FONT 1")
SET(QUARTZ_SURFACE_FEATURE "#define CAIRO_HAS_NO_QUARTZ_SURFACE 1")
ENDIF(APPLE)
# at least 2.0.6 does not provide this
INCLUDE( ${CMAKE_BINARY_DIR}/FindFT2.cmake OPTIONAL )
INCLUDE( ${CMAKE_BINARY_DIR}/FindFontconfig.cmake OPTIONAL )
IF(FT2_FOUND AND FONTCONFIG_FOUND)
INCLUDE_DIRECTORIES(${FT2_INCLUDE_DIR})
SET(CAIRO_SOURCE ${CAIRO_SOURCE} cairo-ft.h cairo-ft-font.c cairo-font-subset.c)
SET(FT_FONT_FEATURE "#define CAIRO_HAS_FT_FONT 1")
ELSE(FT2_FOUND AND FONTCONFIG_FOUND)
SET(FT_FONT_FEATURE "#define CAIRO_HAS_NO_FT_FONT 1")
ENDIF(FT2_FOUND AND FONTCONFIG_FOUND)
IF(GLITZ_FOUND)
SET(CAIRO_SOURCE ${CAIRO_SOURCE} cairo-glitz-surface.c)
SET(GLITZ_SURFACE_FEATURE "#define CAIRO_HAS_GLITZ_SURFACE 1")
ELSE(GLITZ_FOUND)
SET(GLITZ_SURFACE_FEATURE "#define CAIRO_HAS_NO_GLITZ_SURFACE 1")
ENDIF(GLITZ_FOUND)
INCLUDE( ${CMAKE_ROOT}/Modules/FindPNG.cmake )
IF(PNG_FOUND)
ADD_DEFINITIONS(${PNG_DEFINITIONS})
INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR})
SET(CAIRO_SOURCE ${CAIRO_SOURCE} cairo-png.c)
SET(PNG_FUNCTIONS_FEATURE "#define CAIRO_HAS_PNG_FUNCTIONS 1")
ELSE(PNG_FOUND)
SET(PNG_FUNCTIONS_FEATURE "#define CAIRO_HAS_NO_PNG_FUNCTIONS 1")
ENDIF(PNG_FOUND)
INCLUDE( ${CMAKE_ROOT}/Modules/FindX11.cmake )
IF(X11_FOUND)
SET(CAIRO_SOURCE ${CAIRO_SOURCE} cairo-xlib-surface.c)
SET(XLIB_SURFACE_FEATURE "#define CAIRO_HAS_XLIB_SURFACE 1")
ELSE(X11_FOUND)
SET(XLIB_SURFACE_FEATURE "#define CAIRO_HAS_NO_XLIB_SURFACE 1")
ENDIF(X11_FOUND)
IF(XCB_FOUND)
SET(CAIRO_SOURCE ${CAIRO_SOURCE} cairo-xcb-surface.c)
SET(XCB_SURFACE_FEATURE "#define CAIRO_HAS_XCB_SURFACE 1")
ELSE(XCB_FOUND)
SET(XCB_SURFACE_FEATURE "#define CAIRO_HAS_NO_XCB_SURFACE 1")
ENDIF(XCB_FOUND)
IF(WIN32)
SET(CAIRO_SOURCE ${CAIRO_SOURCE}
cairo-win32-font.c cairo-win32-surface.c
${CMAKE_BINARY_DIR}/libcairo.def)
SET(WIN32_SURFACE_FEATURE "#define CAIRO_HAS_WIN32_SURFACE 1")
SET(WIN32_FONT_FEATURE "#define CAIRO_HAS_WIN32_FONT 1")
ELSE(WIN32)
SET(WIN32_SURFACE_FEATURE "#define CAIRO_HAS_NO_WIN32_SURFACE 1")
SET(WIN32_FONT_FEATURE "#define CAIRO_HAS_NO_WIN32_FONT 1")
ENDIF(WIN32)
# this limitation is not nice (should work with win32 font backend)
INCLUDE( ${CMAKE_ROOT}/Modules/FindZLIB.cmake )
IF(ZLIB_FOUND AND FT2_FOUND AND FONTCONFIG_FOUND)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${FT2_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${FONTCONFIG_INCLUDE_DIR})
SET(CAIRO_SOURCE ${CAIRO_SOURCE} cairo-pdf-surface.c)
SET(PDF_SURFACE_FEATURE "#define CAIRO_HAS_PDF_SURFACE 1")
SET(CAIRO_SOURCE ${CAIRO_SOURCE} cairo-ps-surface.c)
SET(PS_SURFACE_FEATURE "#define CAIRO_HAS_PS_SURFACE 1")
ELSE(ZLIB_FOUND AND FT2_FOUND AND FONTCONFIG_FOUND)
IF(WIN32 AND ZLIB_FOUND)
SET(CAIRO_SOURCE ${CAIRO_SOURCE} cairo-win32-font-subset.c)
# some new ifdefs in the code
SET(CAIRO_SOURCE ${CAIRO_SOURCE} cairo-pdf-surface.c)
SET(PDF_SURFACE_FEATURE "#define CAIRO_HAS_PDF_SURFACE 1")
SET(CAIRO_SOURCE ${CAIRO_SOURCE} cairo-ps-surface.c)
SET(PS_SURFACE_FEATURE "#define CAIRO_HAS_PS_SURFACE 1")
ELSE(WIN32 AND ZLIB_FOUND)
SET(PDF_SURFACE_FEATURE "#define CAIRO_HAS_NO_PDF_SURFACE 1")
SET(PS_SURFACE_FEATURE "#define CAIRO_HAS_NO_PS_SURFACE 1")
ENDIF(WIN32 AND ZLIB_FOUND)
ENDIF(ZLIB_FOUND AND FT2_FOUND AND FONTCONFIG_FOUND)
IF (WIN32)
# not win32 but msvc (could also use CMAKE_COMPILER_IS_GNUCC?)
IF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/stdint.h.msvc ${CMAKE_BINARY_DIR}/stdint.h COPYONLY)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
ADD_DEFINITIONS(-DHAVE_STDINT_H
-DHAVE_UINT64_T=1
-DM_PI=3.1415926535897932384626433832795028841971693993751
-Dsnprintf=_snprintf)
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
LINK_LIBRARIES(
${CMAKE_SOURCE_DIR}/../../libpixman/packaging/cmake/release/libpixman.lib oldnames.lib
)
ENDIF(WIN32)
# could make this selectable by user
SET(SANITY_CHECKING_FEATURE CAIRO_NO_SANITY_CHECKING)
# replaces all the variables @*_FEATURE@ above
# FIXME: how to get rid of result being read-only? http://www.cmake.org/Bug/bug.php?op=show&bugid=1213
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cairo-features.h.in ${CMAKE_SOURCE_DIR}/cairo-features.h IMMEDIATE)
# use that to produce the export definitions file
IF(WIN32)
ADD_CUSTOM_COMMAND(OUTPUT libcairo.def
COMMAND cl
ARGS /I${CMAKE_SOURCE_DIR} /EP libcairo.symbols > libcairo.def
DEPENDS ${CMAKE_BINARY_DIR}/libcairo.symbols)
#SET(EXTRA_LIBRARIES, ...)
ENDIF(WIN32)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../../libpixman/src ${CMAKE_SOURCE_DIR})
LINK_LIBRARIES(
${FT2_LIBRARIES}
${FONTCONFIG_LIBRARIES}
${PNG_LIBRARIES}
${XLIB_LIBRARIES}
${XLIB_LIBRARIES}
${ZLIB_LIBRARIES}
)
ADD_LIBRARY(libcairo SHARED ${CAIRO_SOURCE})
More information about the cairo
mailing list