[!11] Add dune-testtools to the repository
Merge branch 'feature/dune-testtools' into 'master' ref:spack/dune-spack\> This module is special as it works with the Dune virtualenv. See merge request [spack/dune-spack!11] [spack/dune-spack!11]: gitlab.dune-project.org/spack/dune-spack/merge_requests/11
This commit is contained in:
commit
2208a7ed92
|
@ -0,0 +1,28 @@
|
|||
diff --git a/cmake/scripts/CMakeLists.txt b/cmake/scripts/CMakeLists.txt
|
||||
index a59060b8..0d8587f3 100644
|
||||
--- a/cmake/scripts/CMakeLists.txt
|
||||
+++ b/cmake/scripts/CMakeLists.txt
|
||||
@@ -1,15 +1,21 @@
|
||||
+# Install non-executable scripts
|
||||
install(FILES
|
||||
conf.py.in
|
||||
CreateDoxyFile.cmake
|
||||
envdetect.py
|
||||
- extract_cmake_data.py
|
||||
FinalizeHeadercheck.cmake
|
||||
index.rst.in
|
||||
InstallFile.cmake
|
||||
main77.cc.in
|
||||
module_library.cc.in
|
||||
pyversion.py
|
||||
- run-in-dune-env.sh.in
|
||||
RunDoxygen.cmake
|
||||
sphinx_cmake_dune.py
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/dune/cmake/scripts)
|
||||
+
|
||||
+# Install executable programs
|
||||
+install(PROGRAMS
|
||||
+ extract_cmake_data.py
|
||||
+ run-in-dune-env.sh.in
|
||||
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/dune/cmake/scripts
|
||||
+)
|
|
@ -73,6 +73,7 @@ class Dune(CMakePackage):
|
|||
variant('istl', default=True, description='Build with dune-istl module')
|
||||
variant('localfunctions', default=True, description='Build with dune-localfunctions module')
|
||||
variant('spgrid', default=False, description='Build with dune-spgrid module')
|
||||
variant('testtools', default=False, description='Build with dune-testtools module')
|
||||
variant('typetree', default=False, description='Build with dune-typetree module')
|
||||
variant('uggrid', default=False, description='Build with dune-uggrid module')
|
||||
|
||||
|
@ -145,6 +146,13 @@ class Dune(CMakePackage):
|
|||
when='@%s+spgrid' % vers,
|
||||
)
|
||||
|
||||
resource(
|
||||
name='dune-testtools',
|
||||
git='https://gitlab.dune-project.org/quality/dune-testtools.git',
|
||||
branch=branch,
|
||||
when='@%s+testtools' % vers,
|
||||
)
|
||||
|
||||
resource(
|
||||
name='dune-python',
|
||||
git='https://gitlab.dune-project.org/staging/dune-python.git',
|
||||
|
@ -153,16 +161,18 @@ class Dune(CMakePackage):
|
|||
)
|
||||
|
||||
# Dependencies between modules
|
||||
module_dependencies={"dune-common":[]}
|
||||
module_dependencies["dune-geometry"]=["dune-common"]
|
||||
module_dependencies["dune-grid"]=["dune-common","dune-geometry"]
|
||||
module_dependencies["dune-uggrid"]=["dune-common"]
|
||||
module_dependencies["dune-istl"]=["dune-common"]
|
||||
module_dependencies["dune-localfunctions"]=["dune-common","dune-geometry"]
|
||||
module_dependencies["dune-functions"]=["dune-grid","dune-typetree","dune-localfunctions","dune-istl"]
|
||||
module_dependencies["dune-typetree"]=["dune-common"]
|
||||
module_dependencies["dune-python"]=[]
|
||||
module_dependencies["dune-alugrid"]=["dune-grid","dune-geometry","dune-common"]
|
||||
module_dependencies = {}
|
||||
module_dependencies["dune-alugrid"] = ["dune-grid", "dune-geometry", "dune-common"]
|
||||
module_dependencies["dune-common"] = []
|
||||
module_dependencies["dune-functions"] = ["dune-grid", "dune-typetree", "dune-localfunctions", "dune-istl"]
|
||||
module_dependencies["dune-geometry"] = ["dune-common"]
|
||||
module_dependencies["dune-grid"] = ["dune-common", "dune-geometry"]
|
||||
module_dependencies["dune-istl"] = ["dune-common"]
|
||||
module_dependencies["dune-localfunctions"] = ["dune-common", "dune-geometry"]
|
||||
module_dependencies["dune-python"] = []
|
||||
module_dependencies["dune-testtools"] = ["dune-common"]
|
||||
module_dependencies["dune-typetree"] = ["dune-common"]
|
||||
module_dependencies["dune-uggrid"] = ["dune-common"]
|
||||
|
||||
extends('python')
|
||||
python_components = [ 'dune' ]
|
||||
|
@ -180,12 +190,14 @@ class Dune(CMakePackage):
|
|||
depends_on('mpi')
|
||||
depends_on('parmetis', when='+parmetis')
|
||||
depends_on('pkg-config', type='build')
|
||||
depends_on('python@3.0:', type=('build', 'run'), when='+python')
|
||||
depends_on('python@3.0:', type=('build', 'run'))
|
||||
depends_on('py-setuptools', type='build', when='+python')
|
||||
depends_on('py-numpy', type=('build', 'run'), when='+python')
|
||||
depends_on('py-pip', type=('build', 'run'), when='+python')
|
||||
depends_on('py-pip', type=('build', 'run'), when='+testtools')
|
||||
depends_on('py-sphinx', type=('build', 'run'), when='+doc')
|
||||
depends_on('py-wheel', type='build', when='+python')
|
||||
depends_on('py-wheel', type='build', when='+testtools')
|
||||
depends_on('scotch+mpi', when='+ptscotch')
|
||||
depends_on('sionlib', when='+sionlib')
|
||||
depends_on('suite-sparse', when='+suitesparse')
|
||||
|
@ -194,6 +206,10 @@ class Dune(CMakePackage):
|
|||
depends_on('zlib', when='+zlib')
|
||||
depends_on('zoltan', when='+zoltan')
|
||||
|
||||
# Apply patches
|
||||
patch('executable_scripts.patch')
|
||||
patch('virtualenv_from_envvariable.patch', when='+testtools')
|
||||
|
||||
def setup_build_environment(self, env):
|
||||
# We reset the DUNE_CONTROL_PATH here because any entries in this
|
||||
# path that contain Dune modules will break the Spack build process.
|
||||
|
@ -210,6 +226,11 @@ class Dune(CMakePackage):
|
|||
if '+python' in self.spec:
|
||||
env.set('DUNE_PY_DIR', self.prefix)
|
||||
|
||||
# For those modules that typically work with the Dune Virtualenv,
|
||||
# we export the location of the virtualenv as an environment variable.
|
||||
if '+testtools' in self.spec:
|
||||
env.set('DUNE_PYTHON_VIRTUALENV_PATH', join_path(self.prefix, 'dune-python-env'))
|
||||
|
||||
def cmake_args(self):
|
||||
"""Populate cmake arguments."""
|
||||
spec = self.spec
|
||||
|
@ -226,23 +247,29 @@ class Dune(CMakePackage):
|
|||
cmake_args = [
|
||||
'-DBUILD_SHARED_LIBS:BOOL=%s' % variant_bool('+shared'),
|
||||
'-DDUNE_GRID_GRIDTYPE_SELECTOR:BOOL=ON',
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_BLAS=%s' % nvariant_bool('+blas'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=%s' % nvariant_bool('+doc'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_GMP=%s' % nvariant_bool('+gmp'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_LAPACK=%s' % nvariant_bool('+lapack'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_LATEX=%s' % nvariant_bool('+doc'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_METIS=%s' % nvariant_bool('+metis'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_ParMETIS=%s' % nvariant_bool('+parmetis'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_PTScotch=%s' % nvariant_bool('+ptscotch'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_SIONLib=%s' % nvariant_bool('+sionlib'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_SuiteSparse=%s' % nvariant_bool('+suitesparse'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_SuperLU=%s' % nvariant_bool('+superlu'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_BLAS:BOOL=%s' % nvariant_bool('+blas'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_Doxygen:BOOL=%s' % nvariant_bool('+doc'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_GMP:BOOL=%s' % nvariant_bool('+gmp'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_LAPACK:BOOL=%s' % nvariant_bool('+lapack'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_LATEX:BOOL=%s' % nvariant_bool('+doc'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_METIS:BOOL=%s' % nvariant_bool('+metis'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_ParMETIS:BOOL=%s' % nvariant_bool('+parmetis'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_PTScotch:BOOL=%s' % nvariant_bool('+ptscotch'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_SIONLib:BOOL=%s' % nvariant_bool('+sionlib'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_SuiteSparse:BOOL=%s' % nvariant_bool('+suitesparse'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_SuperLU:BOOL=%s' % nvariant_bool('+superlu'),
|
||||
# '-DCMAKE_DISABLE_FIND_PACKAGE_TBB=%s' % nvariant_bool('+tbb'), Disabled until upstream fix of dune-common#205.
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_VC=%s' % nvariant_bool('+vc'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_ZLIB=%s' % nvariant_bool('+zlib'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_ZOLTAN=%s' % nvariant_bool('+zoltan'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_VC:BOOL=%s' % nvariant_bool('+vc'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_ZLIB:BOOL=%s' % nvariant_bool('+zlib'),
|
||||
'-DCMAKE_DISABLE_FIND_PACKAGE_ZOLTAN:BOOL=%s' % nvariant_bool('+zoltan'),
|
||||
]
|
||||
|
||||
if '+testtools' in spec or '+codegen' in spec:
|
||||
cmake_args.append('-DDUNE_PYTHON_VIRTUALENV_SETUP:BOOL=ON')
|
||||
cmake_args.append('-DDUNE_PYTHON_ALLOW_GET_PIP:BOOL=ON')
|
||||
cmake_args.append('-DDUNE_PYTHON_VIRTUALENV_PATH:STRING="%s"' % join_path(self.prefix, 'dune-python-env'))
|
||||
cmake_args.append('-DDUNE_PYTHON_INSTALL_LOCATION:STRING="system"')
|
||||
|
||||
if '+python' in spec:
|
||||
if '@2.7' not in spec:
|
||||
cmake_args.append('-DDUNE_ENABLE_PYTHONBINDINGS:BOOL=TRUE')
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
diff --git a/cmake/modules/DunePythonCommonMacros.cmake b/cmake/modules/DunePythonCommonMacros.cmake
|
||||
index 6f8ff307..93ea3e9c 100644
|
||||
--- a/cmake/modules/DunePythonCommonMacros.cmake
|
||||
+++ b/cmake/modules/DunePythonCommonMacros.cmake
|
||||
@@ -149,6 +149,10 @@ function(dune_python_require_virtualenv_setup)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
+if (NOT "$ENV{DUNE_PYTHON_VIRTUALENV_PATH}" STREQUAL "")
|
||||
+ set(DUNE_PYTHON_VIRTUALENV_SETUP 1)
|
||||
+endif()
|
||||
+
|
||||
# If requested, switch into DunePythonVirtualenv.cmake and setup the virtualenv.
|
||||
if(DUNE_PYTHON_VIRTUALENV_SETUP)
|
||||
include(DunePythonVirtualenv)
|
||||
diff --git a/cmake/modules/DunePythonVirtualenv.cmake b/cmake/modules/DunePythonVirtualenv.cmake
|
||||
index 8a09676f..96cb5954 100644
|
||||
--- a/cmake/modules/DunePythonVirtualenv.cmake
|
||||
+++ b/cmake/modules/DunePythonVirtualenv.cmake
|
||||
@@ -81,6 +81,10 @@ set(DUNE_PYTHON_EXTERNAL_VIRTUALENV_FOR_ABSOLUTE_BUILDDIR ON CACHE BOOL
|
||||
"Place Python virtualenv in top-level directory \"dune-python-env\" when using an absolute build directory"
|
||||
)
|
||||
|
||||
+if (NOT "$ENV{DUNE_PYTHON_VIRTUALENV_PATH}" STREQUAL "")
|
||||
+ set(DUNE_PYTHON_VIRTUALENV_PATH "$ENV{DUNE_PYTHON_VIRTUALENV_PATH}")
|
||||
+endif()
|
||||
+
|
||||
if(DUNE_PYTHON_VIRTUALENV_PATH STREQUAL "")
|
||||
foreach(mod ${ALL_DEPENDENCIES})
|
||||
if(IS_DIRECTORY ${${mod}_DIR}/dune-env)
|
Loading…
Reference in New Issue