[jhbuild] cmake: add cmakedir attribute
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild] cmake: add cmakedir attribute
- Date: Fri, 5 May 2017 15:20:37 +0000 (UTC)
commit dcca0fc7ca9262e368d8809591cc063a80fceaa0
Author: Ignacio Casal Quinteiro <qignacio amazon com>
Date: Fri May 5 17:17:02 2017 +0200
cmake: add cmakedir attribute
This allows to specify the subdir where to look for the CMakeList.txt
file in relation the source directory.
doc/C/index.docbook | 7 ++++++-
jhbuild/modtypes/cmake.py | 9 +++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/doc/C/index.docbook b/doc/C/index.docbook
index 47cc184..8c21f9d 100644
--- a/doc/C/index.docbook
+++ b/doc/C/index.docbook
@@ -2987,7 +2987,8 @@ Optional packages: (JHBuild will build the missing packages)
<programlisting>
<cmake id="<replaceable>modulename</replaceable>"
- [ skip-install="<replaceable>skip-install</replaceable>" ]>
+ [ skip-install="<replaceable>skip-install</replaceable>" ]
+ [ cmakedir="<replaceable>cmakedir</replaceable>" ]>
<branch [ ... ] >
[...]
</branch>
@@ -3002,6 +3003,10 @@ Optional packages: (JHBuild will build the missing packages)
</after>
</cmake>
</programlisting>
+
+ <para>The <sgmltag class="attribute">cmakedir</sgmltag> attribute
+ specifies the subdirectory where cmake will run in relation to srcdir.
+ </para>
</section>
<section id="moduleset-syntax-defs-meson">
diff --git a/jhbuild/modtypes/cmake.py b/jhbuild/modtypes/cmake.py
index 372cb45..c41d84b 100644
--- a/jhbuild/modtypes/cmake.py
+++ b/jhbuild/modtypes/cmake.py
@@ -51,6 +51,7 @@ class CMakeModule(MakeModule, DownloadableModule):
self.force_non_srcdir_builds = False
self.supports_install_destdir = True
self.use_ninja = True
+ self.cmakedir = None
def ensure_ninja_binary(self):
for f in ['ninja', 'ninja-build']:
@@ -111,7 +112,8 @@ class CMakeModule(MakeModule, DownloadableModule):
# and "MinGW Makefiles" could also work (each is a bit different).
if os.name == 'nt' and os.getenv("MSYSCON") and '-G' not in cmakeargs:
baseargs += ' -G "MSYS Makefiles"'
- cmd = 'cmake %s %s %s' % (baseargs, cmakeargs, srcdir)
+ cmakedir = os.path.join(srcdir, self.cmakedir) if self.cmakedir else srcdir
+ cmd = 'cmake %s %s %s' % (baseargs, cmakeargs, cmakedir)
buildscript.execute(cmd, cwd = builddir, extra_env = self.extra_env)
do_configure.depends = [PHASE_CHECKOUT]
do_configure.error_phases = [PHASE_FORCE_CHECKOUT]
@@ -167,7 +169,8 @@ class CMakeModule(MakeModule, DownloadableModule):
def xml_tag_and_attrs(self):
return 'cmake', [('id', 'name', None),
('skip-install', 'skip_install_phase', False),
- ('use-ninja', 'use_ninja', True)]
+ ('use-ninja', 'use_ninja', True),
+ ('cmakedir', None)]
def parse_cmake(node, config, uri, repositories, default_repo):
@@ -194,6 +197,8 @@ def parse_cmake(node, config, uri, repositories, default_repo):
use_ninja = node.getAttribute('use-ninja')
if use_ninja.lower() in ('false', 'no'):
instance.use_ninja = False
+ if node.hasAttribute('cmakedir'):
+ instance.cmakedir = node.getAttribute('cmakedir')
return instance
register_module_type('cmake', parse_cmake)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]