|
| 1 | +# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other |
| 2 | +# Spack Project Developers. See the top-level COPYRIGHT file for details. |
| 3 | +# |
| 4 | +# SPDX-License-Identifier: (Apache-2.0 OR MIT) |
| 5 | + |
| 6 | +import sys |
| 7 | +from spack import * |
| 8 | +from spack.operating_systems.mac_os import macos_version |
| 9 | + |
| 10 | +# |
| 11 | +# Need to add: |
| 12 | +# KOKKOS support using an external (i.e. spack-supplied) kokkos library. |
| 13 | +# Data Warehouse (FAODEL) enable/disable |
| 14 | + |
| 15 | + |
| 16 | +class Seacas(CMakePackage): |
| 17 | + """The SEACAS Project contains the Exodus and IOSS libraries and a |
| 18 | + collection of applications which create, query, modify, or |
| 19 | + translate exodus databases. Default is to build the exodus and |
| 20 | + IOSS libraries and the io_shell, io_info, struc_to_unstruc apps. |
| 21 | + """ |
| 22 | + homepage = "http://gsjaardema.github.io/seacas/" |
| 23 | + git = "https://github.com/gsjaardema/seacas.git" |
| 24 | + |
| 25 | + maintainers = ['gsjaardema'] |
| 26 | + |
| 27 | + # ###################### Versions ########################## |
| 28 | + version('master', branch='master') |
| 29 | + |
| 30 | + # ###################### Variants ########################## |
| 31 | + # Package options |
| 32 | + # The I/O libraries (exodus, IOSS) are always built |
| 33 | + # -- required of both applications and legacy variants. |
| 34 | + variant('applications', default=True, |
| 35 | + description='Build all "current" SEACAS applications. This' |
| 36 | + ' includes a debatable list of essential applications: ' |
| 37 | + 'aprepro, conjoin, ejoin, epu, exo2mat, mat2exo, ' |
| 38 | + 'exo_format, exodiff, explore, grepos, ' |
| 39 | + 'nemslice, nemspread') |
| 40 | + variant('legacy', default=True, |
| 41 | + description='Build all "legacy" SEACAS applications. This includes' |
| 42 | + ' a debatable list of "legacy" applications: algebra, blot, ' |
| 43 | + 'exomatlab, exotxt, fastq, gen3d, genshell, gjoin, mapvar, ' |
| 44 | + 'mapvar-kd, numbers, txtexo, nemesis') |
| 45 | + |
| 46 | + # Build options |
| 47 | + variant('fortran', default=True, |
| 48 | + description='Compile with Fortran support') |
| 49 | + variant('shared', default=True, |
| 50 | + description='Enables the build of shared libraries') |
| 51 | + variant('mpi', default=True, description='Enables MPI parallelism.') |
| 52 | + |
| 53 | + variant('thread_safe', default=False, |
| 54 | + description='Enable thread-safe exodus and IOSS libraries') |
| 55 | + |
| 56 | + # TPLs (alphabet order) |
| 57 | + variant('cgns', default=True, |
| 58 | + description='Enable CGNS') |
| 59 | + variant('matio', default=True, |
| 60 | + description='Compile with matio (MatLab) support') |
| 61 | + variant('metis', default=False, |
| 62 | + description='Compile with METIS and ParMETIS') |
| 63 | + variant('x11', default=True, |
| 64 | + description='Compile with X11') |
| 65 | + |
| 66 | + # ###################### Dependencies ########################## |
| 67 | + |
| 68 | + # Everything should be compiled position independent (-fpic) |
| 69 | + |
| 70 | + depends_on( '[email protected]+mpi+parallel-netcdf', when='+mpi') |
| 71 | + depends_on( '[email protected]~mpi', when='~mpi') |
| 72 | + depends_on('cgns@develop+mpi+scoping', when='+cgns +mpi') |
| 73 | + depends_on('cgns@develop~mpi+scoping', when='+cgns ~mpi') |
| 74 | + depends_on('matio', when='+matio') |
| 75 | + depends_on('metis+int64+real64', when='+metis ~mpi') |
| 76 | + depends_on('parmetis+int64+real64', when='+metis +mpi') |
| 77 | + |
| 78 | + # MPI related dependencies |
| 79 | + depends_on('mpi', when='+mpi') |
| 80 | + |
| 81 | + depends_on( '[email protected]:', type='build') |
| 82 | + |
| 83 | + def cmake_args(self): |
| 84 | + spec = self.spec |
| 85 | + |
| 86 | + options = [] |
| 87 | + |
| 88 | + # #################### Base Settings ####################### |
| 89 | + |
| 90 | + if '+mpi' in spec: |
| 91 | + options.extend([ |
| 92 | + '-DCMAKE_C_COMPILER=%s' % spec['mpi'].mpicc, |
| 93 | + '-DCMAKE_CXX_COMPILER=%s' % spec['mpi'].mpicxx, |
| 94 | + '-DCMAKE_Fortran_COMPILER=%s' % spec['mpi'].mpifc, |
| 95 | + '-DTPL_ENABLE_MPI:BOOL=ON', |
| 96 | + '-DMPI_BASE_DIR:PATH=%s' % spec['mpi'].prefix, |
| 97 | + ]) |
| 98 | + |
| 99 | + options.extend([ |
| 100 | + '-DSEACASProj_ENABLE_TESTS:BOOL=ON', |
| 101 | + '-DSEACASProj_ENABLE_CXX11:BOOL=ON', |
| 102 | + '-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=%s' % ( |
| 103 | + 'ON' if '+shared' in spec else 'OFF'), |
| 104 | + '-DBUILD_SHARED_LIBS:BOOL=%s' % ( |
| 105 | + 'ON' if '+shared' in spec else 'OFF'), |
| 106 | + '-DSEACASProj_ENABLE_Kokkos:BOOL=OFF', |
| 107 | + '-DSEACASProj_HIDE_DEPRECATED_CODE:BOOL=OFF', |
| 108 | + '-DSEACASExodus_ENABLE_THREADSAFE:BOOL=%s' % ( |
| 109 | + 'ON' if '+thread_safe' in spec else 'OFF'), |
| 110 | + '-DSEACASIoss_ENABLE_THREADSAFE:BOOL=%s' % ( |
| 111 | + 'ON' if '+thread_safe' in spec else 'OFF'), |
| 112 | + '-DSEACASProj_ENABLE_Fortran:BOOL=%s' % ( |
| 113 | + 'ON' if '+fortran' in spec else 'OFF'), |
| 114 | + '-DTPL_ENABLE_X11:BOOL=%s' % ( |
| 115 | + 'ON' if '+x11' in spec else 'OFF'), |
| 116 | + ]) |
| 117 | + |
| 118 | + # ########## What applications should be built ############# |
| 119 | + # Check whether they want everything; if so, do the easy way... |
| 120 | + if '+applications' in spec and '+legacy' in spec: |
| 121 | + options.extend([ |
| 122 | + '-DSEACASProj_ENABLE_ALL_PACKAGES:BOOL=ON', |
| 123 | + '-DSEACASProj_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=ON', |
| 124 | + '-DSEACASProj_ENABLE_SECONDARY_TESTED_CODE:BOOL=ON', |
| 125 | + ]) |
| 126 | + else: |
| 127 | + # Don't want everything; handle the subsets: |
| 128 | + options.extend([ |
| 129 | + '-DSEACASProj_ENABLE_ALL_PACKAGES:BOOL=OFF', |
| 130 | + '-DSEACASProj_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=OFF', |
| 131 | + '-DSEACASProj_ENABLE_SECONDARY_TESTED_CODE:BOOL=OFF', |
| 132 | + '-DSEACASProj_ENABLE_SEACASIoss:BOOL=ON', |
| 133 | + '-DSEACASProj_ENABLE_SEACASExodus:BOOL=ON', |
| 134 | + '-DSEACASProj_ENABLE_SEACASExodus_for:BOOL=%s' % ( |
| 135 | + 'ON' if '+fortran' in spec else 'OFF'), |
| 136 | + '-DSEACASProj_ENABLE_SEACASExoIIv2for32:BOOL=%s' % ( |
| 137 | + 'ON' if '+fortran' in spec else 'OFF'), |
| 138 | + ]) |
| 139 | + |
| 140 | + if '+applications' in spec: |
| 141 | + options.extend([ |
| 142 | + '-DSEACASProj_ENABLE_SEACASAprepro:BOOL=ON', |
| 143 | + '-DSEACASProj_ENABLE_SEACASAprepro_lib:BOOL=ON', |
| 144 | + '-DSEACASProj_ENABLE_SEACASConjoin:BOOL=ON', |
| 145 | + '-DSEACASProj_ENABLE_SEACASEjoin:BOOL=ON', |
| 146 | + '-DSEACASProj_ENABLE_SEACASEpu:BOOL=ON', |
| 147 | + '-DSEACASProj_ENABLE_SEACASExo2mat:BOOL=ON', |
| 148 | + '-DSEACASProj_ENABLE_SEACASExo_format:BOOL=ON', |
| 149 | + '-DSEACASProj_ENABLE_SEACASExodiff:BOOL=ON', |
| 150 | + '-DSEACASProj_ENABLE_SEACASExplore:BOOL=%s' % ( |
| 151 | + 'ON' if '+fortran' in spec else 'OFF'), |
| 152 | + '-DSEACASProj_ENABLE_SEACASGrepos:BOOL=%s' % ( |
| 153 | + 'ON' if '+fortran' in spec else 'OFF'), |
| 154 | + '-DSEACASProj_ENABLE_SEACASMat2exo:BOOL=ON', |
| 155 | + '-DSEACASProj_ENABLE_SEACASNemslice:BOOL=ON', |
| 156 | + '-DSEACASProj_ENABLE_SEACASNemspread:BOOL=ON', |
| 157 | + ]) |
| 158 | + |
| 159 | + if '+legacy' in spec: |
| 160 | + options.extend([ |
| 161 | + '-DSEACASProj_ENABLE_SEACASAlgebra:BOOL=%s' % ( |
| 162 | + 'ON' if '+fortran' in spec else 'OFF'), |
| 163 | + '-DSEACASProj_ENABLE_SEACASBlot:BOOL=%s' % ( |
| 164 | + 'ON' if '+fortran' in spec else 'OFF'), |
| 165 | + '-DSEACASProj_ENABLE_SEACASEx1ex2v2:BOOL=%s' % ( |
| 166 | + 'ON' if '+fortran' in spec else 'OFF'), |
| 167 | + '-DSEACASProj_ENABLE_SEACASEx2ex1v2:BOOL=%s' % ( |
| 168 | + 'ON' if '+fortran' in spec else 'OFF'), |
| 169 | + '-DSEACASProj_ENABLE_SEACASExomatlab:BOOL=%s' % ( |
| 170 | + 'ON' if '+fortran' in spec else 'OFF'), |
| 171 | + '-DSEACASProj_ENABLE_SEACASExotec2:BOOL=%s' % ( |
| 172 | + 'ON' if '+fortran' in spec else 'OFF'), |
| 173 | + '-DSEACASProj_ENABLE_SEACASExotxt:BOOL=%s' % ( |
| 174 | + 'ON' if '+fortran' in spec else 'OFF'), |
| 175 | + '-DSEACASProj_ENABLE_SEACASFastq:BOOL=%s' % ( |
| 176 | + 'ON' if '+fortran' in spec else 'OFF'), |
| 177 | + '-DSEACASProj_ENABLE_SEACASGen3D:BOOL=%s' % ( |
| 178 | + 'ON' if '+fortran' in spec else 'OFF'), |
| 179 | + '-DSEACASProj_ENABLE_SEACASGenshell:BOOL=%s' % ( |
| 180 | + 'ON' if '+fortran' in spec else 'OFF'), |
| 181 | + '-DSEACASProj_ENABLE_SEACASGjoin:BOOL=%s' % ( |
| 182 | + 'ON' if '+fortran' in spec else 'OFF'), |
| 183 | + '-DSEACASProj_ENABLE_SEACASMapvar:BOOL=%s' % ( |
| 184 | + 'ON' if '+fortran' in spec else 'OFF'), |
| 185 | + '-DSEACASProj_ENABLE_SEACASMapvar-kd:BOOL=%s' % ( |
| 186 | + 'ON' if '+fortran' in spec else 'OFF'), |
| 187 | + '-DSEACASProj_ENABLE_SEACASNemesis:BOOL=ON', |
| 188 | + '-DSEACASProj_ENABLE_SEACASNumbers:BOOL=%s' % ( |
| 189 | + 'ON' if '+fortran' in spec else 'OFF'), |
| 190 | + '-DSEACASProj_ENABLE_SEACASTxtexo:BOOL=%s' % ( |
| 191 | + 'ON' if '+fortran' in spec else 'OFF'), |
| 192 | + ]) |
| 193 | + |
| 194 | + # ##################### Dependencies ########################## |
| 195 | + # Always need NetCDF |
| 196 | + options.extend([ |
| 197 | + '-DTPL_ENABLE_Netcdf:BOOL=ON', |
| 198 | + '-DNetCDF_ROOT:PATH=%s' % spec['netcdf'].prefix, |
| 199 | + ]) |
| 200 | + |
| 201 | + if '+metis' in spec: |
| 202 | + options.extend([ |
| 203 | + '-DTPL_ENABLE_METIS:BOOL=ON', |
| 204 | + '-DMETIS_LIBRARY_DIRS=%s' % spec['metis'].prefix.lib, |
| 205 | + '-DMETIS_LIBRARY_NAMES=metis', |
| 206 | + '-DTPL_METIS_INCLUDE_DIRS=%s' % spec['metis'].prefix.include, |
| 207 | + '-DTPL_ENABLE_ParMETIS:BOOL=ON', |
| 208 | + '-DParMETIS_LIBRARY_DIRS=%s;%s' % ( |
| 209 | + spec['parmetis'].prefix.lib, spec['metis'].prefix.lib), |
| 210 | + '-DParMETIS_LIBRARY_NAMES=parmetis;metis', |
| 211 | + '-DTPL_ParMETIS_INCLUDE_DIRS=%s;%s' % ( |
| 212 | + spec['parmetis'].prefix.include, |
| 213 | + spec['metis'].prefix.include) |
| 214 | + ]) |
| 215 | + else: |
| 216 | + options.extend([ |
| 217 | + '-DTPL_ENABLE_METIS:BOOL=OFF', |
| 218 | + '-DTPL_ENABLE_ParMETIS:BOOL=OFF', |
| 219 | + ]) |
| 220 | + |
| 221 | + if '+matio' in spec: |
| 222 | + options.extend([ |
| 223 | + '-DTPL_ENABLE_Matio:BOOL=ON', |
| 224 | + '-DMatio_ROOT:PATH=%s' % spec['matio'].prefix |
| 225 | + ]) |
| 226 | + else: |
| 227 | + options.extend([ |
| 228 | + '-DTPL_ENABLE_Matio:BOOL=OFF' |
| 229 | + ]) |
| 230 | + |
| 231 | + if '+cgns' in spec: |
| 232 | + options.extend([ |
| 233 | + '-DTPL_ENABLE_CGNS:BOOL=ON', |
| 234 | + '-DCGNS_ROOT:PATH=%s' % spec['cgns'].prefix, |
| 235 | + ]) |
| 236 | + else: |
| 237 | + options.extend([ |
| 238 | + '-DTPL_ENABLE_CGNS:BOOL=OFF' |
| 239 | + ]) |
| 240 | + |
| 241 | + # ################# RPath Handling ###################### |
| 242 | + if sys.platform == 'darwin' and macos_version() >= Version('10.12'): |
| 243 | + # use @rpath on Sierra due to limit of dynamic loader |
| 244 | + options.append('-DCMAKE_MACOSX_RPATH:BOOL=ON') |
| 245 | + else: |
| 246 | + options.append('-DCMAKE_INSTALL_NAME_DIR:PATH=%s' % |
| 247 | + self.prefix.lib) |
| 248 | + |
| 249 | + return options |
0 commit comments