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.
This commit is contained in:
parent
a3a9b48ed7
commit
7ffe2fadfe
2 changed files with 24 additions and 4 deletions
|
@ -19,3 +19,4 @@ packages:
|
||||||
- msvc
|
- msvc
|
||||||
providers:
|
providers:
|
||||||
mpi: [msmpi]
|
mpi: [msmpi]
|
||||||
|
gl: [wgl]
|
||||||
|
|
|
@ -34,6 +34,7 @@ class Wgl(Package):
|
||||||
version("10.0.14393")
|
version("10.0.14393")
|
||||||
version("10.0.10586")
|
version("10.0.10586")
|
||||||
version("10.0.26639")
|
version("10.0.26639")
|
||||||
|
version("10.0.20348")
|
||||||
|
|
||||||
# As per https://github.com/spack/spack/pull/31748 this provisory version represents
|
# As per https://github.com/spack/spack/pull/31748 this provisory version represents
|
||||||
# an arbitrary openGL version designed for maximum compatibility with calling packages
|
# an arbitrary openGL version designed for maximum compatibility with calling packages
|
||||||
|
@ -42,12 +43,12 @@ class Wgl(Package):
|
||||||
# satisfied appropriately
|
# satisfied appropriately
|
||||||
provides("gl@4.6")
|
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
|
# WGL exists on all Windows systems post win 98, however the headers
|
||||||
# needed to use OpenGL are found in the SDK (GL/gl.h)
|
# needed to use OpenGL are found in the SDK (GL/gl.h)
|
||||||
# Dep is needed to consolidate sdk version to locate header files for
|
# Dep is needed to consolidate sdk version to locate header files for
|
||||||
# version of SDK being used
|
# 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.19041", when="@10.0.19041")
|
||||||
depends_on("win-sdk@10.0.18362", when="@10.0.18362")
|
depends_on("win-sdk@10.0.18362", when="@10.0.18362")
|
||||||
depends_on("win-sdk@10.0.17763", when="@10.0.17763")
|
depends_on("win-sdk@10.0.17763", when="@10.0.17763")
|
||||||
|
@ -77,14 +78,32 @@ def determine_variants(cls, libs, ver_str):
|
||||||
variants.append("plat=%s" % arch)
|
variants.append("plat=%s" % arch)
|
||||||
return variants
|
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
|
# As noted above, the headers neccesary to include
|
||||||
@property
|
@property
|
||||||
def headers(self):
|
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
|
@property
|
||||||
def libs(self):
|
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):
|
def install(self, spec, prefix):
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
|
|
Loading…
Reference in a new issue