-
Notifications
You must be signed in to change notification settings - Fork 3
/
ode.py
64 lines (51 loc) · 1.41 KB
/
ode.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
#! /usr/bin/env python
# encoding: utf-8
# JB Mouret - 2009
"""
Quick n dirty ODE detection
"""
import os, glob, types
import commands
from waflib.Configure import conf
import re
def options(opt):
pass
@conf
def check_ode(conf):
env = conf.env
ret = conf.find_program('ode-config')
print 'Checking for ODE (optional)'
if not ret:
print 'not found', 'YELLOW'
return 0
print 'ok'
res = commands.getoutput('ode-config --cflags --libs')
# conf.parse_flags seems to do not parse anything at all.......
res=re.split(" |\n",res)
#ugly handmade parser:
for word in res:
if word.startswith('-I'):
if env['INCLUDES_ODE']:
env['INCLUDES_ODE'].append(word[2:])
else:
env['INCLUDES_ODE']=word[2:]
if word.startswith('-L'):
if env['LIBPATH_ODE']:
env['LIBPATH_ODE'].append(word[2:])
else:
env['LIBPATH_ODE']=word[2:]
if word.startswith('-l'):
if env['LIB_ODE']:
env['LIB_ODE'].append(word[2:])
else:
env['LIB_ODE']=word[2:]
if word.startswith('-D'):
if env['CXXFLAGS_ODE']:
env['CXXFLAGS_ODE'].append(word)
else:
env['CXXFLAGS_ODE']=word
return 1
def detect(conf):
return detect_ode(conf)
def set_options(opt):
pass