Created
July 4, 2019 01:35
-
-
Save JavierJF/1036bcb83d2a7410eff492e9d83444b7 to your computer and use it in GitHub Desktop.
Example of conanfile.py consuming dependencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from conans import ConanFile, CMake, tools | |
import os | |
class VaultServiceConan(ConanFile): | |
name = "VaultService" | |
version = "0.1" | |
license = "GNU GPL v3" | |
url = "https://gitlab.com/philabs/VaultService" | |
settings = "os", "compiler", "build_type", "arch" | |
options = {"shared": [True, False], "tests": [True, False]} | |
generators = "cmake" | |
requires = ( | |
"UErrno/0.1@javjarfer/testing", | |
"StdWrapper/0.1@javjarfer/testing", | |
"Phi/0.1@javjarfer/testing", | |
"gtest/1.8.0@bincrafters/stable", | |
"rapidjson/1.1.0@bincrafters/stable", | |
"boost_asio/1.66.0@bincrafters/stable", | |
"boost_lexical_cast/1.66.0@bincrafters/stable", | |
"OpenSSL/1.0.2q@conan/stable", | |
"libpqxx/6.2.4@philabs/stable" | |
) | |
default_options = ( | |
"shared=False", | |
"tests=False", | |
# GTest options | |
"gtest:shared=False" | |
) | |
def source(self): | |
self.run("git clone https://gitlab.com/philabs/VaultService") | |
self.run("cd VaultService && git checkout develop") | |
def build(self): | |
cmake = CMake(self, parallel=True) | |
if self.options.tests: | |
cmake.definitions["CMAKE_BUILD_TESTS"] = "ON" | |
cmake.definitions["BUILD_SHARED_LIBS"] = "ON" | |
cmake.configure(source_folder="VaultService") | |
cmake.build(target="install") | |
def imports(self): | |
self.copy("*.dll", "bin") | |
def package(self): | |
self.copy("*.h", dst="include", src="VaultService/include") | |
self.copy("*Service.lib", dst="lib", keep_path=False) | |
self.copy("*.dll", dst="lib", keep_path=False) | |
self.copy("*.so", dst="lib", keep_path=False) | |
self.copy("*.dylib", dst="lib", keep_path=False) | |
self.copy("*.a", dst="lib", keep_path=False) | |
def package_info(self): | |
self.cpp_info.libs = ["VService"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment