Преглед изворни кода

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

Stéphane Raimbault пре 17 година
родитељ
комит
bdbdf33f61
3 измењених фајлова са 67 додато и 0 уклоњено
  1. 1 0
      .bzrignore
  2. 19 0
      src/wscript
  3. 47 0
      wscript

+ 1 - 0
.bzrignore

@@ -21,3 +21,4 @@ src/modbus.lo
 src/test-modbus-master
 src/test-modbus-slave
 modbus.pc
+_build_

+ 19 - 0
src/wscript

@@ -0,0 +1,19 @@
+def build(bld):
+    obj = bld.create_obj('cc', 'shlib')
+    obj.source = 'modbus.c'
+    obj.includes = '.'
+    obj.uselib = 'GLIB'
+    obj.target = 'modbus'
+    obj.vnum = '1.2.4'
+
+    obj = bld.create_obj('cc', 'program')
+    obj.source = 'test-modbus-master.c'
+    obj.includes = '.'
+    obj.uselib_local = 'modbus'
+    obj.target = 'test-modbus-master'
+
+    obj = bld.create_obj('cc', 'program')
+    obj.source = 'test-modbus-slave.c'
+    obj.includes = '.'
+    obj.uselib_local = 'modbus'
+    obj.target = 'test-modbus-slave'

+ 47 - 0
wscript

@@ -0,0 +1,47 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+VERSION='1.2.4'
+APPNAME='libmodbus'
+
+# these variables are mandatory ('/' are converted automatically)
+srcdir = '.'
+blddir = '_build_'
+
+def init():
+     print "A groovy libmodbus for Linux!"
+
+def set_options(opt):
+     # options provided by the modules
+     opt.tool_options('compiler_cc')
+
+def configure(conf):
+     conf.check_tool('compiler_cc')
+     conf.check_pkg('glib-2.0', destvar='GLIB', mandatory=True)
+
+     e = conf.create_header_enumerator()
+     e.mandatory = 1
+     # 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])
+     e.name = 'arpa/inet.h'
+     e.run()
+
+     # Add AC_CHECK_FUNCS([inet_ntoa memset select socket])
+     conf.define('VERSION', VERSION)
+     conf.define('PACKAGE', 'libmodbus')
+
+     conf.write_config_header()
+
+def build(bld):
+     bld.add_subdirs('src');  
+
+#    Doesn't work I need some help from the WAF project
+#      obj = bld.create_obj('subst')
+#      obj.source = 'modbus.pc.in'
+#      obj.target = 'modbus.pc'
+#      obj.dict = {'VERSION' : VERSION }
+
+def shutdown():
+     import UnitTest
+     unittest = UnitTest.unit_test()
+     unittest.run()
+     unittest.print_results()