[Scons-users] More newbie questions
syost at triad.rr.com
syost at triad.rr.com
Tue Jul 25 14:26:39 EDT 2017
As you may remember, I am trying to wean my organization from a fairly reliable, but slow and exceedingly complicated Frankenstein build system developed internally. Permission and resources to put scons head to head with our internal build system came, and I am putting that together demo now. Its not due for a while, but trying to nail down a couple of things:
I have run across an issue with dependencies I am not sure how to fix. If I call scons with a target name; I would assume it looks for dependency names in things like the "LIBS" variable. It would then scans the SConscript files it has read and then determines what needed to be built.
But that is not what seems to be happening.
If I have the SConstruct file load just the 4 or 5 SConscript files I need, it works. If I have the SConstruct file scan the whole tree and load all 40-50 SConscript files, it will try to build my entire tree . It will NOT just build the target. So:
"scons-k -j 2 -site==blahblah --prefix=blahblah src/src/src/src"
will NOT work unless I specifically create 4-5 SConscript() calls in the SConstruct file with exactly what my target needs. If the SConstruct scans and loads all of them (like below), I end up with all ~50 packages targets being built - even if I specified only one target on the command line.
Is it obvious what I am doing wrong?
Thanks,
Spencer
SConscript for the target
import os, glob
from SConfig import *
myEnv = Environment(PREFIX = GetOption("prefix"))
THISINCLUDES=[
'#/',
'/opt/ibm/db2/V10.5/include/']
myEnv.Append(CPPPATH=THISINCLUDES)
bld = Builder(action = '/home/db2inst1/sql_udb_prep $SOURCE $TARGET',suffix='.c')
myEnv.Append(BUILDERS = {'UDBPrecompile' : bld})
for filename in Glob('*.sc'):
myEnv.UDBPrecompile(filename)
finalDeliverable = myEnv.SharedLibrary("com.lowes.so.goodssvcs.ardb.o.so", Glob("*.c*") ,
LIBS=[
'com.lowes.so.transaction.creditcarddb.so',
'com.lowes.so.utility.utildb.so',
'db2.so'],
LIBPATH=[
'$PREFIX/opt/lowes/lib',
'/opt/ibm/db2/V10.5/lib64/'])
myEnv.Alias("install", myEnv.InstallPerm("$PREFIX/opt/genesis/lib", finalDeliverable, 0711) )
SConstruct (just the relevant parts, there is lots more where I am setting cxx variables and what not)
os.path.walk(COMMAND_LINE_TARGETS[0], includeAllSConscriptFiles, '')
def UDBPrecompile(target, source, env):
subprocess(['system/home/db2inst1/sql_udb_prep source'])
return None
def includeAllSConscriptFiles(ext, dirname, names):
### Just want subdirs....
pattern = main_source_dir + "/"
workingSubDir = dirname.replace(pattern,"")
pattern = "^" + BUILD_CONFIGURATION
## Exclude build directory....
if re.search(pattern, basename(dirname)) is None:
for name in names:
if name.lower() == 'sconscript':
if basename(workingSubDir) == PROJECT_NAME:
sconscript_path = workingSubDir + '/SConscript'
source_dir = main_source_dir
out_dir = BUILD_CONFIGURATION
else:
sconscript_path = os.path.join(workingSubDir, 'SConscript')
source_dir = os.path.join(main_source_dir, workingSubDir)
out_dir = os.path.join(BUILD_CONFIGURATION, workingSubDir)
## print("Adding SConscript: " + sconscript_path + " with source dir: " + source_dir + " and outdir: " + out_dir)
o = SConscript(sconscript_path, exports=['env', 'source_dir', 'pic' ],
variant_dir=out_dir, duplicate=1)
if o:
objs.extend(o)
More information about the Scons-users
mailing list