summaryrefslogtreecommitdiffstats
path: root/Mac/Build/genpluginprojects.py
blob: c0022e2831d441934e70646d23c2437ef9a6de00 (plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import mkcwproject
import sys
import os

PROJECTDIR = os.path.join(sys.prefix, ":Mac:Build")
MODULEDIRS = [	# Relative to projectdirs
	"::Modules:%s",
	"::Modules",
	":::Modules",
]

def genpluginproject(module,
		project=None, projectdir=None,
		sources=[], sourcedirs=[],
		libraries=[], extradirs=[]):
	if not project:
		project = module + '.mcp'
	if not projectdir:
		projectdir = PROJECTDIR
	if not sources:
		sources = [module + 'module.c']
	if not sourcedirs:
		for moduledir in MODULEDIRS:
			if '%' in moduledir:
				moduledir = moduledir % module
			fn = os.path.join(projectdir, os.path.join(moduledir, sources[0]))
			if os.path.exists(fn):
				sourcedirs = [moduledir]
				break
		else:
			print "Warning: %s: sourcefile not found: %s"%(module, sources[0])
			sourcedirs = []
	dict = {
		"sysprefix" : sys.prefix,
		"sources" : sources,
		"extrasearchdirs" : sourcedirs + extradirs,
		"libraries": libraries,
	}
	mkcwproject.mkproject(os.path.join(projectdir, project), module, dict)
	
genpluginproject("Cm", libraries=["QuickTimeLib"])
genpluginproject("calldll", sources=["calldll.c"])
genpluginproject("zlib", libraries=["zlib.ppc.Lib"], extradirs=["::::imglibs:zlib"])