-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
102 lines (81 loc) · 3.48 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
from conan import ConanFile, tools
from conan.tools.scm import Git
from conan.tools.cmake import CMake
from conan.tools.files import get, copy
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout
import os
class ArmGccConan(ConanFile):
name = "gtest"
license = "GPL-3.0-only"
homepage = ""
author = "Ostanin <[email protected]>"
description = "gtests"
topics = ("conan", "gtest", "arm")
settings = "os", "arch", "compiler", "build_type"
package_type = "application"
exports_sources = "CMakeLists.txt"
generators = "CMakeDeps", "CMakeToolchain"
url = "https://github.com/google/googletest.git"
# generators = "CMakeDeps"
def system_requirements(self):
print("GTEST_PYTHON_REQUIREMENTS")
def requirements(self):
print("REQUIRES")
# Указываем зависимости от тулчейнов
self.requires("gcc/13")
def validate(self):
print("GTEST_VALIDATION")
def package_id(self):
print("GTEST_PACKAGE_ID")
def source(self):
print("GTEST_SOURCE")
tag = self.version
git = Git(self)
if not os.path.exists("./gtest"):
git.clone(self.url, "./gtest")
print("project cloned. It contains..")
self.run(f"ls -la ./gtest")
self.run(f"cd ./gtest && git checkout {tag}")
def generate(self):
toolchain = tools.cmake.CMakeToolchain.filename
with open(toolchain, 'r') as template_file:
template_content = template_file.read()
with open(toolchain, "w") as file:
file.write(template_content)
file.write("include(arm-gcc-toolchain)\n")
def build(self):
print("GTEST_BUILD")
cmake = CMake(self)
cmake.configure( cli_args=[f"-B {self.package_folder}/build"])
self.run(f"cmake --build {self.package_folder}/build -j32")
self.run(f"cmake --install {self.package_folder}/build/ --prefix {self.package_folder}")
def package(self):
print("GTEST_PACKAGE")
# self.run(f"ls -la .")
copy(self, "source_url.txt", dst=self.package_folder, src=self.source_folder)
copy(self, "*.cmake", dst=self.package_folder + "/cmake", src=self.source_folder)
copy(self, "gtest/*", dst=self.package_folder, src=self.source_folder)
def package_info(self):
print("gtest_PACKAGE_INFO")
# for cpu in self.arm_cpus:
gtest_path = os.path.join(self.package_folder, "lib/cmake/GTest")
print(f"gtest lib path is {gtest_path}")
self.cpp_info.builddirs.append(gtest_path)
def package_id(self):
print("GCC_PACKAGE_ID")
# if self.settings_target is not None:
self.info.settings_target = self.settings_target
self.info.settings_target.rm_safe("compiler")
self.info.settings_target.rm_safe("build_type")
# self.info.settings_target.os = self.info.settings.os
# self.info.settings_target.arch = self.info.settings.arch
# self.info.settings.rm_safe("os")
self.info.settings.rm_safe("compiler.cppstd")
# self.info.settings.rm_safe("os")
# self.info.settings.rm_safe("arch")
self.info.settings.rm_safe("build_type")
# self.info.settings.rm_safe("compiler")
self.info.settings.rm_safe("compiler.libcxx")
#conan list gtest/*:*
#conan create . --version=v1.15.2 -pr:h=./profiles/darwin -pr:b=./profiles/darwin -r=arm-tools --build-require
#conan upload gtest/v1.15.2 -r=arm-tools