-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconanfile.py
More file actions
82 lines (73 loc) · 3.89 KB
/
conanfile.py
File metadata and controls
82 lines (73 loc) · 3.89 KB
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
from conans import ConanFile, CMake, tools, AutoToolsBuildEnvironment, RunEnvironment
from conans.errors import ConanInvalidConfiguration, ConanException
from conans.tools import os_info
import os, re, stat, fnmatch, platform, glob
from functools import total_ordering
class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake", "cmake_paths", "virtualenv", "cmake_find_package_multi"
topics = ('c++')
def build(self):
bin_path = ""
for p in self.deps_cpp_info.bin_paths:
bin_path = "%s%s%s" % (p, os.pathsep, bin_path)
lib_path = ""
for p in self.deps_cpp_info.lib_paths:
lib_path = "%s%s%s" % (p, os.pathsep, lib_path)
env = {
"PATH": "%s:%s" % (bin_path, os.environ['PATH']),
"LD_LIBRARY_PATH": "%s:%s" % (lib_path, os.environ['LD_LIBRARY_PATH'])
}
self.output.info("=================linux environment for %s=================\n" % (self.name))
self.output.info('PATH = %s' % (env['PATH']))
self.output.info('LD_LIBRARY_PATH = %s' % (env['LD_LIBRARY_PATH']))
self.output.info('')
with tools.environment_append(env):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if not tools.cross_building(self.settings):
self.output.info('self.source_folder = %s' % (self.source_folder))
ext = ".so" if os_info.is_linux else ".dll"
#
flex_reflect_plugin_ROOT = self.deps_cpp_info["flex_reflect_plugin"].rootpath
flex_reflect_plugin_file = flex_reflect_plugin_ROOT
flex_reflect_plugin_file = os.path.join(flex_reflect_plugin_file, "lib")
flex_reflect_plugin_file = os.path.join(flex_reflect_plugin_file, "flex_reflect_plugin" + ext)
self.output.info('flex_reflect_plugin_file = %s' % (flex_reflect_plugin_file))
#
flex_meta_plugin_ROOT = self.deps_cpp_info["flex_meta_plugin"].rootpath
flex_meta_plugin_file = flex_meta_plugin_ROOT
flex_meta_plugin_file = os.path.join(flex_meta_plugin_file, "lib")
flex_meta_plugin_file = os.path.join(flex_meta_plugin_file, "flex_meta_plugin" + ext)
self.output.info('flex_meta_plugin_file = %s' % (flex_meta_plugin_file))
#
# cling_includes must point to cling/Interpreter/RuntimeUniverse.h
cling_conan_ROOT = self.deps_cpp_info["cling_conan"].rootpath
cling_includes = cling_conan_ROOT
cling_includes = os.path.join(cling_includes, "include")
self.output.info('cling_includes = %s' % (cling_includes))
#
# clang_includes must point to stddef.h from lib/clang/9.0.1/include
clang_includes = cling_conan_ROOT
clang_includes = os.path.join(clang_includes, "lib")
clang_includes = os.path.join(clang_includes, "clang")
clang_includes = os.path.join(clang_includes, "9.0.1")
clang_includes = os.path.join(clang_includes, "include")
if not os.path.isdir(clang_includes):
raise Exception('ERROR: Unable to find directory %s' % (clang_includes))
self.output.info('clang_includes = %s' % (clang_includes))
#
flextool_cmd = os.environ['flextool_BIN'] \
" --outdir ." \
" --indir ." \
" --vmodule=*=100 --enable-logging=stderr --log-level=100" \
" --load_plugin {}" \
" --load_plugin {}" \
" --extra-arg=-I{}" \
" --extra-arg=-I{}" \
" {}/main.cpp".format(
flex_reflect_plugin_file, flex_meta_plugin_file, cling_includes, clang_includes, self.source_folder)
self.output.info('flextool_cmd = %s' % (flextool_cmd))
self.run(flextool_cmd, run_environment=True)