wscript 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. VERSION='2.0.3'
  4. APPNAME='libmodbus'
  5. # these variables are mandatory ('/' are converted automatically)
  6. srcdir = '.'
  7. blddir = 'build'
  8. def set_options(opt):
  9. # options provided by the modules
  10. opt.tool_options('compiler_cc')
  11. def configure(conf):
  12. conf.check_tool('compiler_cc')
  13. conf.check_tool('misc')
  14. headers = 'string.h termios.h sys/time.h \
  15. unistd.h errno.h limits.h fcntl.h \
  16. sys/types.h sys/socket.h sys/ioctl.h \
  17. netinet/in.h netinet/ip.h netinet/tcp.h arpa/inet.h'
  18. # check for headers and append found headers to headers_found for later use
  19. headers_found = []
  20. for header in headers.split():
  21. if conf.check_cc(header_name=header):
  22. headers_found.append(header)
  23. functions_headers = (
  24. ('setsockopt', 'sys/socket.h'),
  25. ('inet_ntoa', 'arpa/inet.h'),
  26. ('memset', 'string.h'),
  27. ('select', 'sys/select.h'),
  28. ('socket', 'sys/socket.h'),
  29. )
  30. for (function, headers) in functions_headers:
  31. conf.check_cc(function_name=function, header_name=headers, mandatory=1)
  32. conf.define('VERSION', VERSION)
  33. conf.define('PACKAGE', 'libmodbus')
  34. conf.write_config_header()
  35. def build(bld):
  36. import misc
  37. bld.add_subdirs('src tests')
  38. obj = bld.new_task_gen(features='subst',
  39. source='modbus.pc.in',
  40. target='modbus.pc',
  41. dict = {'VERSION' : VERSION,
  42. 'prefix': bld.env['PREFIX'],
  43. 'exec_prefix': bld.env['PREFIX'],
  44. 'libdir': bld.env['PREFIX'] + 'lib',
  45. 'includedir': bld.env['PREFIX'] + 'include'}
  46. )
  47. bld.install_files('${PREFIX}/lib/pkgconfig', 'modbus.pc')
  48. def shutdown():
  49. import UnitTest
  50. unittest = UnitTest.unit_test()
  51. unittest.run()
  52. unittest.print_results()