forked from taocpp/taopq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
54 lines (47 loc) · 2.12 KB
/
conanfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from conans import ConanFile, CMake, tools
from conans.model.version import Version
from conans.errors import ConanInvalidConfiguration
class TaopqConan(ConanFile):
name = "taopq"
description = "C++ client library for PostgreSQL"
homepage = "https://github.com/taocpp/taopq"
url = homepage
license = "MIT"
author = "[email protected]"
settings = "os", "build_type", "compiler", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}
exports = "LICENSE"
exports_sources = "include/*", "src/*", "CMakeLists.txt", "cmake/*"
generators = "cmake"
requires = "libpq/9.6.9@bincrafters/stable"
def config_options(self):
if self.settings.os == "Windows":
self.options.remove("fPIC")
def configure(self):
compiler_version = Version(self.settings.compiler.version.value)
if (self.settings.compiler == "gcc" and compiler_version < "7") or \
(self.settings.compiler == "clang" and compiler_version < "5.0") or \
(self.settings.compiler == "clang" and compiler_version == "5.0" and \
self.settings.compiler.libcxx == "libc++") or \
(self.settings.compiler == "apple-clang" and compiler_version < "10") or \
(self.settings.compiler == "Visual Studio" and compiler_version < "15"):
raise ConanInvalidConfiguration("taocpp/taopq requires C++17 support")
def _configure_cmake(self):
cmake = CMake(self)
cmake.definitions["TAOPQ_BUILD_TESTS"] = False
cmake.definitions["TAOPQ_INSTALL_DOC_DIR"] = "licenses"
if self.settings.os == 'Windows' and self.settings.compiler == 'Visual Studio':
cmake.definitions["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = self.options.shared
cmake.configure()
return cmake
def build(self):
cmake = self._configure_cmake()
cmake.build()
def package(self):
cmake = self._configure_cmake()
cmake.install()
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)