Differences between revisions 13 and 14
Revision 13 as of 2005-03-21 00:40:19
Size: 2060
Editor: 209-6-159-51
Comment: despammed
Revision 14 as of 2008-03-12 02:47:00
Size: 2060
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

Here's the current Sconstruct:

import SCons.Script
import os
import fnmatch

##-------------------------------------------------
# Use:
#   scons projectx [mode=debug]
#        - defaults to mode=release
##-------------------------------------------------

##-------------------------------------------------
#-- Function definitions here
def DoSrc(tgt, mode):
    build_dir = os.path.join('/projects', mode, tgt)
    SConscript('src/' + tgt + '/sconscript', build_dir= build_dir)

def DoFrozen(tgt, mode):
    build_dir = os.path.join('/projects', mode, tgt)
    SConscript('frozen/' + tgt + '/sconscript', build_dir= build_dir)

class Dev(Environment):
   def DevGetSourceFiles(self, patterns=None):
      files = []

      if patterns is None:
         patterns=['*'+self["CXXFILESUFFIX"],'*'+self["CFILESUFFIX"], '*'+self["QT_UISUFFIX"]]
      for file in os.listdir(self.Dir('.').srcnode().abspath):
          for pattern in patterns:
             if fnmatch.fnmatchcase(file, pattern):
                 files.append(file)
      return files


##-------------------------------------------------
#--
# prevent accidental building of everything;
# - to build everything use 'scons.py .'
Default(None)

##-------------------------------------------------
#- check compilation mode: 'debug' or 'release' only
mode = ARGUMENTS.get('mode', 'release')
if not (mode in ['debug', 'release']):
   print "Error: expected 'debug' or 'release', found: " + mode
   Exit(1)

print '**** Compiling in ' + mode + ' mode...'

env = Environment()
dev = Dev()
Export('env', 'dev')
env.PrependENVPath('PATH', 'E:/tools/mingw/bin')

DoSrc('pso', mode)
DoSrc('cppwiki', mode)
DoSrc('smanager', mode)
DoFrozen('jmirror', mode)
DoFrozen('classesinc', mode)

Here's a typical sconscript (they're all very similar):

Import('env', 'dev')
project = 'classesinc'

localenv = env.Copy()
localenv.Tool('msvc')
tgt = localenv.Program(project, dev.DevGetSourceFiles(['*.c']))
env.Alias(project, tgt)

ExtendedExampleSource2 (last edited 2008-03-12 02:47:00 by localhost)