Commit bdbdf33f617395c96b5ddeae3210174de978c221

Authored by Stéphane Raimbault
1 parent cc7591bb

Add WAF scripts to build the libmodbus and the associated tests.

.bzrignore
... ... @@ -21,3 +21,4 @@ src/modbus.lo
21 21 src/test-modbus-master
22 22 src/test-modbus-slave
23 23 modbus.pc
  24 +_build_
... ...
src/wscript 0 → 100644
  1 +def build(bld):
  2 + obj = bld.create_obj('cc', 'shlib')
  3 + obj.source = 'modbus.c'
  4 + obj.includes = '.'
  5 + obj.uselib = 'GLIB'
  6 + obj.target = 'modbus'
  7 + obj.vnum = '1.2.4'
  8 +
  9 + obj = bld.create_obj('cc', 'program')
  10 + obj.source = 'test-modbus-master.c'
  11 + obj.includes = '.'
  12 + obj.uselib_local = 'modbus'
  13 + obj.target = 'test-modbus-master'
  14 +
  15 + obj = bld.create_obj('cc', 'program')
  16 + obj.source = 'test-modbus-slave.c'
  17 + obj.includes = '.'
  18 + obj.uselib_local = 'modbus'
  19 + obj.target = 'test-modbus-slave'
... ...
wscript 0 → 100644
  1 +#! /usr/bin/env python
  2 +# encoding: utf-8
  3 +
  4 +VERSION='1.2.4'
  5 +APPNAME='libmodbus'
  6 +
  7 +# these variables are mandatory ('/' are converted automatically)
  8 +srcdir = '.'
  9 +blddir = '_build_'
  10 +
  11 +def init():
  12 + print "A groovy libmodbus for Linux!"
  13 +
  14 +def set_options(opt):
  15 + # options provided by the modules
  16 + opt.tool_options('compiler_cc')
  17 +
  18 +def configure(conf):
  19 + conf.check_tool('compiler_cc')
  20 + conf.check_pkg('glib-2.0', destvar='GLIB', mandatory=True)
  21 +
  22 + e = conf.create_header_enumerator()
  23 + e.mandatory = 1
  24 + # Add AC_CHECK_HEADERS([arpa/inet.h fcntl.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h termio.h termios.h unistd.h])
  25 + e.name = 'arpa/inet.h'
  26 + e.run()
  27 +
  28 + # Add AC_CHECK_FUNCS([inet_ntoa memset select socket])
  29 + conf.define('VERSION', VERSION)
  30 + conf.define('PACKAGE', 'libmodbus')
  31 +
  32 + conf.write_config_header()
  33 +
  34 +def build(bld):
  35 + bld.add_subdirs('src');
  36 +
  37 +# Doesn't work I need some help from the WAF project
  38 +# obj = bld.create_obj('subst')
  39 +# obj.source = 'modbus.pc.in'
  40 +# obj.target = 'modbus.pc'
  41 +# obj.dict = {'VERSION' : VERSION }
  42 +
  43 +def shutdown():
  44 + import UnitTest
  45 + unittest = UnitTest.unit_test()
  46 + unittest.run()
  47 + unittest.print_results()
... ...