103 lines
3.5 KiB
Plaintext
103 lines
3.5 KiB
Plaintext
#%Module1.0
|
|
|
|
module-whatis "ANSYS Software"
|
|
module-url "https://www.ansys.com"
|
|
module-license "See PREFIX/share/doc/COPYING"
|
|
module-maintainer "Marc Caubet Serrabou <marc.caubet@psi.ch>"
|
|
module-help "
|
|
Ansys offers a comprehensive software suite that spans the entire range
|
|
of physics, providing access to virtually any field of engineering simulation
|
|
that a design process requires. Organizations around the world trust Ansys to
|
|
deliver the best value for their engineering simulation software investment.
|
|
|
|
This module contains the main ANSYS Software with several ANSYS products
|
|
(i.e Fluent, EM, RSM, CFX, Mechanical APDL, etc.).
|
|
"
|
|
|
|
set year [string range $V_PKG 2 3]
|
|
set release [string range $V_PKG end end]
|
|
set version "v$year$release"
|
|
|
|
# Helper: does $dir end with the relative pattern (e.g. "lib", "lib64", "lib/linx64")?
|
|
proc endsWithParts {dir patParts} {
|
|
set dirParts [file split $dir]
|
|
set n [llength [string map {/ " "} $patParts]]
|
|
if {[llength $dirParts] < $n} { return 0 }
|
|
set tailParts [string map {" " /} [lrange $dirParts end-[expr {$n-1}] end]]
|
|
expr {$tailParts eq $patParts}
|
|
}
|
|
|
|
# Recursive search using only file split; patternsParts is a list of list-parts
|
|
proc findDirs {base targetList patternsParts {level 0} {maxDepth 2}} {
|
|
upvar $targetList results
|
|
if {$level > $maxDepth} { return }
|
|
foreach dir [glob -nocomplain -types d -directory $base *] {
|
|
# match against any pattern (already split)
|
|
foreach patParts $patternsParts {
|
|
if {[endsWithParts $dir $patParts]} {
|
|
lappend results $dir
|
|
break
|
|
}
|
|
}
|
|
# Recurse deeper
|
|
findDirs $dir results $patternsParts [expr {$level+1}] $maxDepth
|
|
}
|
|
}
|
|
|
|
##############################################
|
|
# Auto PATH and LD_LIBRARY_PATH definitions
|
|
|
|
# Initialize lists
|
|
set libDirs {}
|
|
set binDirs {}
|
|
|
|
# Base to search
|
|
set baseDir "$PREFIX/$version"
|
|
|
|
# LD_LIBRARY_PATH: Find lib dirs up to 3 levels
|
|
# set libPatterns {lib lib64 lib/linx64}
|
|
# findDirs $baseDir libDirs $libPatterns 0 1
|
|
|
|
# PATH: Find bin dirs up to 1 levels
|
|
set binPatterns {bin linx64 Linux64}
|
|
findDirs $baseDir binDirs $binPatterns 0 1
|
|
|
|
set binPatterns {bin/linx64 bin/Linux64}
|
|
findDirs $baseDir binDirs $binPatterns 0 2
|
|
|
|
# Deduplicate
|
|
set libDirs [lsort -unique $libDirs]
|
|
set binDirs [lsort -unique $binDirs]
|
|
|
|
# Update environment variables according to searches
|
|
# if {[llength $libDirs] > 0} {
|
|
# # prepend-path LD_LIBRARY_PATH [join $libDirs ":"]
|
|
# foreach libDir $libDirs {
|
|
# prepend-path LD_LIBRARY_PATH $libDir
|
|
# }
|
|
# }
|
|
|
|
if {[llength $binDirs] > 0} {
|
|
# prepend-path PATH [join $binDirs ":"]
|
|
foreach binDir $binDirs {
|
|
prepend-path PATH $binDir
|
|
}
|
|
}
|
|
|
|
##############################################
|
|
# Manual PATH and LD_LIBRARY_PATH definitions
|
|
|
|
# RSM binaries
|
|
prepend-path PATH $PREFIX/$version/RSM/Config/tools/linux
|
|
|
|
# AnsysEM location will depend on ANSYS version.
|
|
# From 2025 it's included in the main installation script, and placed into AnsysEM
|
|
# - The new version is already found in the above binDirs/libDirs searches above
|
|
# - For older releases one must install EM indepedently, and therefore PATH manually defined
|
|
if { [file isdirectory $PREFIX/$version/AnsysEM$year.$release/$version/Linux64] } {
|
|
prepend-path PATH $PREFIX/$version/AnsysEM$year.$release/$version/Linux64/
|
|
}
|
|
if { [file isdirectory $PREFIX/$version/AnsysEM] } {
|
|
prepend-path PATH $PREFIX/$version/AnsysEM/
|
|
}
|