summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2020-11-30 09:25:40 -0600
committerGitHub <noreply@github.com>2020-11-30 10:25:40 -0500
commit868dbb24c117d719702a928f1e068508a9120264 (patch)
tree2c285aa27c5983d596811ace07244378c43490f7 /lib
parent2072c93dc87c75e6d940a4d9aa41e5228e5acb29 (diff)
downloadspack-868dbb24c117d719702a928f1e068508a9120264.tar.gz
spack-868dbb24c117d719702a928f1e068508a9120264.tar.bz2
spack-868dbb24c117d719702a928f1e068508a9120264.tar.xz
spack-868dbb24c117d719702a928f1e068508a9120264.zip
libQGLViewer: add new package (#20164)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/docs/build_systems/qmakepackage.rst13
-rw-r--r--lib/spack/spack/build_systems/qmake.py22
2 files changed, 31 insertions, 4 deletions
diff --git a/lib/spack/docs/build_systems/qmakepackage.rst b/lib/spack/docs/build_systems/qmakepackage.rst
index 81d0f7f798..79322382ac 100644
--- a/lib/spack/docs/build_systems/qmakepackage.rst
+++ b/lib/spack/docs/build_systems/qmakepackage.rst
@@ -108,6 +108,19 @@ override the ``qmake_args`` method like so:
This method can be used to pass flags as well as variables.
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+``*.pro`` file in a sub-directory
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+If the ``*.pro`` file used to tell QMake how to build the package is
+found in a sub-directory, you can tell Spack to run all phases in this
+sub-directory by adding the following to the package:
+
+.. code-block:: python
+
+ build_directory = 'src'
+
+
^^^^^^^^^^^^^^^^^^^^^^
External documentation
^^^^^^^^^^^^^^^^^^^^^^
diff --git a/lib/spack/spack/build_systems/qmake.py b/lib/spack/spack/build_systems/qmake.py
index 22914d4d3a..f5abb218d9 100644
--- a/lib/spack/spack/build_systems/qmake.py
+++ b/lib/spack/spack/build_systems/qmake.py
@@ -6,6 +6,7 @@
import inspect
+from llnl.util.filesystem import working_dir
from spack.directives import depends_on
from spack.package import PackageBase, run_after
@@ -37,6 +38,11 @@ class QMakePackage(PackageBase):
depends_on('qt', type='build')
+ @property
+ def build_directory(self):
+ """The directory containing the ``*.pro`` file."""
+ return self.stage.source_path
+
def qmake_args(self):
"""Produces a list containing all the arguments that must be passed to
qmake
@@ -45,22 +51,30 @@ class QMakePackage(PackageBase):
def qmake(self, spec, prefix):
"""Run ``qmake`` to configure the project and generate a Makefile."""
- inspect.getmodule(self).qmake(*self.qmake_args())
+
+ with working_dir(self.build_directory):
+ inspect.getmodule(self).qmake(*self.qmake_args())
def build(self, spec, prefix):
"""Make the build targets"""
- inspect.getmodule(self).make()
+
+ with working_dir(self.build_directory):
+ inspect.getmodule(self).make()
def install(self, spec, prefix):
"""Make the install targets"""
- inspect.getmodule(self).make('install')
+
+ with working_dir(self.build_directory):
+ inspect.getmodule(self).make('install')
# Tests
def check(self):
"""Searches the Makefile for a ``check:`` target and runs it if found.
"""
- self._if_make_target_execute('check')
+
+ with working_dir(self.build_directory):
+ self._if_make_target_execute('check')
run_after('build')(PackageBase._run_default_build_time_test_callbacks)