From 0e464f86bbd62bb6bb6369841cb213be503aa55d Mon Sep 17 00:00:00 2001 From: Ondřej Čertík Date: Thu, 26 Oct 2017 13:50:18 -0600 Subject: 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 --- .../builtin/packages/exodusii/cmake-exodus.patch | 9 ------ .../repos/builtin/packages/exodusii/package.py | 36 ++++++++++------------ 2 files changed, 16 insertions(+), 29 deletions(-) delete mode 100644 var/spack/repos/builtin/packages/exodusii/cmake-exodus.patch (limited to 'var') diff --git a/var/spack/repos/builtin/packages/exodusii/cmake-exodus.patch b/var/spack/repos/builtin/packages/exodusii/cmake-exodus.patch deleted file mode 100644 index 014381de88..0000000000 --- a/var/spack/repos/builtin/packages/exodusii/cmake-exodus.patch +++ /dev/null @@ -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 diff --git a/var/spack/repos/builtin/packages/exodusii/package.py b/var/spack/repos/builtin/packages/exodusii/package.py index 5078b63cec..3a99952db6 100644 --- a/var/spack/repos/builtin/packages/exodusii/package.py +++ b/var/spack/repos/builtin/packages/exodusii/package.py @@ -27,11 +27,8 @@ from spack import * # 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 @@ class Exodusii(Package): '-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 -- cgit v1.2.3-70-g09d2