Commits

Leonard Ritter committed 0b5103f

installer for datalayer compiler

  • Participants
  • Parent commits b74ac23

Comments (0)

Files changed (6)

 SConsEnvironment.Chmod = SCons.Action.ActionFactory(os.chmod,
 		lambda dest, mode: 'Chmod: "%s" with 0%o' % (dest, mode))
 
+# 755 = rwxr-xr-x
 def InstallPerm(env, dir, source, perm):
 	obj = env.Install(dir, source)
 	for i in obj:
 env.SConsignFile()
 
 assert not env['DESTDIR'] or os.path.isabs(env['DESTDIR']), "%s must be an absolute path." % env['DESTDIR']
-assert not env['DESTDIR'] or os.path.isabs(env['PREFIX']), "%s must be an absolute path." % env['PREFIX']
+assert not env['PREFIX'] or os.path.isabs(env['PREFIX']), "%s must be an absolute path." % env['PREFIX']
 
 opts.Save('options.conf', env)
 Help( opts.GenerateHelpText( env ) )
 Export('LocalEnvironment')
 SConscript([
     #'lib/groundwork/SConscript',
+    'bin/SConscript',
     'src/core/SConscript',
+    'examples/datalayer/SConscript',
 ])
 
 Import('core')

File bin/SConscript

+Import('LocalEnvironment')
+
+env = LocalEnvironment()
+env.install('${DESTDIR}${PREFIX}/bin', 'dlc', 0755)
+#!/usr/bin/env python
+import sys
+from groundwork.datalayer.dlc import run
+
+run(sys.argv)

File examples/datalayer/SConscript

+# still empty

File lib/groundwork/datalayer/dlc.py

 * http://wiki.blender.org/index.php/Dev:2.5/Source/Architecture/DataAPI
 """
 import os
+from optparse import OptionParser
 from groundwork.datalayer.pyscanner import Scanner
 
 class TypeDef(object):
         
         self.print_c("#endif // defined(DATALAYER_USE_BOOST_PYTHON)")
 
+def run(argv):
+    optparse = OptionParser()
+    optparse.add_option("-i", "--input", dest="infile", help="specifies path to datalayer specification", metavar="<filename.dl>")
+    optparse.add_option("--cpp", dest="cppfile", help="specifies path to output C++ source file", metavar="<filename.cpp>")
+    optparse.add_option("--hpp", dest="hppfile", help="specifies path to output C++ header file", metavar="<filename.hpp>")
+
+    options,args = optparse.parse_args()
+    
+    if not options.infile:
+        print "ERROR: no input file specified."
+        raise SystemExit,255
+    
+    parser = Parser()
+    parser.read(options.infile)
+    
+    if options.cppfile and options.hppfile:
+        writer = CppWriter(parser)
+        basename = os.path.basename(options.hppfile)
+        writer.write(file(options.cppfile,"w"), file(options.hppfile,"w"), basename)
+
 def test():
     parser = Parser()
     parser.read('test.dl')
         file("dl_test.cpp","w").write(stream_cpp.getvalue())
         os.system('g++ -shared -DDATALAYER_USE_BOOST_PYTHON -I/usr/include/python2.6'
         ' -I. dl_test.cpp')
-        
+
 if __name__ == '__main__':
     test()

File src/core/SConscript

         ],
         LIBS=[
             'stdc++', # possible fix for __cxa_allocate_exception segfault
-            'boost_python-mt',
+            'boost_python-mt-py26',
             #'libdb',
         ],
         SHLIBPREFIX="", #gets rid of lib prefix