Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 from conans import ConanFile, CMake, tools
00009 from conans.errors import ConanInvalidConfiguration
00010 from conans.model.version import Version
00011
00012
00013 class AbseilConan(ConanFile):
00014 name = "abseil"
00015 url = "https://github.com/abseil/abseil-cpp"
00016 homepage = url
00017 author = "Abseil <abseil-io@googlegroups.com>"
00018 description = "Abseil Common Libraries (C++) from Google"
00019 license = "Apache-2.0"
00020 topics = ("conan", "abseil", "abseil-cpp", "google", "common-libraries")
00021 exports = ["LICENSE"]
00022 exports_sources = ["CMakeLists.txt", "CMake/*", "absl/*"]
00023 generators = "cmake"
00024 settings = "os", "arch", "compiler", "build_type"
00025
00026 def configure(self):
00027 if self.settings.os == "Windows" and \
00028 self.settings.compiler == "Visual Studio" and \
00029 Version(self.settings.compiler.version.value) < "14":
00030 raise ConanInvalidConfiguration("Abseil does not support MSVC < 14")
00031
00032 def build(self):
00033 tools.replace_in_file("CMakeLists.txt", "project(absl)", "project(absl)\ninclude(conanbuildinfo.cmake)\nconan_basic_setup()")
00034 cmake = CMake(self)
00035 cmake.definitions["BUILD_TESTING"] = False
00036 cmake.configure()
00037 cmake.build()
00038
00039 def package(self):
00040 self.copy("LICENSE", dst="licenses")
00041 self.copy("*.h", dst="include", src=".")
00042 self.copy("*.inc", dst="include", src=".")
00043 self.copy("*.a", dst="lib", src=".", keep_path=False)
00044 self.copy("*.lib", dst="lib", src=".", keep_path=False)
00045
00046 def package_info(self):
00047 if self.settings.os == "Linux":
00048 self.cpp_info.libs = ["-Wl,--start-group"]
00049 self.cpp_info.libs.extend(tools.collect_libs(self))
00050 if self.settings.os == "Linux":
00051 self.cpp_info.libs.extend(["-Wl,--end-group", "pthread"])