1from conans import ConanFile, CMake, tools 2from os import path 3 4class NanoPbConan(ConanFile): 5 name = "nanopb" 6 version = "0.4.7" 7 license = "zlib" 8 url = "https://jpa.kapsi.fi/nanopb/" 9 description = "Protocol Buffers with small code size" 10 settings = "os_build", "compiler", "build_type", "arch" 11 generators = "cmake" 12 exports = '*' 13 options = { 14 "fPIC": [True, False], 15 } 16 default_options = { 17 "fPIC": True, 18 } 19 20 def configure(self): 21 if self.settings.os_build == "Windows" and self.settings.compiler == "Visual Studio": 22 del self.options.fPIC 23 24 def build(self): 25 cmake = CMake(self) 26 cmake.configure(source_folder=path.join(self.source_folder, "conan-wrapper")) 27 cmake.build() 28 cmake.install() 29 30 def package_info(self): 31 self.cpp_info.includedirs = ["include"] 32 self.cpp_info.libdirs = ["lib"] 33 self.cpp_info.libs = ["protobuf-nanopb"] 34