Exodus: skip the -G "Unix Makefiles" part (#5906)

* Exodus: skip the -G "Unix Makefiles" part

The problem is that spack passes -G "Unix Makefiles" into cmake, which normally
works. But in the Exodus package, it is being passed into a bash wrapper
script. In there, the $@ then loses the information about "Unix Makefiles"
being just one argument, and in effect passes -G Unix Makefiles into the cmake
(without quotes), and so cmake only sees -G Unix, and then fails. This is a
known problem with bash with no simple solutions. As a workaround, this patch
skips the first two arguments, i.e., -G and "Unix Makefiles". This makes it
work.

Fixes #5895.

* Port exodusii to cmake

The cmake options were taken from the cmake-exodus bash script and ported to
spack directly.

* Use variant forwarding to forward the 'mpi'

Now instead of

    spack install exodusii~mpi^netcdf~mpi^hdf5~mpi

one can just use

    spack install exodusii~mpi
This commit is contained in:
Ondřej Čertík 2017-10-26 13:50:18 -06:00 committed by Christoph Junghans
parent 8e47b17a4d
commit 0e464f86bb
2 changed files with 16 additions and 29 deletions

View File

@ -1,9 +0,0 @@
diff --git a/cmake-exodus b/cmake-exodus
index 67ccd34..9b749e3 100755
--- a/cmake-exodus
+++ b/cmake-exodus
@@ -1,3 +1,4 @@
+#!/bin/bash
EXTRA_ARGS=$@
### The following assumes you are building in a subdirectory of ACCESS Root

View File

@ -27,11 +27,8 @@
# TODO: Add support for a C++11 enabled installation that filters out the
# TODO: "C++11-Disabled" flag (but only if the spec compiler supports C++11).
# TODO: Use variant forwarding to forward the 'mpi' variant to the direct
# TODO: dependencies 'hdf5' and 'netcdf'.
class Exodusii(Package):
class Exodusii(CMakePackage):
"""Exodus II is a C++/Fortran library developed to store and retrieve
data for finite element analyses. It's used for preprocessing
(problem definition), postprocessing (results visualization), and
@ -52,18 +49,25 @@ class Exodusii(Package):
depends_on('mpi', when='+mpi')
# https://github.com/gsjaardema/seacas/blob/master/NetCDF-Mapping.md
depends_on('netcdf maxdims=65536 maxvars=524288')
depends_on('hdf5+shared')
depends_on('netcdf+mpi maxdims=65536 maxvars=524288', when='+mpi')
depends_on('netcdf~mpi maxdims=65536 maxvars=524288', when='~mpi')
depends_on('hdf5+shared+mpi', when='+mpi')
depends_on('hdf5+shared~mpi', when='~mpi')
patch('cmake-exodus.patch')
def cmake_args(self):
spec = self.spec
def install(self, spec, prefix):
cc_path = spec['mpi'].mpicc if '+mpi' in spec else self.compiler.cc
cxx_path = spec['mpi'].mpicxx if '+mpi' in spec else self.compiler.cxx
config_args = std_cmake_args[:]
config_args.extend([
options = [
# General Flags #
'-DSEACASProj_ENABLE_SEACASExodus=ON',
'-DSEACASProj_ENABLE_TESTS=ON',
'-DBUILD_SHARED_LIBS:BOOL=ON',
'-DTPL_ENABLE_Netcdf:BOOL=ON',
'-DHDF5_NO_SYSTEM_PATHS=ON',
'-DSEACASProj_SKIP_FORTRANCINTERFACE_VERIFY_TEST:BOOL=ON',
'-DSEACASProj_ENABLE_CXX11:BOOL=OFF',
'-DSEACASProj_ENABLE_Zoltan:BOOL=OFF',
'-DHDF5_ROOT:PATH={0}'.format(spec['hdf5'].prefix),
@ -73,14 +77,6 @@ def install(self, spec, prefix):
'-DTPL_ENABLE_MPI={0}'.format('ON' if '+mpi' in spec else 'OFF'),
'-DCMAKE_C_COMPILER={0}'.format(cc_path),
'-DCMAKE_CXX_COMPILER={0}'.format(cxx_path),
])
]
build_directory = join_path(self.stage.source_path, 'spack-build')
source_directory = self.stage.source_path
with working_dir(build_directory, create=True):
mcmake = Executable(join_path(source_directory, 'cmake-exodus'))
mcmake(*config_args)
make()
make('install')
return options