diff options
author | Adam J. Stewart <ajstewart426@gmail.com> | 2020-11-30 09:25:40 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-30 10:25:40 -0500 |
commit | 868dbb24c117d719702a928f1e068508a9120264 (patch) | |
tree | 2c285aa27c5983d596811ace07244378c43490f7 | |
parent | 2072c93dc87c75e6d940a4d9aa41e5228e5acb29 (diff) | |
download | spack-868dbb24c117d719702a928f1e068508a9120264.tar.gz spack-868dbb24c117d719702a928f1e068508a9120264.tar.bz2 spack-868dbb24c117d719702a928f1e068508a9120264.tar.xz spack-868dbb24c117d719702a928f1e068508a9120264.zip |
libQGLViewer: add new package (#20164)
-rw-r--r-- | lib/spack/docs/build_systems/qmakepackage.rst | 13 | ||||
-rw-r--r-- | lib/spack/spack/build_systems/qmake.py | 22 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/libqglviewer/package.py | 25 |
3 files changed, 56 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) diff --git a/var/spack/repos/builtin/packages/libqglviewer/package.py b/var/spack/repos/builtin/packages/libqglviewer/package.py new file mode 100644 index 0000000000..a60ade218a --- /dev/null +++ b/var/spack/repos/builtin/packages/libqglviewer/package.py @@ -0,0 +1,25 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +class Libqglviewer(QMakePackage): + """libQGLViewer is a C++ library based on Qt that eases the creation of + OpenGL 3D viewers.""" + + homepage = "http://libqglviewer.com/" + url = "http://libqglviewer.com/src/libQGLViewer-2.7.2.tar.gz" + git = "https://github.com/GillesDebunne/libQGLViewer.git" + + version('2.7.2', sha256='e2d2799dec5cff74548e951556a1fa06a11d9bcde2ce6593f9c27a17543b7c08') + + # http://libqglviewer.com/installUnix.html + + depends_on('qt+opengl') + depends_on('freeglut', when='^qt@:3.0') + + build_directory = 'QGLViewer' + + def qmake_args(self): + return ['PREFIX=' + self.prefix] |