libQGLViewer: add new package (#20164)

This commit is contained in:
Adam J. Stewart
2020-11-30 09:25:40 -06:00
committed by GitHub
parent 2072c93dc8
commit 868dbb24c1
3 changed files with 56 additions and 4 deletions

View File

@@ -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
^^^^^^^^^^^^^^^^^^^^^^

View File

@@ -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 @@ def qmake_args(self):
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)