Please note:The SCons wiki is in read-only mode due to ongoing spam/DoS issues. Also, new account creation is currently disabled. We are looking into alternative wiki hosts.

This is rough builder for Corba-using applications using Tao.

It is based on the other builder CorbaBuilder, but this one works without any modifications and allows you to build client and server applications separately.

With minor modifications, this also works for Orbacus from IONA.

   1 import SCons.Scanner.IDL
   2 
   3 def idl2many_emitter(target, source, env):
   4   new_t = []
   5   fls = source[0]
   6   flt = target[0]
   7   if str(fls).endswith('.idl'):
   8     # you might need to adapt these to your suffixes and generation (e.g. if you don't generate S_T files)
   9     for suf in [ 'C.h', 'C.cpp', 'C.inl', 'S.h', 'S.cpp', 'S.inl', 'S_T.h', 'S_T.cpp', 'S_T.inl' ]:
  10         new_t.append( str(flt) + suf)
  11   return (new_t, source)
  12 
  13 # you might also use this generator instead of the action below (in this concrete case, it is for Orbacus)
  14 #def idl2many_generator(source, target, env, for_signature):
  15 #  env['INCPREFIX'] = '-I'
  16 #  return "$IDL $IDLFLAGS --output-dir ${TARGET.dir} $_CPPINCFLAGS ${SOURCE}"
  17 
  18 idl2many_bld = Builder(
  19   action="$IDL $IDLFLAGS $_CPPINCFLAGS ${SOURCE} -o ${TARGET.dir}",
  20   src_suffix = '.idl',
  21   emitter = idl2many_emitter,
  22   source_scanner = SCons.Scanner.IDL.IDLScan(),
  23   single_source = 1
  24 )
  25 
  26 def idl2cppC_bld(env, target, source):
  27   idl_res = env.CorbaIdl(source)
  28   cpp = []
  29   for fl in idl_res:
  30     if str(fl).endswith('C.cpp'):
  31       cpp.append(env.Object(fl))
  32   return cpp
  33 
  34 def idl2cppS_bld(env, target, source):
  35   idl_res = env.CorbaIdl(source)
  36   cpp = []
  37   for fl in idl_res:
  38     if str(fl).endswith('C.cpp') or str(fl).endswith('S.cpp'):
  39       cpp.append(env.Object(fl))
  40   return cpp
  41 
  42 Import('env')
  43 
  44 env.Append(
  45   IDL = 'tao_idl',
  46   IDLFLAGS = '',
  47 )
  48 
  49 env.Append(BUILDERS={
  50     'CorbaIdl' : idl2many_bld,
  51     'CorbaBuildC' : idl2cppC_bld,
  52     'CorbaBuildS' : idl2cppS_bld,
  53 })
  54 
  55 cli_corba = env.CorbaBuildC('hellworld.idl')
  56 srv_corba = env.CorbaBuildS('hellworld.idl')
  57 
  58 env.Program(
  59   target = 'client',
  60   source = [ 'client.cc', cli_corba, ],
  61   CPPPATH = [ '.' ],
  62   LIBS = [
  63     'TAO_CosLifeCycle', 'TAO_PortableServer', 'TAO_CosNaming'
  64   ],
  65 )
  66 
  67 env.Program(
  68   target = 'server',
  69   source = [ 'server.cc', srv_corba, ],
  70   CPPPATH = [ '.' ],
  71   LIBS = [
  72     'TAO_CosLifeCycle', 'TAO_PortableServer', 'TAO_CosNaming',
  73     'TAO_Utils', 'TAO_PI', 'TAO_CodecFactory'
  74   ],
  75 )

-- Teftin, --platon42

CorbaTaoBuilder (last edited 2008-11-08 13:50:22 by ChrisHodges)