summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.scons2ninja.conf25
-rwxr-xr-xBuildTools/scons2ninja.py14
2 files changed, 37 insertions, 2 deletions
diff --git a/.scons2ninja.conf b/.scons2ninja.conf
index 9ea1c57..0ad2ef4 100644
--- a/.scons2ninja.conf
+++ b/.scons2ninja.conf
@@ -1,4 +1,4 @@
-import glob
+import glob, re, os.path
scons_cmd = "python 3rdParty/SCons/scons.py"
scons_dependencies += glob.glob("BuildTools/SCons/**/*.py") + glob.glob("BuildTools/SCons/SCons*") + ["config.py"]
@@ -20,3 +20,26 @@ def ninja_post(ninja) :
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
diff --git a/BuildTools/scons2ninja.py b/BuildTools/scons2ninja.py
index 98b3518..4a7631a 100755
--- a/BuildTools/scons2ninja.py
+++ b/BuildTools/scons2ninja.py
@@ -221,6 +221,9 @@ ninja_post = []
scons_cmd = "scons"
scons_dependencies = ['SConstruct'] + rglob('SConscript')
+def ninja_custom_command(ninja, line) :
+ return False
+
CONFIGURATION_FILE = '.scons2ninja.conf'
execfile(CONFIGURATION_FILE)
@@ -320,6 +323,10 @@ ninja.rule('ibtool',
command = '$ibtool $ibtoolflags --compile $out $in',
description = 'IBTOOL $out')
+ninja.rule('dsymutil',
+ command = '$dsymutil $dsymutilflags -o $out $in',
+ description = 'DSYMUTIL $out')
+
ninja.rule('generator',
command = "python " + SCRIPT + " ${scons_args}",
depfile = ".scons2ninja.deps",
@@ -559,7 +566,12 @@ for line in build_lines :
files, flags = extract_non_flags(flags)
ninja.build(out, 'ibtool', files, ibtoolflags = flags)
- else :
+ elif tool == 'dsymutil':
+ out, flags = extract_binary_flag("-o", flags)
+ files, flags = extract_non_flags(flags)
+ ninja.build(out, 'dsymutil', files, dsymutilflags = flags)
+
+ elif not ninja_custom_command(ninja, line) :
raise Exception("Unknown tool: '" + line + "'")