Build 以静态和动态库为目标的SCON中的问题
Hi有一个Sconscript文件,用于构建两个不同的目标—共享库和动态库 第一次发布生成时,生成的静态库为空。共享库中没有对象。 但是,如果我再次发出build命令,并且所有共享对象都已生成,那么这次共享库的生成是正确的 共享和动态库目标的包含有一些公共文件 我的Sconscript文件的结构如下所示:Build 以静态和动态库为目标的SCON中的问题,build,scons,Build,Scons,Hi有一个Sconscript文件,用于构建两个不同的目标—共享库和动态库 第一次发布生成时,生成的静态库为空。共享库中没有对象。 但是,如果我再次发出build命令,并且所有共享对象都已生成,那么这次共享库的生成是正确的 共享和动态库目标的包含有一些公共文件 我的Sconscript文件的结构如下所示: Import('module_env') env = module_env.clone() static_includes = ['inc1/', 'inc2'] static_source
Import('module_env')
env = module_env.clone()
static_includes = ['inc1/', 'inc2']
static_sources = ['src1', 'src2']
#build static lib
env.Append(CPPPATH = static_includes)
lib = env.StaticLibrary(libname, static_sources)
#build dynamic lib
# same mechanism, parse through list of sources and build dynamic lib
这个怎么样?
我还没试过,但应该能用
Import('module_env')
env = module_env.clone()
static_includes = ['inc1', 'inc2']
static_source_dirs = ['src1', 'src2']
#build static lib
env.Append(CPPPATH = static_includes)
static_sources = []
for s in static_source_dirs:
static_sources.extend(Glob(os.path.join(s,'*.c')))
static_objects = []
for s in static_sources:
# note I'm constructing the target for the static object compile to have a different name than default. You only need this if you are going to build the same sources also as shared objects.
base_name = static_objects.extend("${SOURCE.basename}_static.$OBJSUFFIX",env.StaticObject(s))
lib = env.StaticLibrary(libname, static_objects)
#build dynamic lib
# same mechanism, parse through list of sources and build dynamic lib
我看不到您正在解析源列表…您正在为
静态\u源
列表指定完整的子文件夹。请尝试使用Glob()
查找所有源文件,并向我们展示如何准确设置动态库。尽管你可能认为这无关紧要,而且是重复的,但它可以帮助其他人重现你的问题。