From 53a7b49619671a318274cdec43952a1d59f77ff0 Mon Sep 17 00:00:00 2001 From: "John W. Parent" <45471568+johnwparent@users.noreply.github.com> Date: Tue, 13 Sep 2022 13:28:29 -0400 Subject: Windows rpath support (#31930) Add a post-install step which runs (only) on Windows to modify an install prefix, adding symlinks to all dependency libraries. Windows does not have the same concept of RPATHs as Linux, but when resolving symbols will check the local directory for dependency libraries; by placing a symlink to each dependency library in the directory with the library that needs it, the package can then use all Spack-built dependencies. Note: * This collects dependency libraries based on Package.rpath, which includes only direct link dependencies * There is no examination of libraries to check what dependencies they require, so all libraries of dependencies are symlinked into any directory of the package which contains libraries --- .../repos/builtin.mock/packages/attributes-foo/package.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin.mock/packages/attributes-foo/package.py b/var/spack/repos/builtin.mock/packages/attributes-foo/package.py index f4bb9059a4..9010c52958 100644 --- a/var/spack/repos/builtin.mock/packages/attributes-foo/package.py +++ b/var/spack/repos/builtin.mock/packages/attributes-foo/package.py @@ -2,6 +2,7 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import sys from spack.package import * @@ -14,13 +15,12 @@ class AttributesFoo(BundlePackage): provides("baz") def install(self, spec, prefix): - if "platform=windows" in spec: - lib_suffix = ".lib" - elif "platform=darwin" in spec: - lib_suffix = ".dylib" - else: - lib_suffix = ".so" + lib_suffix = ".so" + if sys.platform == "win32": + lib_suffix = ".dll" + elif sys.platform == "darwin": + lib_suffix = ".dylib" mkdirp(prefix.include) touch(prefix.include.join("foo.h")) mkdirp(prefix.include.bar) -- cgit v1.2.3-70-g09d2