Skip to content

Commit

Permalink
benchmark: enable shared libraries by default (spack#47368)
Browse files Browse the repository at this point in the history
* benchmark: enable shared libraries by default

The existing behaviour of Google Benchmark yiels static objects which
are of little use for most projects. This PR changes the spec to use
dynamic libraries instead.

* Add shared variant
  • Loading branch information
stephenswat authored Nov 10, 2024
1 parent 2713b0c commit 2da4366
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions var/spack/repos/builtin/packages/benchmark/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Benchmark(CMakePackage):
git = "https://github.com/google/benchmark.git"

license("Apache-2.0")
maintainers("stephenswat")

# first properly installed CMake config packages in
# 1.2.0 release: https://github.com/google/benchmark/issues/363
Expand Down Expand Up @@ -54,6 +55,9 @@ class Benchmark(CMakePackage):
when="@1.5.4:",
description="Enable performance counters provided by libpfm",
)
variant(
"shared", default=True, sticky=True, description="Build the libraries as shared objects"
)

depends_on("cmake@2.8.11:", type="build", when="@:1.1.0")
depends_on("cmake@2.8.12:", type="build", when="@1.2.0:1.4")
Expand All @@ -64,6 +68,7 @@ def cmake_args(self):
# No need for testing for the install
args = [
self.define("BENCHMARK_ENABLE_TESTING", False),
self.define_from_variant("BUILD_SHARED_LIBS", "shared"),
self.define_from_variant("BENCHMARK_ENABLE_LIBPFM", "performance_counters"),
]
return args
Expand Down

0 comments on commit 2da4366

Please sign in to comment.