-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwscript
98 lines (78 loc) · 3.53 KB
/
wscript
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
#! /usr/bin/env python
packages = "compiler_c compiler_cxx waf_unit_test gccdeps why local_rpath"
src_extensions = ("c", "C", "cc", "cpp", "CPP", "c++", "cp", "cxx", "proto", "dasc")
def getsrc(ctx, d):
from os.path import join as pjoin
r = []
for h in src_extensions:
r.extend(ctx.path.ant_glob(pjoin(d, "**."+h)))
return r
def make_programs(bld, d, **kwargs):
from os import listdir
from os.path import exists, basename, isdir, join as pjoin
if not exists(d):
return
for app in listdir(d):
if any(app.endswith(ext) for ext in src_extensions):
bld.program(source=pjoin(d, app), target=app.split(".")[0], **kwargs)
elif isdir(pjoin(d, app)):
kwargs = dict(kwargs)
kwargs["includes"] = " ".join((kwargs.get("includes", ""), pjoin(d,app)))
bld.program(source=getsrc(bld, pjoin(d, app)), target=app, **kwargs)
def go(ctx):
from waflib.Options import commands, options
commands += ["configure", "build"]
def options(opt):
opt.load(packages)
def configure(conf):
import os, os.path
if not os.path.exists("src/lib/zerocc/test.cc"):
if os.system("git submodule update --init") != 0:
conf.fatal("Could not initialize necessary submodules!")
conf.load(packages)
conf.load("protoc", tooldir="waf-tools")
conf.get_cc_version(conf.env.CXX)
cxxexe = os.path.basename(str(conf.env.CXX))
if cxxexe.startswith("g++") and conf.env.CC_VERSION < ("4","6"):
conf.fatal("We require at least gcc 4.6 at this time.")
conf.env.append_value("CXXFLAGS", ["-std=c++0x", "-ggdb", "-O3"])
conf.env.append_value("LINKFLAGS", ["-Wl,--no-as-needed"])
conf.env.CXXFLAGS_PIC = "-fPIC"
#conf.env.append_value("RPATH", [conf.env.LIBDIR])
conf.check_cfg(package="protobuf", uselib_store="protobuf", args="--libs --cflags", mandatory=True)
conf.check_cfg(path="root-config", package="", uselib_store="root", args='--libs --cflags', mandatory=False)
conf.check_cxx(lib="pcre", uselib_store="pcre", define_name="PCRE", mandatory=False)
def build(bld):
from os.path import join as pjoin
bld.load(packages + " print_commands")
bld.load("protoc", tooldir="waf-tools")
bld.stlib(source=getsrc(bld, "src/lib/zerocc"),
target="zerocc",
use="protobuf PIC",
includes="src/lib/zerocc")
bld.shlib(source=getsrc(bld, "src/lib/drillbit"),
target="drillbit",
use="protobuf zerocc",
includes="src/lib/drillbit src/lib/zerocc")
bld.shlib(source=getsrc(bld, "src/lib/drillbit_root"),
target="drillbit_root",
use="protobuf root drillbit zerocc",
includes="src/lib/drillbit src/lib/drillbit_root src/lib")
for p in ("src/lib/drillbit", "src/lib/drillbit_root"):
cwd = bld.path.find_node(p)
bld.install_files('${PREFIX}/include',
cwd.ant_glob("drillbit/**.h"),
cwd=cwd,
relative_trick=True)
make_programs(bld, "src/apps",
use="protobuf drillbit",
includes="src/lib/drillbit")
make_programs(bld, "src/apps_root",
use="protobuf root drillbit drillbit_root",
includes="src/lib/drillbit src/lib/drillbit_root")
make_programs(bld, "src/tests",
features="test",
use="protobuf root drillbit drillbit_root",
includes="src/lib/drillbit src/lib/drillbit_root")
from waflib.Tools import waf_unit_test
bld.add_post_fun(waf_unit_test.summary)