diff options
author | Abderrahim Kitouni <a.kitouni@gmail.com> | 2018-04-12 10:07:01 +0100 |
---|---|---|
committer | Abderrahim Kitouni <a.kitouni@gmail.com> | 2018-04-14 14:53:36 +0100 |
commit | d41940f516498f827967b8e5d311ce6accb88f56 (patch) | |
tree | 43acf4a921fe07fd68a2f13c7c302d62b891a56b | |
parent | d603051e4ac14ccb7413861963eccffd21fcdf34 (diff) | |
download | buildstream-abderrahim/cmake-ninja.tar.gz |
plugins/elements/cmake.yaml: allow using ninja instead of make (#279)abderrahim/cmake-ninja
This uses the build tool mode of cmake to have a single command that can call
either make or ninja.
I've also modified the tests to take the new commands into account
-rw-r--r-- | buildstream/plugins/elements/cmake.yaml | 15 | ||||
-rw-r--r-- | tests/format/variables.py | 4 | ||||
-rw-r--r-- | tests/format/variables/overrides/cmake.bst | 1 |
3 files changed, 12 insertions, 8 deletions
diff --git a/buildstream/plugins/elements/cmake.yaml b/buildstream/plugins/elements/cmake.yaml index 234aa1770..b51727b04 100644 --- a/buildstream/plugins/elements/cmake.yaml +++ b/buildstream/plugins/elements/cmake.yaml @@ -13,6 +13,9 @@ variables: # For backwards compatibility only, do not use. cmake-extra: '' + # The cmake generator to use + generator: Unix Makefiles + cmake-args: | -DCMAKE_INSTALL_PREFIX:PATH="%{prefix}" \ @@ -20,10 +23,10 @@ variables: cmake: | - cmake -B%{build-dir} -H. %{cmake-args} + cmake -B%{build-dir} -H. -G"%{generator}" %{cmake-args} - make: make -C %{build-dir} - make-install: make -j1 -C %{build-dir} DESTDIR="%{install-root}" install + make: cmake --build %{build-dir} -- ${JOBS} + make-install: env DESTDIR="%{install-root}" cmake --build %{build-dir} --target install # Set this if the sources cannot handle parallelization. # @@ -59,11 +62,11 @@ config: # Use max-jobs CPUs for building and enable verbosity environment: - MAKEFLAGS: -j%{max-jobs} + JOBS: -j%{max-jobs} V: 1 -# And dont consider MAKEFLAGS or V as something which may +# And dont consider JOBS or V as something which may # effect build output. environment-nocache: -- MAKEFLAGS +- JOBS - V diff --git a/tests/format/variables.py b/tests/format/variables.py index e4b6297aa..1d34911ea 100644 --- a/tests/format/variables.py +++ b/tests/format/variables.py @@ -18,7 +18,7 @@ DATA_DIR = os.path.join( @pytest.mark.parametrize("target,varname,expected", [ ('autotools.bst', 'make-install', "make -j1 DESTDIR=\"/buildstream-install\" install"), ('cmake.bst', 'cmake', - "cmake -B_builddir -H. -DCMAKE_INSTALL_PREFIX:PATH=\"/usr\" \\\n" + + "cmake -B_builddir -H. -G\"Unix Makefiles\" -DCMAKE_INSTALL_PREFIX:PATH=\"/usr\" \\\n" + "-DCMAKE_INSTALL_LIBDIR=lib "), ('distutils.bst', 'python-install', "python3 setup.py install --prefix \"/usr\" \\\n" + @@ -44,7 +44,7 @@ def test_defaults(cli, datafiles, tmpdir, target, varname, expected): @pytest.mark.parametrize("target,varname,expected", [ ('autotools.bst', 'make-install', "make -j1 DESTDIR=\"/custom/install/root\" install"), ('cmake.bst', 'cmake', - "cmake -B_builddir -H. -DCMAKE_INSTALL_PREFIX:PATH=\"/opt\" \\\n" + + "cmake -B_builddir -H. -G\"Ninja\" -DCMAKE_INSTALL_PREFIX:PATH=\"/opt\" \\\n" + "-DCMAKE_INSTALL_LIBDIR=lib "), ('distutils.bst', 'python-install', "python3 setup.py install --prefix \"/opt\" \\\n" + diff --git a/tests/format/variables/overrides/cmake.bst b/tests/format/variables/overrides/cmake.bst index e7fadc42a..ceea2bb12 100644 --- a/tests/format/variables/overrides/cmake.bst +++ b/tests/format/variables/overrides/cmake.bst @@ -2,5 +2,6 @@ kind: cmake description: Some kinda cmake element variables: + generator: Ninja install-root: /custom/install/root prefix: /opt |