r3d: add the shared variant (#49953)

This commit is contained in:
Rao Garimella 2025-04-18 00:54:11 -06:00 committed by GitHub
parent a38045f77e
commit 875397cf16
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -35,6 +35,8 @@ class R3d(CMakePackage):
description="Build R3D regression tests (versions 2019-04-24 or earlier)",
)
variant("shared", default=False, description="Build shared libraries")
variant(
"pic", default=False, description="Produce position-independent code (for shared libs)"
)
@ -42,6 +44,8 @@ class R3d(CMakePackage):
depends_on("c", type="build") # generated
depends_on("cxx", type="build") # generated
conflicts("+shared ~pic")
@when("@:2019-04-24")
def cmake(self, spec, prefix):
pass
@ -81,11 +85,12 @@ def cmake_args(self):
if r3d_max_verts != "0":
options.append("-DR3D_MAX_VERTS=" + r3d_max_verts)
options.append(self.define_from_variant("BUILD_SHARED_LIBS", "shared"))
options.append(self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"))
if self.run_tests:
options.append("-DENABLE_UNIT_TESTS=ON")
else:
options.append("-DENABLE_UNIT_TESTS=OFF")
options.append(self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"))
return options