wscript
2.04 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
#! /usr/bin/env python
# encoding: utf-8
VERSION = '2.2.0'
APPNAME = 'libmodbus'
# these variables are mandatory ('/' are converted automatically)
srcdir = '.'
blddir = 'build'
def set_options(opt):
# options provided by the modules
opt.tool_options('compiler_cc')
def configure(conf):
conf.check_tool('compiler_cc')
conf.check_tool('misc')
headers = 'string.h termios.h sys/time.h \
unistd.h errno.h limits.h fcntl.h \
sys/types.h sys/socket.h sys/ioctl.h \
netinet/in.h netinet/ip.h netinet/tcp.h arpa/inet.h'
# check for headers and append found headers to headers_found for later use
headers_found = []
for header in headers.split():
if conf.check_cc(header_name=header):
headers_found.append(header)
functions_headers = (
('setsockopt', 'sys/socket.h'),
('inet_ntoa', 'arpa/inet.h'),
('memset', 'string.h'),
('select', 'sys/select.h'),
('socket', 'sys/socket.h'),
)
for (function, headers) in functions_headers:
conf.check_cc(function_name=function, header_name=headers, mandatory=1)
conf.define('VERSION', VERSION)
conf.define('PACKAGE', 'libmodbus')
conf.write_config_header('config.h')
def build(bld):
import misc
bld.add_subdirs('src tests')
obj = bld.new_task_gen(features='subst',
source='modbus.pc.in',
target='modbus.pc',
dict = {'VERSION' : VERSION,
'prefix': bld.env['PREFIX'],
'exec_prefix': bld.env['PREFIX'],
'libdir': bld.env['PREFIX'] + 'lib',
'includedir': bld.env['PREFIX'] + 'include'}
)
bld.install_files('${PREFIX}/lib/pkgconfig', 'modbus.pc')
def shutdown():
import UnitTest
unittest = UnitTest.unit_test()
unittest.run()
unittest.print_results()