Skip to content
This repository has been archived by the owner on Jun 24, 2020. It is now read-only.

#381 Include new compilers #8

Merged
merged 1 commit into from
Aug 1, 2018
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
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@ matrix:
env: CONAN_GCC_VERSIONS=6 CONAN_DOCKER_IMAGE=lasote/conangcc6
- <<: *linux
env: CONAN_GCC_VERSIONS=7 CONAN_DOCKER_IMAGE=lasote/conangcc7
- <<: *linux
env: CONAN_GCC_VERSIONS=8 CONAN_DOCKER_IMAGE=lasote/conangcc8
- <<: *linux
env: CONAN_CLANG_VERSIONS=3.9 CONAN_DOCKER_IMAGE=lasote/conanclang39
- <<: *linux
env: CONAN_CLANG_VERSIONS=4.0 CONAN_DOCKER_IMAGE=lasote/conanclang40
- <<: *linux
env: CONAN_CLANG_VERSIONS=5.0 CONAN_DOCKER_IMAGE=lasote/conanclang50
- <<: *linux
env: CONAN_CLANG_VERSIONS=6.0 CONAN_DOCKER_IMAGE=lasote/conanclang60
- <<: *osx
osx_image: xcode7.3
env: CONAN_APPLE_CLANG_VERSIONS=7.3
Expand All @@ -31,6 +37,9 @@ matrix:
- <<: *osx
osx_image: xcode9
env: CONAN_APPLE_CLANG_VERSIONS=9.0
- <<: *osx
osx_image: xcode9.3
env: CONAN_APPLE_CLANG_VERSIONS=9.1

install:
- chmod +x .travis/install.sh
Expand Down
21 changes: 15 additions & 6 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ class ProtobufConan(ConanFile):
name = "protobuf"
version = "3.5.1"
url = "https://github.com/bincrafters/conan-protobuf"
homepage = "https://github.com/google/protobuf"
author = "Bincrafters <[email protected]>"
description = "Conan.io recipe for Google Protocol Buffers"
license = "MIT"
license = "BSD"
exports = ["LICENSE.md"]
exports_sources = ["CMakeLists.txt"]
generators = "cmake"
Expand Down Expand Up @@ -46,28 +48,35 @@ def requirements(self):
self.requires("gtest/[>=1.7.0]@bincrafters/stable")

def source(self):
source_url = "https://github.com/google/protobuf"
tools.get("{0}/archive/v{1}.tar.gz".format(source_url, self.version))
tools.get("{0}/archive/v{1}.tar.gz".format(self.homepage, self.version))
extracted_dir = self.name + "-" + self.version

#Rename to "source_subfolder" is a convention to simplify later steps
os.rename(extracted_dir, self.source_subfolder)

def build(self):
def configure_cmake(self):
cmake = CMake(self)
cmake.definitions["CMAKE_INSTALL_LIBDIR"] = "lib"
cmake.definitions["protobuf_BUILD_TESTS"] = self.options.build_tests
cmake.definitions["protobuf_BUILD_PROTOC_BINARIES"] = self.options.build_binaries
cmake.definitions["protobuf_MSVC_STATIC_RUNTIME"] = self.options.static_rt
cmake.definitions["protobuf_WITH_ZLIB"] = self.options.with_zlib
if self.settings.compiler != 'Visual Studio':
cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.fPIC
# TODO: option 'shared' not enabled cmake.definitions["protobuf_BUILD_SHARED_LIBS"] = self.options.shared
cmake.configure(build_folder=self.build_subfolder)
return cmake

def build(self):
cmake = self.configure_cmake()
cmake.build()
if self.options.build_tests:
self.run("ctest")

def package(self):
self.copy(pattern="LICENSE", dst="licenses", src=self.source_subfolder)
cmake = self.configure_cmake()
cmake.install()

def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
if self.settings.os == "Linux":
self.cpp_info.libs.append("pthread")