SConscript (10457:c0302ad57921) SConscript (10458:64809024b924)
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2005 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

--- 565 unchanged lines hidden (view full) ---

574
575 name = str(source[0].get_contents())
576 obj = sim_objects[name]
577
578 code = code_formatter()
579 obj.cxx_param_decl(code)
580 code.write(target[0].abspath)
581
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2005 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

--- 565 unchanged lines hidden (view full) ---

574
575 name = str(source[0].get_contents())
576 obj = sim_objects[name]
577
578 code = code_formatter()
579 obj.cxx_param_decl(code)
580 code.write(target[0].abspath)
581
582def createSimObjectCxxConfig(is_header):
583 def body(target, source, env):
584 assert len(target) == 1 and len(source) == 1
585
586 name = str(source[0].get_contents())
587 obj = sim_objects[name]
588
589 code = code_formatter()
590 obj.cxx_config_param_file(code, is_header)
591 code.write(target[0].abspath)
592 return body
593
582def createParamSwigWrapper(target, source, env):
583 assert len(target) == 1 and len(source) == 1
584
585 name = str(source[0].get_contents())
586 param = params_to_swig[name]
587
588 code = code_formatter()
589 param.swig_decl(code)

--- 49 unchanged lines hidden (view full) ---

639
640 hh_file = File('params/%s.hh' % name)
641 params_hh_files.append(hh_file)
642 env.Command(hh_file, Value(name),
643 MakeAction(createSimObjectParamStruct, Transform("SO PARAM")))
644 env.Depends(hh_file, depends + extra_deps)
645 env.Depends(SWIG, hh_file)
646
594def createParamSwigWrapper(target, source, env):
595 assert len(target) == 1 and len(source) == 1
596
597 name = str(source[0].get_contents())
598 param = params_to_swig[name]
599
600 code = code_formatter()
601 param.swig_decl(code)

--- 49 unchanged lines hidden (view full) ---

651
652 hh_file = File('params/%s.hh' % name)
653 params_hh_files.append(hh_file)
654 env.Command(hh_file, Value(name),
655 MakeAction(createSimObjectParamStruct, Transform("SO PARAM")))
656 env.Depends(hh_file, depends + extra_deps)
657 env.Depends(SWIG, hh_file)
658
659# C++ parameter description files
660if GetOption('with_cxx_config'):
661 for name,simobj in sorted(sim_objects.iteritems()):
662 py_source = PySource.modules[simobj.__module__]
663 extra_deps = [ py_source.tnode ]
664
665 cxx_config_hh_file = File('cxx_config/%s.hh' % name)
666 cxx_config_cc_file = File('cxx_config/%s.cc' % name)
667 env.Command(cxx_config_hh_file, Value(name),
668 MakeAction(createSimObjectCxxConfig(True),
669 Transform("CXXCPRHH")))
670 env.Command(cxx_config_cc_file, Value(name),
671 MakeAction(createSimObjectCxxConfig(False),
672 Transform("CXXCPRCC")))
673 env.Depends(cxx_config_hh_file, depends + extra_deps +
674 [File('params/%s.hh' % name), File('sim/cxx_config.hh')])
675 env.Depends(cxx_config_cc_file, depends + extra_deps +
676 [cxx_config_hh_file])
677 Source(cxx_config_cc_file)
678
679 cxx_config_init_cc_file = File('cxx_config/init.cc')
680
681 def createCxxConfigInitCC(target, source, env):
682 assert len(target) == 1 and len(source) == 1
683
684 code = code_formatter()
685
686 for name,simobj in sorted(sim_objects.iteritems()):
687 if not hasattr(simobj, 'abstract') or not simobj.abstract:
688 code('#include "cxx_config/${name}.hh"')
689 code()
690 code('void cxxConfigInit()')
691 code('{')
692 code.indent()
693 for name,simobj in sorted(sim_objects.iteritems()):
694 not_abstract = not hasattr(simobj, 'abstract') or \
695 not simobj.abstract
696 if not_abstract and 'type' in simobj.__dict__:
697 code('cxx_config_directory["${name}"] = '
698 '${name}CxxConfigParams::makeDirectoryEntry();')
699 code.dedent()
700 code('}')
701 code.write(target[0].abspath)
702
703 py_source = PySource.modules[simobj.__module__]
704 extra_deps = [ py_source.tnode ]
705 env.Command(cxx_config_init_cc_file, Value(name),
706 MakeAction(createCxxConfigInitCC, Transform("CXXCINIT")))
707 cxx_param_hh_files = ["cxx_config/%s.hh" % simobj
708 for simobj in sorted(sim_objects.itervalues())
709 if not hasattr(simobj, 'abstract') or not simobj.abstract]
710 Depends(cxx_config_init_cc_file, cxx_param_hh_files +
711 [File('sim/cxx_config.hh')])
712 Source(cxx_config_init_cc_file)
713
647# Generate any needed param SWIG wrapper files
648params_i_files = []
649for name,param in params_to_swig.iteritems():
650 i_file = File('python/m5/internal/%s.i' % (param.swig_module_name()))
651 params_i_files.append(i_file)
652 env.Command(i_file, Value(name),
653 MakeAction(createParamSwigWrapper, Transform("SW PARAM")))
654 env.Depends(i_file, depends)

--- 545 unchanged lines hidden ---
714# Generate any needed param SWIG wrapper files
715params_i_files = []
716for name,param in params_to_swig.iteritems():
717 i_file = File('python/m5/internal/%s.i' % (param.swig_module_name()))
718 params_i_files.append(i_file)
719 env.Command(i_file, Value(name),
720 MakeAction(createParamSwigWrapper, Transform("SW PARAM")))
721 env.Depends(i_file, depends)

--- 545 unchanged lines hidden ---