1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
from distutils.core import setup, Extension
import commands
import sys
def pkgconfig(*packages, **kw):
flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'}
for token in commands.getoutput("pkg-config --libs --cflags %s" % ' '.join(packages)).split():
kw.setdefault(flag_map.get(token[:2]), []).append(token[2:])
return kw
extra_sources = []
if sys.platform in ["linux2"]:
options = pkgconfig("sigc++-2.0 gtkmm-2.4")
options["include_dirs"].append("..")
options["library_dirs"] = ["../.libs"] + options.get("library_dirs", [])
options["libraries"].append("mforms")
extra_sources.append("linux_stubs.cxx")
else:
print "Platform not supported"
sys.exit(1)
setup(name = "mforms",
ext_modules = [Extension("_mforms", ["mforms_wrap.cxx"] + extra_sources, **options)]
)
|