aboutsummaryrefslogtreecommitdiffstats
path: root/build_scripts/main.py
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-11-22 09:53:16 +0100
committerCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-11-27 16:43:04 +0000
commitf30e4db5169800c25bf79573f650fc2b08d13046 (patch)
tree8785a2eace90c3d9af7be7743cf1b47bc07895f1 /build_scripts/main.py
parent06b948036932abce31ee23126af9e2c91205248c (diff)
Build scripts: Add support for ninja
ninja will be recommended build tool/CMake generator for Qt due to its speed. Streamline the option parsing code and add it. Adapt the test runner to find the ctest command in the ninja build file. Change-Id: I61dd6fd4fb26a50af21432e10e7da86123240e0f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'build_scripts/main.py')
-rw-r--r--build_scripts/main.py31
1 files changed, 16 insertions, 15 deletions
diff --git a/build_scripts/main.py b/build_scripts/main.py
index ad6cc04a..0fec51a6 100644
--- a/build_scripts/main.py
+++ b/build_scripts/main.py
@@ -201,20 +201,16 @@ if not os.path.exists(OPTION_CMAKE):
print("'{}' does not exist.".format(OPTION_CMAKE))
sys.exit(1)
-if sys.platform == "win32":
- if OPTION_MAKESPEC is None:
- OPTION_MAKESPEC = "msvc"
- if not OPTION_MAKESPEC in ["msvc", "mingw"]:
- print("Invalid option --make-spec. Available values are {}".format(
- ["msvc", "mingw"]))
- sys.exit(1)
-else:
- if OPTION_MAKESPEC is None:
- OPTION_MAKESPEC = "make"
- if not OPTION_MAKESPEC in ["make"]:
- print("Invalid option --make-spec. Available values are {}".format(
- ["make"]))
- sys.exit(1)
+# First element is default
+available_mkspecs = ["msvc", "mingw", "ninja"] if sys.platform == "win32" else ["make", "ninja"]
+
+if OPTION_MAKESPEC is None:
+ OPTION_MAKESPEC = available_mkspecs[0]
+
+if not OPTION_MAKESPEC in available_mkspecs:
+ print('Invalid option --make-spec "{}". Available values are {}'.format(
+ OPTION_MAKESPEC, available_mkspecs))
+ sys.exit(1)
if OPTION_JOBS:
if sys.platform == 'win32' and OPTION_NO_JOM:
@@ -491,6 +487,9 @@ class PysideBuild(_build):
elif OPTION_MAKESPEC == "mingw":
make_name = "mingw32-make"
make_generator = "MinGW Makefiles"
+ elif OPTION_MAKESPEC == "ninja":
+ make_name = "ninja"
+ make_generator = "Ninja"
else:
raise DistutilsSetupError(
"Invalid option --make-spec.")
@@ -1107,7 +1106,9 @@ class PysideBuild(_build):
log.info("Waiting 1 second, to ensure installation is "
"successful...")
time.sleep(1)
- if run_process([self.make_path, "install/fast"]) != 0:
+ # ninja: error: unknown target 'install/fast'
+ target = 'install/fast' if self.make_generator != 'Ninja' else 'install'
+ if run_process([self.make_path, target]) != 0:
raise DistutilsSetupError("Error pseudo installing {}".format(
extension))
else: