-
Notifications
You must be signed in to change notification settings - Fork 0
/
find_gsl.py
75 lines (59 loc) · 1.49 KB
/
find_gsl.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
# -*- python -*-
# stdlib imports ---
import os
import os.path as osp
# waf imports ---
import waflib.Utils
import waflib.Logs as msg
from waflib.Configure import conf
#
_heptooldir = osp.dirname(osp.abspath(__file__))
def options(opt):
opt.load('hwaf-base', tooldir=_heptooldir)
opt.add_option(
'--with-gsl',
default=None,
help="Look for GSL at the given path")
return
def configure(conf):
conf.load('hwaf-base', tooldir=_heptooldir)
return
@conf
def find_gsl(ctx, **kwargs):
if not ctx.env.HWAF_FOUND_C_COMPILER:
ctx.fatal('load a C compiler first')
pass
if not ctx.env.HWAF_FOUND_CXX_COMPILER:
ctx.fatal('load a C++ compiler first')
pass
ctx.check_with(
ctx.check_cfg,
"gsl",
package="",
path="gsl-config",
uselib_store="gsl",
args='--cflags --libs --ldflags',
**kwargs)
version = ctx.check_cxx(
msg="Checking GSL version",
okmsg="ok",
fragment='''\
#include <gsl/gsl_version.h>
#include <iostream>
int main(int argc, char* argv[]) {
std::cout << GSL_VERSION;
return 0;
}
''',
use="gsl",
define_name = "HWAF_GSL_VERSION",
define_ret = True,
execute = True,
mandatory=True,
)
ctx.start_msg("GSL version")
ctx.end_msg(version)
ctx.env.GSL_VERSION = version
ctx.env.HWAF_FOUND_GSL = 1
return
## EOF ##