我已经定义两个库 - 一个静态的,一个共享 - 要建在与Full
文件“库”的子目录。然后从父目录中的SConscript
调用此SConscript
,从而精巧地构建了两个库。
d:\托尼\库\ SConscript:
SConstruct
D:\ tony \ SConstruct:
# Define environmental/project constants
CPPPATH = ['../headers']
SOURCES = ['greeter.cxx']
# Inherit the parent environment and update values if necessary.
Import('env')
# Build targets using defined environment variables.
print "Building libraries"
env.StaticLibrary(target = 'lib_greeter.a', source = SOURCES, CPPPATH = CPPPATH)
env.SharedLibrary(target = 'greeter.dll', source = SOURCES, CPPPATH = CPPPATH)
但是,当在cmd行上调用# Define environmental/project constants
TOOLS = ['gcc', 'g++', 'gnulink', 'ar']
PATH = ['C:/cygwin/bin']
CYGWIN = ['nodosfilewarning']
DECIDER = 'MD5-timestamp' # Use a combination of timestamps and checksums to decide if dependencies have changed.
# Initialize the Default Environment and update values.
env = DefaultEnvironment(tools=TOOLS)
env['ENV']['PATH'] = PATH
env['ENV']['CYGWIN'] = CYGWIN
env.Decider(DECIDER)
# Call subsidiary SConscript files with defined environment variables.
SConscript('libraries/SConscript', exports = 'env', duplicate = 0) # do not copy src files to build directory.
时,如何指定只希望构建其中一个库(例如greeter.dll
)?
我以前曾使用定义的一些定制命令行选项scons
引入一些流量控制,但不知其没有感到很正确。
答案 0 :(得分:2)
您的问题可以通过以下两种方式之一阅读:
greeter.dll
的东西。如果您的问题与第一种情况有关,则只需在调用SCons时命名生成文件的路径即可。给定您的文件,我希望它看起来像scons libraries\greeter.dll
。
如果您要询问第二种情况,可以在env.Default("greeter.dll")
中使用SConscript
,然后在不带参数的情况下调用SCons将会自动构建。