summaryrefslogtreecommitdiffstats
blob: 3893874041ae3d689594e626dd0a4aa45d71f9f3 (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
44
45
import glob, re, os.path

scons_cmd = "python 3rdParty/SCons/scons-2.4.0/script/scons"
scons_dependencies += glob.glob("BuildTools/SCons/**/*.py") + glob.glob("BuildTools/SCons/SCons*") + ["config.py"]

def ninja_post(ninja) :
	# Unit tests
	ninja.build('check', 'run', os.path.join('QA', 'UnitTest', 'checker' + EXE_SUFFIX))

	# Swift binary
	if sys.platform == 'win32' :
		ninja.build(['Swift', 'swift'], 'phony', re.compile('Swift\\\\QtUI\\\\Swift\\\\(.*)'))
	elif sys.platform == 'posix' :
		ninja.build(['Swift', 'swift'], 'phony', 'Swift/QtUI/swift-im')
	else :
		ninja.build(['Swift', 'swift'], 'phony', re.compile('Swift/QtUI/Swift\.app/(.*)'))
	
	# Sluift
	if sys.platform == 'win32' :
		ninja.build(['Sluift', 'sluift'], 'phony', ['Sluift\\exe\\sluift.exe', 'Sluift\\dll\\sluift.dll'])
	elif sys.platform in ['posix', 'darwin'] :
		ninja.build(['Sluift', 'sluift'], 'phony', ['Sluift/exe/sluift', 'Sluift/dll/sluift.so'])

	# Extra rules
	if sys.platform == "darwin" :
		ninja.rule('zip',
			command = 'cd $dir && zip -r $relative_out $relative_in',
			description = 'ZIP $out')

		ninja.rule('package',
			command = 'Swift/Packaging/MacOSX/package.sh $in $template $out $qtdir',
			description = 'PACKAGE $out')


def ninja_custom_command(ninja, command) :
	if sys.platform == "darwin" :
		m = re.match("cd (.*) && zip -r (.*) (.*)", line)
		if m :
			ninja.build(os.path.relpath(m.group(2)), 'zip', os.path.join(m.group(1), m.group(3)), dir = m.group(1), relative_in = m.group(3), relative_out = os.path.relpath(m.group(2), m.group(1))) 
			return True
		m = re.match(".*/MacOSX/package.sh (.*) (.*) (.*) (.*)", line)
		if m :
			ninja.build(m.group(3), 'package', m.group(1), deps = [m.group(2)], qtdir = m.group(4), template = m.group(2))
			return True
	return False