-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
conanfile.py
43 lines (32 loc) · 1.2 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
from conan import ConanFile
from conan.tools.cmake import cmake_layout, CMakeDeps, CMakeToolchain, CMake
from conan.tools.env import VirtualRunEnv
from conan.tools.build import can_run
import os
class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
def layout(self):
cmake_layout(self)
def requirements(self):
self.requires(self.tested_reference_str)
def build_requirements(self):
# required for cmake_path support
self.tool_requires("cmake/[>=3.20 <4]")
def generate(self):
deps = CMakeDeps(self)
deps.check_components_exist = True
deps.generate()
tc = CMakeToolchain(self)
if self.dependencies[self.tested_reference_str].options.shared:
tc.variables["LLVM_SHARED"] = True
tc.generate()
VirtualRunEnv(self).generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if can_run(self):
cmd = os.path.join(self.cpp.build.bindir, "test_package")
args = os.path.join(os.path.dirname(__file__), "test_function.ll")
self.run(f"{cmd} {args}", env="conanrun")