Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add google benchmark 1.5.3 #5533

Merged
merged 2 commits into from
May 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions recipes/benchmark/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ sources:
"1.5.2":
sha256: dccbdab796baa1043f04982147e67bb6e118fe610da2c65f88912d73987e700c
url: https://github.com/google/benchmark/archive/v1.5.2.tar.gz
"1.5.3":
sha256: e4fbb85eec69e6668ad397ec71a3a3ab165903abe98a8327db920b94508f720e
url: https://github.com/google/benchmark/archive/v1.5.3.tar.gz
29 changes: 18 additions & 11 deletions recipes/benchmark/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from conans.errors import ConanInvalidConfiguration
import os

required_conan_version = ">=1.33.0"


class BenchmarkConan(ConanFile):
name = "benchmark"
Expand All @@ -27,23 +29,28 @@ class BenchmarkConan(ConanFile):
"enable_exceptions": True,
}

_source_subfolder = "source_subfolder"
_build_subfolder = "build_subfolder"
_cmake = None

def source(self):
tools.get(**self.conan_data["sources"][self.version])
@property
def _source_subfolder(self):
return "source_subfolder"

extracted_dir = self.name + "-" + self.version
os.rename(extracted_dir, self._source_subfolder)
@property
def _build_subfolder(self):
return "build_subfolder"

def source(self):
tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True)

def config_options(self):
if self.settings.os == "Windows":
if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version.value) <= 12:
raise ConanInvalidConfiguration("{} {} does not support Visual Studio <= 12".format(self.name, self.version))
del self.options.fPIC
if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version.value) <= 12:
raise ConanInvalidConfiguration("{} {} does not support Visual Studio <= 12".format(self.name, self.version))

def configure(self):
if self.options.shared:
del self.options.fPIC
if self.settings.os == "Windows" and self.options.shared:
raise ConanInvalidConfiguration("Windows shared builds are not supported right now, see issue #639")

Expand All @@ -62,7 +69,7 @@ def _configure_cmake(self):
self._cmake.definitions["HAVE_STD_REGEX"] = False
self._cmake.definitions["HAVE_POSIX_REGEX"] = False
self._cmake.definitions["HAVE_STEADY_CLOCK"] = False
self._cmake.definitions["BENCHMARK_USE_LIBCXX"] = "ON" if (str(self.settings.compiler.libcxx) == "libc++") else "OFF"
self._cmake.definitions["BENCHMARK_USE_LIBCXX"] = "ON" if self.settings.compiler.get_safe("libcxx") == "libc++" else "OFF"
else:
self._cmake.definitions["BENCHMARK_USE_LIBCXX"] = "OFF"

Expand All @@ -82,8 +89,8 @@ def package(self):
tools.rmdir(os.path.join(self.package_folder, 'lib', 'cmake'))

def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
if self.settings.os == "Linux":
self.cpp_info.libs = ["benchmark", "benchmark_main"]
if self.settings.os in ("FreeBSD", "Linux"):
self.cpp_info.system_libs.extend(["pthread", "rt"])
elif self.settings.os == "Windows":
self.cpp_info.system_libs.append("shlwapi")
Expand Down
2 changes: 2 additions & 0 deletions recipes/benchmark/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ versions:
folder: all
"1.5.2":
folder: all
"1.5.3":
folder: all