-
Notifications
You must be signed in to change notification settings - Fork 2
/
wscript
137 lines (106 loc) · 4.33 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from subprocess import Popen, PIPE, PIPE, check_call
from os import path
import os
import webbrowser
from itertools import chain
import sys
import ws.test
WAF_TOOLS = ["compiler_cxx", "boost"]
def options(ctx):
ctx.load(" ".join(WAF_TOOLS))
ctx.add_option(
'--with-llvm-config',
action='store',
default='llvm-config'
)
ctx.add_option(
'--release',
action='store_true',
default=False
)
def configure(ctx):
ctx.load(" ".join(WAF_TOOLS))
ctx.check(lib='pthread', mandatory=True, uselib_store='PTHREAD')
ctx.check(lib='dl', mandatory=True, uselib_store='DL')
ctx.check(lib='ncurses', mandatory=False, uselib_store='TINFO')
ctx.check(lib='tinfo', mandatory=False, uselib_store='TINFO')
ctx.check(lib='z', mandatory=True, uselib_store='Z')
ctx.check(lib='gmp', mandatory=True, uselib_store='GMP')
ctx.check(lib='ffi', mandatory=True, uselib_store='FFI')
ctx.check(lib='fmt', mandatory=True, uselib_store='fmt')
ctx.check_boost(lib="system program_options filesystem")
ctx.check_cfg(
path=ctx.options.with_llvm_config, package='',
args='--ldflags --cflags --libs all',
uselib_store='LLVM'
)
# HACK: Add clang as a llvm lib -- not sure how to do this with check
ctx.env["LIB_LLVM"].append("clang")
if ctx.env["CXX_NAME"] in ("gcc", "clang"):
ctx.env.append_unique("CXXFLAGS", "-std=gnu++1y")
if ctx.options.release:
ctx.env.append_unique("CXXFLAGS", "-Ofast")
else:
ctx.env.append_unique("CXXFLAGS", "-g")
ctx.env.append_unique("CXXFLAGS", "-O0")
ctx.env.append_unique("CXXFLAGS", "--coverage")
ctx.env.append_unique("LINKFLAGS", "--coverage")
ctx.env.append_unique("CXXFLAGS", "-Wall")
ctx.env.append_unique("CXXFLAGS", "-Wextra")
ctx.env.append_unique("CXXFLAGS", "-Wfatal-errors")
# ctx.env.append_unique("CXXFLAGS", "-Wsuggest-final-types")
# ctx.env.append_unique("CXXFLAGS", "-Wsuggest-final-methods")
# ctx.env.append_unique("CXXFLAGS", "-Wsuggest-override")
# ctx.env.append_unique("CXXFLAGS", "-Wsuggest-attribute=pure")
# ctx.env.append_unique("CXXFLAGS", "-Wsuggest-attribute=const")
# ctx.env.append_unique("CXXFLAGS", "-Wsuggest-attribute=noreturn")
# ctx.env.append_unique("CXXFLAGS", "-Weffc++")
ctx.env.append_unique("CXXFLAGS", "-Wpedantic")
ctx.env.append_unique("CXXFLAGS", "-Woverloaded-virtual")
ctx.env.append_unique("CXXFLAGS", "-Wno-unused-value")
ctx.env.append_unique("CXXFLAGS", "-Wno-unused-parameter")
ctx.env.append_unique("CXXFLAGS", "-Wno-pragmas")
# Create configurateion file with PREFIX
ctx.define("WAF_PREFIX", ctx.env["PREFIX"])
ctx.write_config_header("config.h")
def build(ctx):
start_dir = ctx.path.find_dir("modules")
ctx.install_files(
"${PREFIX}/lib/arrow/modules", start_dir.ant_glob('**/*.as'),
cwd=start_dir,
relative_trick=True)
ctx.program(source=ctx.path.ant_glob("src/**/*.cpp"),
includes=[
"include",
"vendor/mach7/code",
"vendor/rapidjson/include",
"vendor/utfcpp/source",
"build",
],
target="arrow",
use=["BOOST", "LLVM", "PTHREAD", "DL", "TINFO", "Z", "GMP",
"FFI", "fmt", "CLANG"])
# Delete all *.gcda files
# BUG: Otherwise lots of chaos happens when running a debug build
# several times on macOS
check_call(["find", "build", "-name", "*.gcda", "-delete"])
def test(ctx):
result = ws.test.run(ctx)
if not result:
sys.exit(1)
# def generate(ctx):
# ws.test.generate(ctx)
def coverage(ctx):
# Copy all source files into the build directory
# HACK: If someone can get this working without this step, be my guest
check_call(["cp", "-r", "./src", "./build"]);
# Generate HTML coverage
check_call(["rm", "-rf", "coverage"])
check_call(["mkdir", "-p", "coverage"])
check_call([
"gcovr", "-r", "build/src", "--html", "--html-details",
"-o", "coverage/index.html"])
# Generate coverage report
check_call(["gcovr", "-r", "build/src", "-s"])