summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn W. Parent <45471568+johnwparent@users.noreply.github.com>2023-03-28 19:31:10 -0400
committerGitHub <noreply@github.com>2023-03-28 16:31:10 -0700
commit7ffe2fadfedae1133da6a2dfa96b8c21828dbabc (patch)
treecee4367a4aa10ce1ab754a9d25e91b7ea86ea503
parenta3a9b48ed72f4e4eb8f3f00c898fd28775b03337 (diff)
downloadspack-7ffe2fadfedae1133da6a2dfa96b8c21828dbabc.tar.gz
spack-7ffe2fadfedae1133da6a2dfa96b8c21828dbabc.tar.bz2
spack-7ffe2fadfedae1133da6a2dfa96b8c21828dbabc.tar.xz
spack-7ffe2fadfedae1133da6a2dfa96b8c21828dbabc.zip
WGL package: correct libs/headers detection (#35113)
Corrects libs detection with a more specific root, otherwise there can be inconsistencies between version of WGL requested and the version picked up by `find_libraries`. Corrects headers detection - win-sdk, win-wdk, and WGL headers all exist under the same directory, so we can compute the headers for WGL without querying the spec for win-sdk (which causes errors). This commit also removes the `plat` variant of `wgl`, which is redundant with the Spec's target.
-rw-r--r--etc/spack/defaults/windows/packages.yaml1
-rw-r--r--var/spack/repos/builtin/packages/wgl/package.py27
2 files changed, 24 insertions, 4 deletions
diff --git a/etc/spack/defaults/windows/packages.yaml b/etc/spack/defaults/windows/packages.yaml
index 863cf7cf18..c72ba8c033 100644
--- a/etc/spack/defaults/windows/packages.yaml
+++ b/etc/spack/defaults/windows/packages.yaml
@@ -19,3 +19,4 @@ packages:
- msvc
providers:
mpi: [msmpi]
+ gl: [wgl]
diff --git a/var/spack/repos/builtin/packages/wgl/package.py b/var/spack/repos/builtin/packages/wgl/package.py
index bbad4bf987..7468b6f577 100644
--- a/var/spack/repos/builtin/packages/wgl/package.py
+++ b/var/spack/repos/builtin/packages/wgl/package.py
@@ -34,6 +34,7 @@ class Wgl(Package):
version("10.0.14393")
version("10.0.10586")
version("10.0.26639")
+ version("10.0.20348")
# As per https://github.com/spack/spack/pull/31748 this provisory version represents
# an arbitrary openGL version designed for maximum compatibility with calling packages
@@ -42,12 +43,12 @@ class Wgl(Package):
# satisfied appropriately
provides("gl@4.6")
- variant("plat", values=("x64", "x86", "arm", "arm64"), default="x64")
-
# WGL exists on all Windows systems post win 98, however the headers
# needed to use OpenGL are found in the SDK (GL/gl.h)
# Dep is needed to consolidate sdk version to locate header files for
# version of SDK being used
+ # Generic depends to capture handling for external versions
+ depends_on("win-sdk")
depends_on("win-sdk@10.0.19041", when="@10.0.19041")
depends_on("win-sdk@10.0.18362", when="@10.0.18362")
depends_on("win-sdk@10.0.17763", when="@10.0.17763")
@@ -77,14 +78,32 @@ class Wgl(Package):
variants.append("plat=%s" % arch)
return variants
+ def _spec_arch_to_sdk_arch(self):
+ spec_arch = str(self.spec.architecture.target).lower()
+ _64bit = "64" in spec_arch
+ arm = "arm" in spec_arch
+ if arm:
+ return "arm64" if _64bit else "arm"
+ else:
+ return "x64" if _64bit else "x86"
+
# As noted above, the headers neccesary to include
@property
def headers(self):
- return find_headers("GL/gl.h", root=self.spec["win-sdk"].prefix.includes, recursive=True)
+ return find_headers(
+ "GL", root=os.path.join(self.prefix.Include, str(self.version) + ".0"), recursive=True
+ )
@property
def libs(self):
- return find_libraries("opengl32", shared=False, root=self.prefix, recursive=True)
+ return find_libraries(
+ "opengl32",
+ shared=False,
+ root=os.path.join(
+ self.prefix.Lib, str(self.version) + ".0", "um", self._spec_arch_to_sdk_arch()
+ ),
+ recursive=True,
+ )
def install(self, spec, prefix):
raise RuntimeError(