mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 12:05:50 +00:00
* Build Conan package on Travis CI (#4590) - Added multi package support on Linux, running on Travis CI - Only upload when branch is a tag and named "vX.Y.Z" - Replace Conan injection by Conan wrapper - Removed os_build os_arch -- Conan 1.0.1 hotfix Signed-off-by: Uilian Ries <uilianries@gmail.com> * Build Conan package on OSX (#4590) - Added jobs to build Flatbuffers on OSX running on Travis Signed-off-by: Uilian Ries <uilianries@gmail.com> * Build Conan package on Windows (#4590) - Added support necessary to build Flatbuffers on Windows (conan) - Added Appveyor jobs to build Conan package - Only build Conan package when release (tag) Signed-off-by: Uilian Ries <uilianries@gmail.com> * Reduce Conan CI support to simple scripts (#4590) - Removed msvc 10 x86_64 workaround - Updated conan remote address - Added Bincrafters' package tools Signed-off-by: Uilian Ries <uilianries@gmail.com> * Add fPIC option on Conan recipe (#4590) - Add fPIC as optional. It works on Linux and OSX - Update recipe metadata: author, homepage, license - Checking for flatc and flathash on Conan package Signed-off-by: Uilian Ries <uilianries@gmail.com> * Build Conan package on CI (#4590) - Add rule to run conan job only for tags - Run Conan on Linux, OSX and Windows - Update package tool to new interface Signed-off-by: Uilian Ries <uilianries@gmail.com> * Update Conan username (#4590) - Use google as default username Signed-off-by: Uilian Ries <uilianries@gmail.com> * Update OSX version on CI (#4590) - Use latest OSX 9.3 version to build Conan package Signed-off-by: Uilian Ries <uilianries@gmail.com>
75 lines
2.8 KiB
Python
75 lines
2.8 KiB
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""Conan recipe package for Google FlatBuffers
|
|
"""
|
|
import os
|
|
import shutil
|
|
from conans import ConanFile, CMake, tools
|
|
|
|
|
|
class FlatbuffersConan(ConanFile):
|
|
name = "flatbuffers"
|
|
version = "1.9.0"
|
|
license = "Apache-2.0"
|
|
url = "https://github.com/google/flatbuffers"
|
|
homepage = "http://google.github.io/flatbuffers/"
|
|
author = "Wouter van Oortmerssen"
|
|
description = "Memory Efficient Serialization Library"
|
|
settings = "os", "compiler", "build_type", "arch"
|
|
options = {"shared": [True, False], "fPIC": [True, False]}
|
|
default_options = "shared=False", "fPIC=True"
|
|
generators = "cmake"
|
|
exports = "LICENSE.txt"
|
|
exports_sources = ["CMake/*", "include/*", "src/*", "grpc/*", "CMakeLists.txt", "conan/CMakeLists.txt"]
|
|
|
|
def source(self):
|
|
"""Wrap the original CMake file to call conan_basic_setup
|
|
"""
|
|
shutil.move("CMakeLists.txt", "CMakeListsOriginal.txt")
|
|
shutil.move(os.path.join("conan", "CMakeLists.txt"), "CMakeLists.txt")
|
|
|
|
def config_options(self):
|
|
"""Remove fPIC option on Windows platform
|
|
"""
|
|
if self.settings.os == "Windows":
|
|
self.options.remove("fPIC")
|
|
|
|
def configure_cmake(self):
|
|
"""Create CMake instance and execute configure step
|
|
"""
|
|
cmake = CMake(self)
|
|
cmake.definitions["FLATBUFFERS_BUILD_TESTS"] = False
|
|
cmake.definitions["FLATBUFFERS_BUILD_SHAREDLIB"] = self.options.shared
|
|
cmake.definitions["FLATBUFFERS_BUILD_FLATLIB"] = not self.options.shared
|
|
cmake.configure()
|
|
return cmake
|
|
|
|
def build(self):
|
|
"""Configure, build and install FlatBuffers using CMake.
|
|
"""
|
|
cmake = self.configure_cmake()
|
|
cmake.build()
|
|
|
|
def package(self):
|
|
"""Copy Flatbuffers' artifacts to package folder
|
|
"""
|
|
cmake = self.configure_cmake()
|
|
cmake.install()
|
|
self.copy(pattern="LICENSE.txt", dst="licenses")
|
|
self.copy(pattern="flathash*", dst="bin", src="bin")
|
|
self.copy(pattern="flatc*", dst="bin", src="bin")
|
|
if self.settings.os == "Windows" and self.options.shared:
|
|
if self.settings.compiler == "Visual Studio":
|
|
shutil.move(os.path.join(self.package_folder, "lib", "%s.dll" % self.name),
|
|
os.path.join(self.package_folder, "bin", "%s.dll" % self.name))
|
|
elif self.settings.compiler == "gcc":
|
|
shutil.move(os.path.join(self.package_folder, "lib", "lib%s.dll" % self.name),
|
|
os.path.join(self.package_folder, "bin", "lib%s.dll" % self.name))
|
|
|
|
def package_info(self):
|
|
"""Collect built libraries names and solve flatc path.
|
|
"""
|
|
self.cpp_info.libs = tools.collect_libs(self)
|
|
self.user_info.flatc = os.path.join(self.package_folder, "bin", "flatc")
|