view src/SConscript @ 5:f1194791e5e1

pkg-config is now used to dynamically fetch required cairo paths as necessary.
author Atul Varma <varmaa@toolness.com>
date Sun, 24 Feb 2008 09:30:58 -0600
parents 911cb701a42e
children d8bb1adf3688
line wrap: on
line source

# ----------------------------------------------------------------------------
#
#   enso_osx.graphics SConscript
#
# ----------------------------------------------------------------------------

# ----------------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------------

Import( "env" )

import os
import sys
import subprocess


# ----------------------------------------------------------------------------
# Library Definitions
# ----------------------------------------------------------------------------

env = env.Copy()


# ----------------------------------------------------------------------------
# Build Actions
# ----------------------------------------------------------------------------

def getOutput( params ):
    popen = subprocess.Popen( params,
                              stdout=subprocess.PIPE,
                              stderr=subprocess.PIPE )
    output, errors = popen.communicate()
    if popen.returncode != 0:
        sys.stderr.write( "Running '%s' failed.\n" % " ".join(params) )
        sys.stderr.write( "Output was:\n%s\n(end of output)\n" % errors )
        raise SystemError()
    return output

cairoLibFlags = getOutput( ["pkg-config", "cairo", "--libs"] )
cairoIncludeFlags = getOutput( ["pkg-config", "cairo", "--cflags"] )

env.Append(
    CPPPATH=[os.path.join( sys.prefix, "include/pycairo" )],
    CCFLAGS=cairoIncludeFlags.split(),
    LINKFLAGS=cairoLibFlags,
    LIBS=["python", "cairo"],
    FRAMEWORKS=["AppKit"],
    )

osXQuartzCairoBridge = env.LoadableModule(
    source = ["quartz_cairo_bridge.m"],
    target = ["quartz_cairo_bridge.so"],
    )

env.Install( "#enso_osx/graphics", osXQuartzCairoBridge )