diff options
author | Adam J. Stewart <ajstewart426@gmail.com> | 2017-08-04 10:46:07 -0500 |
---|---|---|
committer | Gregory Lee <lee218@llnl.gov> | 2017-08-04 08:46:07 -0700 |
commit | 452f382293cffe6fbf134db13cb1420d11e93689 (patch) | |
tree | a8d1bb0ef13d3ed0e1c08f7d5d015eda3748db66 /lib | |
parent | f6c2adc0ada7c569234acf01ee5e3c602e945821 (diff) | |
download | spack-452f382293cffe6fbf134db13cb1420d11e93689.tar.gz spack-452f382293cffe6fbf134db13cb1420d11e93689.tar.bz2 spack-452f382293cffe6fbf134db13cb1420d11e93689.tar.xz spack-452f382293cffe6fbf134db13cb1420d11e93689.zip |
Add a QMakePackage base class (#4925)
* Add a QMakePackage base class
* Fix sqlite linking bug in qt-creator
* Add latest version of qt-creator
* Add latest version of qwt
* Use raw strings for regular expressions
* Increase minimum required version of qt
* Add comment about specific version of sqlite required
* Fixes for latest version of qwt and qt-creator
* Older versions of Qwt only work with older versions of Qt
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/docs/packaging_guide.rst | 5 | ||||
-rw-r--r-- | lib/spack/spack/__init__.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/build_systems/qmake.py | 87 | ||||
-rw-r--r-- | lib/spack/spack/cmd/build.py | 1 | ||||
-rw-r--r-- | lib/spack/spack/cmd/configure.py | 1 | ||||
-rw-r--r-- | lib/spack/spack/cmd/create.py | 38 | ||||
-rw-r--r-- | lib/spack/spack/test/build_system_guess.py | 1 |
7 files changed, 122 insertions, 13 deletions
diff --git a/lib/spack/docs/packaging_guide.rst b/lib/spack/docs/packaging_guide.rst index e4b10cdf53..5d7d69e3d7 100644 --- a/lib/spack/docs/packaging_guide.rst +++ b/lib/spack/docs/packaging_guide.rst @@ -2118,7 +2118,10 @@ The classes that are currently provided by Spack are: | :py:class:`.CMakePackage` | Specialized class for packages | | | built using CMake | +-------------------------------+----------------------------------+ - | :py:class:`.WafPackage` | Specialize class for packages | + | :py:class:`.QMakePackage` | Specialized class for packages | + | | build using QMake | + +-------------------------------+----------------------------------+ + | :py:class:`.WafPackage` | Specialized class for packages | | | built using Waf | +-------------------------------+----------------------------------+ | :py:class:`.RPackage` | Specialized class for | diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py index e77a0c75cd..aca906f2e9 100644 --- a/lib/spack/spack/__init__.py +++ b/lib/spack/spack/__init__.py @@ -172,6 +172,7 @@ from spack.package import Package, run_before, run_after, on_package_attributes from spack.build_systems.makefile import MakefilePackage from spack.build_systems.autotools import AutotoolsPackage from spack.build_systems.cmake import CMakePackage +from spack.build_systems.qmake import QMakePackage from spack.build_systems.waf import WafPackage from spack.build_systems.python import PythonPackage from spack.build_systems.r import RPackage @@ -185,6 +186,7 @@ __all__ += [ 'MakefilePackage', 'AutotoolsPackage', 'CMakePackage', + 'QMakePackage', 'WafPackage', 'PythonPackage', 'RPackage', diff --git a/lib/spack/spack/build_systems/qmake.py b/lib/spack/spack/build_systems/qmake.py new file mode 100644 index 0000000000..c1a3193b7f --- /dev/null +++ b/lib/spack/spack/build_systems/qmake.py @@ -0,0 +1,87 @@ +############################################################################## +# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://github.com/llnl/spack +# Please also see the NOTICE and LICENSE files for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License (as +# published by the Free Software Foundation) version 2.1, February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## + +import inspect + +from spack.directives import depends_on +from spack.package import PackageBase, run_after + + +class QMakePackage(PackageBase): + """Specialized class for packages built using qmake. + + For more information on the qmake build system, see: + http://doc.qt.io/qt-5/qmake-manual.html + + This class provides three phases that can be overridden: + + 1. :py:meth:`~.QMakePackage.qmake` + 2. :py:meth:`~.QMakePackage.build` + 3. :py:meth:`~.QMakePackage.install` + + They all have sensible defaults and for many packages the only thing + necessary will be to override :py:meth:`~.QMakePackage.qmake_args`. + """ + #: Phases of a qmake package + phases = ['qmake', 'build', 'install'] + + #: This attribute is used in UI queries that need to know the build + #: system base class + build_system_class = 'QMakePackage' + + #: Callback names for build-time test + build_time_test_callbacks = ['check'] + + depends_on('qt', type='build') + + def qmake_args(self): + """Produces a list containing all the arguments that must be passed to + qmake + """ + return [] + + def qmake(self, spec, prefix): + """Run ``qmake`` to configure the project and generate a Makefile.""" + inspect.getmodule(self).qmake(*self.qmake_args()) + + def build(self, spec, prefix): + """Make the build targets""" + inspect.getmodule(self).make() + + def install(self, spec, prefix): + """Make the install targets""" + 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') + + run_after('build')(PackageBase._run_default_build_time_test_callbacks) + + # Check that self.prefix is there after installation + run_after('install')(PackageBase.sanity_check_prefix) diff --git a/lib/spack/spack/cmd/build.py b/lib/spack/spack/cmd/build.py index 413b73a08e..8ecaca9c12 100644 --- a/lib/spack/spack/cmd/build.py +++ b/lib/spack/spack/cmd/build.py @@ -34,6 +34,7 @@ level = "long" build_system_to_phase = { AutotoolsPackage: 'build', CMakePackage: 'build', + QMakePackage: 'build', WafPackage: 'build', PythonPackage: 'build', PerlPackage: 'build', diff --git a/lib/spack/spack/cmd/configure.py b/lib/spack/spack/cmd/configure.py index 4b590e6176..562582fe09 100644 --- a/lib/spack/spack/cmd/configure.py +++ b/lib/spack/spack/cmd/configure.py @@ -38,6 +38,7 @@ level = "long" build_system_to_phase = { AutotoolsPackage: 'configure', CMakePackage: 'cmake', + QMakePackage: 'qmake', WafPackage: 'configure', PerlPackage: 'configure', } diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py index 62de3e24e9..239f75b996 100644 --- a/lib/spack/spack/cmd/create.py +++ b/lib/spack/spack/cmd/create.py @@ -193,6 +193,18 @@ class CMakePackageTemplate(PackageTemplate): return args""" +class QMakePackageTemplate(PackageTemplate): + """Provides appropriate overrides for QMake-based packages""" + + base_class_name = 'QMakePackage' + + body = """\ + def qmake_args(self): + # FIXME: If not needed delete this function + args = [] + return args""" + + class SconsPackageTemplate(PackageTemplate): """Provides appropriate overrides for SCons-based packages""" @@ -363,6 +375,7 @@ templates = { 'autotools': AutotoolsPackageTemplate, 'autoreconf': AutoreconfPackageTemplate, 'cmake': CMakePackageTemplate, + 'qmake': QMakePackageTemplate, 'scons': SconsPackageTemplate, 'waf': WafPackageTemplate, 'bazel': BazelPackageTemplate, @@ -426,18 +439,19 @@ class BuildSystemGuesser: # uses. If the regular expression matches a file contained in the # archive, the corresponding build system is assumed. clues = [ - ('/configure$', 'autotools'), - ('/configure.(in|ac)$', 'autoreconf'), - ('/Makefile.am$', 'autoreconf'), - ('/CMakeLists.txt$', 'cmake'), - ('/SConstruct$', 'scons'), - ('/waf$', 'waf'), - ('/setup.py$', 'python'), - ('/NAMESPACE$', 'r'), - ('/WORKSPACE$', 'bazel'), - ('/Build.PL$', 'perlbuild'), - ('/Makefile.PL$', 'perlmake'), - ('/(GNU)?[Mm]akefile$', 'makefile'), + (r'/configure$', 'autotools'), + (r'/configure\.(in|ac)$', 'autoreconf'), + (r'/Makefile\.am$', 'autoreconf'), + (r'/CMakeLists\.txt$', 'cmake'), + (r'/SConstruct$', 'scons'), + (r'/waf$', 'waf'), + (r'/setup\.py$', 'python'), + (r'/NAMESPACE$', 'r'), + (r'/WORKSPACE$', 'bazel'), + (r'/Build\.PL$', 'perlbuild'), + (r'/Makefile\.PL$', 'perlmake'), + (r'/.*\.pro$', 'qmake'), + (r'/(GNU)?[Mm]akefile$', 'makefile'), ] # Peek inside the compressed file. diff --git a/lib/spack/spack/test/build_system_guess.py b/lib/spack/spack/test/build_system_guess.py index 733173e3fc..54431e0020 100644 --- a/lib/spack/spack/test/build_system_guess.py +++ b/lib/spack/spack/test/build_system_guess.py @@ -34,6 +34,7 @@ import spack.stage params=[ ('configure', 'autotools'), ('CMakeLists.txt', 'cmake'), + ('project.pro', 'qmake'), ('SConstruct', 'scons'), ('waf', 'waf'), ('setup.py', 'python'), |