generated from Sithas/conan_template
Вроде успешная установка через Conan
This commit is contained in:
@@ -13,6 +13,7 @@ conan export custom_recipes/openssl_fix/ --user=up_and_down --channel=stable
|
||||
conan export custom_recipes/lz4_fix/ --user=up_and_down --channel=stable
|
||||
conan export custom_recipes/zlib_fix/ --user=up_and_down --channel=stable
|
||||
conan export custom_recipes/zstd_fix/ --user=up_and_down --channel=stable
|
||||
conan export custom_recipes/libmysqlclient_fix/ --user=up_and_down --channel=stable
|
||||
|
||||
// Запуск дебага
|
||||
conan install . -pr ./profiles/debug_profile --output-folder=cmake-build-debug --build=missing
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ class UpAndDown(ConanFile):
|
||||
|
||||
def requirements(self):
|
||||
self.requires("boost/1.87.0@up_and_down/stable")
|
||||
self.requires("libmysqlclient/8.1.0")
|
||||
self.requires("libmysqlclient/8.1.0@up_and_down/stable", override=True)
|
||||
self.requires("lz4/1.10.0@up_and_down/stable", override=True)
|
||||
self.requires("openssl/3.5.0@up_and_down/stable", force=True)
|
||||
self.requires("zlib/1.3.1@up_and_down/stable", override=True)
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
sources:
|
||||
"8.1.0":
|
||||
url: "https://dev.mysql.com/get/Downloads/MySQL-8.1/mysql-8.1.0.tar.gz"
|
||||
sha256: "3dd017a940734aa90796a4c65e125e6712f64bbbbe3388d36469deaa87b599eb"
|
||||
@@ -0,0 +1,96 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||
from conan.tools.files import get, copy, rmdir
|
||||
import os
|
||||
|
||||
class LibmysqlclientConan(ConanFile):
|
||||
name = "libmysqlclient"
|
||||
version = "8.1.0"
|
||||
description = "MySQL client library"
|
||||
license = "GPL-2.0"
|
||||
url = "https://dev.mysql.com/"
|
||||
homepage = "https://www.mysql.com"
|
||||
topics = ("mysql", "database", "sql")
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
}
|
||||
|
||||
def config_options(self):
|
||||
if self.settings.os == "Windows":
|
||||
del self.options.fPIC
|
||||
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
self.options.rm_safe("fPIC")
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self, src_folder="src")
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
|
||||
# Критически важные настройки
|
||||
tc.variables["WITHOUT_SERVER"] = "ON"
|
||||
tc.variables["WITH_UNIT_TESTS"] = "OFF"
|
||||
tc.variables["DISABLE_SHARED"] = "OFF" if self.options.shared else "ON"
|
||||
tc.variables["DISABLE_STATIC"] = "ON" if self.options.shared else "OFF"
|
||||
|
||||
# Настройки для Windows
|
||||
if self.settings.os == "Windows":
|
||||
tc.variables["WITH_SSL"] = "schannel"
|
||||
tc.variables["WITH_ZLIB"] = "bundled"
|
||||
if "MD" in str(self.settings.compiler.runtime):
|
||||
tc.variables["WINDOWS_RUNTIME_MD"] = "ON"
|
||||
else:
|
||||
tc.variables["WITH_SSL"] = "system"
|
||||
tc.variables["WITH_ZLIB"] = "system"
|
||||
|
||||
tc.generate()
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
self.run("cmake --version")
|
||||
self.run("cmake -E chdir . ls -la", shell=True)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
|
||||
# Копируем только необходимые файлы
|
||||
copy(self, "*.h",
|
||||
src=os.path.join(self.source_folder, "include"),
|
||||
dst=os.path.join(self.package_folder, "include"))
|
||||
|
||||
copy(self, "*.lib",
|
||||
src=os.path.join(self.build_folder, "library_output_directory"),
|
||||
dst=os.path.join(self.package_folder, "lib"))
|
||||
|
||||
copy(self, "*.dll",
|
||||
src=os.path.join(self.build_folder, "library_output_directory"),
|
||||
dst=os.path.join(self.package_folder, "bin"))
|
||||
|
||||
# Удаляем ненужные файлы
|
||||
rmdir(self, os.path.join(self.package_folder, "docs"))
|
||||
rmdir(self, os.path.join(self.package_folder, "share"))
|
||||
rmdir(self, os.path.join(self.package_folder, "bin", "Debug"))
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.libs = ["mysqlclient"]
|
||||
self.cpp_info.includedirs = ["include", "include/mysql"]
|
||||
|
||||
if self.settings.os == "Windows":
|
||||
self.cpp_info.system_libs = ["ws2_32", "crypt32", "secur32", "shlwapi", "advapi32"]
|
||||
if self.options.shared:
|
||||
self.cpp_info.defines = ["LIBMYSQL_DYNAMIC"]
|
||||
Reference in New Issue
Block a user