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