Import('RTT_ROOT')
Import('rtconfig')

from building import *
import os

CAIRO_VERSION = '1.10.2'
CAIRO_PATH = 'cairo-' + CAIRO_VERSION

if GetDepend('RT_USING_CAIRO') and not os.path.exists(CAIRO_PATH):
    print '================ERROR============================'
    print 'Please get cairo dist and put them under cairo folder'
    print '================================================='
    exit(0)

# source files 
src = Split('''
cairo-analysis-surface.c
cairo-arc.c
cairo-array.c
cairo-atomic.c
cairo-base64-stream.c
cairo-base85-stream.c
cairo-bentley-ottmann-rectangular.c
cairo-bentley-ottmann-rectilinear.c
cairo-bentley-ottmann.c
cairo-botor-scan-converter.c
cairo-boxes.c
cairo-cache.c
cairo-cff-subset.c
cairo-clip.c
cairo-color.c
cairo-composite-rectangles.c
cairo-debug.c
cairo-deflate-stream.c
cairo-device.c
cairo-fixed.c
cairo-font-face-twin-data.c
cairo-font-face-twin.c
cairo-font-face.c
cairo-font-options.c
cairo-freed-pool.c
cairo-freelist.c
cairo-gstate.c
cairo-hash.c
cairo-hull.c
cairo-image-info.c
cairo-image-surface.c
cairo-lzw.c
cairo-matrix.c
cairo-misc.c
cairo-mutex.c
cairo-observer.c
cairo-output-stream.c
cairo-paginated-surface.c
cairo-path-bounds.c
cairo-path-fill.c
cairo-path-fixed.c
cairo-path-in-fill.c
cairo-path-stroke.c
cairo-path.c
cairo-pattern.c
cairo-pen.c
cairo-png.c
cairo-polygon.c
cairo-recording-surface.c
cairo-rectangle.c
cairo-rectangular-scan-converter.c
cairo-region.c
cairo-rtree.c
cairo-scaled-font-subsets.c
cairo-scaled-font.c
cairo-slope.c
cairo-spans.c
cairo-spline.c
cairo-stroke-style.c
cairo-surface-clipper.c
cairo-surface-fallback.c
cairo-surface-offset.c
cairo-surface-snapshot.c
cairo-surface-subsurface.c
cairo-surface-wrapper.c
cairo-surface.c
cairo-system.c
cairo-tor-scan-converter.c
cairo-toy-font-face.c
cairo-traps.c
cairo-truetype-subset.c
cairo-type1-fallback.c
cairo-type1-subset.c
cairo-type3-glyph-surface.c
cairo-unicode.c
cairo-user-font.c
cairo-version.c
cairo-wideint.c
cairo.c
''')

for item in range(len(src)):
    src[item] = CAIRO_PATH + '/src/' + src[item]

CPPPATH = [RTT_ROOT + '/components/external/cairo/' + CAIRO_PATH + '/src', RTT_ROOT + '/components/external/cairo/']
group = DefineGroup('cairo', src, depend = ['RT_USING_CAIRO', 'RT_USING_NEWLIB', 'RTGUI_IMAGE_PNG', 'RT_USING_PTHREADS'], CPPPATH = CPPPATH)

Return('group')
