我正在尝试编写一个SCons脚本来构建随swig分发的lua/embed3示例。makefile的构建指令如下:
swig -c++ -lua -external-runtime swigluarun.h
swig -c++ -lua -module example -o example_wrap.cpp example.i
g++ -o embed3 embed3.cpp example_wrap.cpp example.cpp \
-llua5.1 -I/usr/include/lua5.1在Scons wiki中,据说Scons有内置的swig支持。在源代码中添加'.i‘文件应该可以完成这项工作,但是我无法找到关于如何实现此脚本的任何详细描述。
以下脚本在swig examples下构建lua/simple项目。然而,我无法找到如何执行我的问题中给出的第一个swig指令。感谢您的回复。
env = Environment()
env.Append( SWIGFLAGS = '-lua' )
env.Append( CPPPATH = '/usr/include/lua5.1' )
env.Append( LIBS = 'lua5.1' )
env.SharedLibrary( target = 'example.so',
source = ['example.c', 'example.i' ], SHLIBPREFIX='' )提前谢谢。
发布于 2010-09-28 16:11:20
你有没有试过/看过这个example script
import distutils.sysconfig
env = Environment(SWIGFLAGS=['-python'],
CPPPATH=[distutils.sysconfig.get_python_inc()],
SHLIBPREFIX="")
env.SharedLibrary('_example.so', ['example.c', 'example.i'])在this blog post中有更多有趣的细节。
发布于 2010-09-28 17:00:36
多亏了Eli的指导,这是我能找到的实现脚本的唯一方法。欢迎任何改进。
env = Environment()
swigCmdLine = 'swig -c++ -lua -external-runtime swigluarun.h'
swigDefs = env.Command( 'swigluarun.h', '', swigCmdLine )
env.Depends( 'embed3', swigDefs )
env.Append( SWIGFLAGS = '-c++ -lua' )
env.Append( CPPPATH = '/usr/include/lua5.1' )
env.Append( LIBS = 'lua5.1' )
env.Program( 'embed3', ['embed3.cpp', 'example.cpp', 'example.i' ] )注意:我正在开发Ubuntu 9.10、swig-1.3.36和scons 1.3.0。
https://stackoverflow.com/questions/3810821
复制相似问题