-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconanfile.py
executable file
·66 lines (53 loc) · 2.39 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
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from conans import ConanFile, CMake, tools
import glob
import os
class MysqlConnectorCConan(ConanFile):
name = "mysql-connector-c++"
version = "8.0.18"
url = "https://github.com/Zinnion/conan-percona-server"
description = "A MySQL client library for C development."
topics = ("conan", "mysql", "sql", "connector", "database")
homepage = "https://cdn.mysql.com//Downloads/Connector-C++"
#homepage = "https://cdn.mysql.com//Downloads/Connector-C++/mysql-connector-c++-8.0.18-linux-glibc2.12-x86-64bit.tar.gz"
author = "Zinnion <[email protected]>"
license = "GPL-2.0"
exports = ["LICENSE.md"]
exports_sources = ["CMakeLists.txt"]
generators = "cmake"
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [True, False], "with_ssl": [True, False], "with_zlib": [True, False]}
default_options = {'shared': False, 'with_ssl': True, 'with_zlib': True}
_source_subfolder = "source_subfolder"
def config_options(self):
del self.settings.compiler.libcxx
def requirements(self):
if self.options.with_ssl:
self.requires.add("OpenSSL/1.1.1b@zinnion/stable")
if self.options.with_zlib:
self.requires.add("zlib/1.2.11@zinnion/stable")
def source(self):
tools.get("{0}/mysql-connector-c++-{1}-src.tar.gz".format(self.homepage, self.version))
extracted_dir = "mysql-connector-c++-" + self.version + "-src"
os.rename(extracted_dir, self._source_subfolder)
sources_cmake = os.path.join(self._source_subfolder, "CMakeLists.txt")
sources_cmake_orig = os.path.join(self._source_subfolder, "CMakeListsOriginal.txt")
os.rename(sources_cmake, sources_cmake_orig)
os.rename("CMakeLists.txt", sources_cmake)
def build(self):
cmake = CMake(self)
if self.options.with_ssl:
cmake.definitions["WITH_SSL"] = "system"
if self.options.with_zlib:
cmake.definitions["WITH_ZLIB"] = "system"
cmake.configure(source_dir=self._source_subfolder)
cmake.build()
cmake.install()
def package(self):
pass
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
if self.settings.build_type == "Debug":
self.cpp_info.libdirs = ["lib/debug"]
self.cpp_info.libs = ["mysqlcppconn8"]