SConscript (10453:d0365cc3d05f) | SConscript (10454:dc49b13b6f79) |
---|---|
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 --- 613 unchanged lines hidden (view full) --- 622def createSimObjectSwigWrapper(target, source, env): 623 name = source[0].get_contents() 624 obj = sim_objects[name] 625 626 code = code_formatter() 627 obj.swig_decl(code) 628 code.write(target[0].abspath) 629 | 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 --- 613 unchanged lines hidden (view full) --- 622def createSimObjectSwigWrapper(target, source, env): 623 name = source[0].get_contents() 624 obj = sim_objects[name] 625 626 code = code_formatter() 627 obj.swig_decl(code) 628 code.write(target[0].abspath) 629 |
630# dummy target for generated code 631# we start out with all the Source files so they get copied to build/*/ also. 632SWIG = env.Dummy('swig', [s.tnode for s in Source.get()]) 633 |
|
630# Generate all of the SimObject param C++ struct header files 631params_hh_files = [] 632for name,simobj in sorted(sim_objects.iteritems()): 633 py_source = PySource.modules[simobj.__module__] 634 extra_deps = [ py_source.tnode ] 635 636 hh_file = File('params/%s.hh' % name) 637 params_hh_files.append(hh_file) 638 env.Command(hh_file, Value(name), 639 MakeAction(createSimObjectParamStruct, Transform("SO PARAM"))) 640 env.Depends(hh_file, depends + extra_deps) | 634# Generate all of the SimObject param C++ struct header files 635params_hh_files = [] 636for name,simobj in sorted(sim_objects.iteritems()): 637 py_source = PySource.modules[simobj.__module__] 638 extra_deps = [ py_source.tnode ] 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) |
|
641 642# Generate any needed param SWIG wrapper files 643params_i_files = [] 644for name,param in params_to_swig.iteritems(): 645 i_file = File('python/m5/internal/%s.i' % (param.swig_module_name())) 646 params_i_files.append(i_file) 647 env.Command(i_file, Value(name), 648 MakeAction(createParamSwigWrapper, Transform("SW PARAM"))) 649 env.Depends(i_file, depends) | 646 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) |
655 env.Depends(SWIG, i_file) |
|
650 SwigSource('m5.internal', i_file) 651 652# Generate all enum header files 653for name,enum in sorted(all_enums.iteritems()): 654 py_source = PySource.modules[enum.__module__] 655 extra_deps = [ py_source.tnode ] 656 657 cc_file = File('enums/%s.cc' % name) 658 env.Command(cc_file, Value(name), 659 MakeAction(createEnumStrings, Transform("ENUM STR"))) 660 env.Depends(cc_file, depends + extra_deps) | 656 SwigSource('m5.internal', i_file) 657 658# Generate all enum header files 659for name,enum in sorted(all_enums.iteritems()): 660 py_source = PySource.modules[enum.__module__] 661 extra_deps = [ py_source.tnode ] 662 663 cc_file = File('enums/%s.cc' % name) 664 env.Command(cc_file, Value(name), 665 MakeAction(createEnumStrings, Transform("ENUM STR"))) 666 env.Depends(cc_file, depends + extra_deps) |
667 env.Depends(SWIG, cc_file) |
|
661 Source(cc_file) 662 663 hh_file = File('enums/%s.hh' % name) 664 env.Command(hh_file, Value(name), 665 MakeAction(createEnumDecls, Transform("ENUMDECL"))) 666 env.Depends(hh_file, depends + extra_deps) | 668 Source(cc_file) 669 670 hh_file = File('enums/%s.hh' % name) 671 env.Command(hh_file, Value(name), 672 MakeAction(createEnumDecls, Transform("ENUMDECL"))) 673 env.Depends(hh_file, depends + extra_deps) |
674 env.Depends(SWIG, hh_file) |
|
667 668 i_file = File('python/m5/internal/enum_%s.i' % name) 669 env.Command(i_file, Value(name), 670 MakeAction(createEnumSwigWrapper, Transform("ENUMSWIG"))) 671 env.Depends(i_file, depends + extra_deps) | 675 676 i_file = File('python/m5/internal/enum_%s.i' % name) 677 env.Command(i_file, Value(name), 678 MakeAction(createEnumSwigWrapper, Transform("ENUMSWIG"))) 679 env.Depends(i_file, depends + extra_deps) |
680 env.Depends(SWIG, i_file) |
|
672 SwigSource('m5.internal', i_file) 673 674# Generate SimObject SWIG wrapper files 675for name,simobj in sim_objects.iteritems(): 676 py_source = PySource.modules[simobj.__module__] 677 extra_deps = [ py_source.tnode ] 678 679 i_file = File('python/m5/internal/param_%s.i' % name) --- 21 unchanged lines hidden (view full) --- 701for swig in SwigSource.all: 702 env.Command([swig.cc_source.tnode, swig.py_source.tnode], swig.tnode, 703 MakeAction('$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} ' 704 '-o ${TARGETS[0]} $SOURCES', Transform("SWIG"))) 705 cc_file = str(swig.tnode) 706 init_file = '%s/%s_init.cc' % (dirname(cc_file), basename(cc_file)) 707 env.Command(init_file, Value(swig.module), 708 MakeAction(makeEmbeddedSwigInit, Transform("EMBED SW"))) | 681 SwigSource('m5.internal', i_file) 682 683# Generate SimObject SWIG wrapper files 684for name,simobj in sim_objects.iteritems(): 685 py_source = PySource.modules[simobj.__module__] 686 extra_deps = [ py_source.tnode ] 687 688 i_file = File('python/m5/internal/param_%s.i' % name) --- 21 unchanged lines hidden (view full) --- 710for swig in SwigSource.all: 711 env.Command([swig.cc_source.tnode, swig.py_source.tnode], swig.tnode, 712 MakeAction('$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} ' 713 '-o ${TARGETS[0]} $SOURCES', Transform("SWIG"))) 714 cc_file = str(swig.tnode) 715 init_file = '%s/%s_init.cc' % (dirname(cc_file), basename(cc_file)) 716 env.Command(init_file, Value(swig.module), 717 MakeAction(makeEmbeddedSwigInit, Transform("EMBED SW"))) |
718 env.Depends(SWIG, init_file) |
|
709 Source(init_file, **swig.guards) 710 711# Build all protocol buffers if we have got protoc and protobuf available 712if env['HAVE_PROTOBUF']: 713 for proto in ProtoBuf.all: 714 # Use both the source and header as the target, and the .proto 715 # file as the source. When executing the protoc compiler, also 716 # specify the proto_path to avoid having the generated files 717 # include the path. 718 env.Command([proto.cc_file, proto.hh_file], proto.tnode, 719 MakeAction('$PROTOC --cpp_out ${TARGET.dir} ' 720 '--proto_path ${SOURCE.dir} $SOURCE', 721 Transform("PROTOC"))) 722 | 719 Source(init_file, **swig.guards) 720 721# Build all protocol buffers if we have got protoc and protobuf available 722if env['HAVE_PROTOBUF']: 723 for proto in ProtoBuf.all: 724 # Use both the source and header as the target, and the .proto 725 # file as the source. When executing the protoc compiler, also 726 # specify the proto_path to avoid having the generated files 727 # include the path. 728 env.Command([proto.cc_file, proto.hh_file], proto.tnode, 729 MakeAction('$PROTOC --cpp_out ${TARGET.dir} ' 730 '--proto_path ${SOURCE.dir} $SOURCE', 731 Transform("PROTOC"))) 732 |
733 env.Depends(SWIG, [proto.cc_file, proto.hh_file]) |
|
723 # Add the C++ source file 724 Source(proto.cc_file, **proto.guards) 725elif ProtoBuf.all: 726 print 'Got protobuf to build, but lacks support!' 727 Exit(1) 728 729# 730# Handle debug flags --- 80 unchanged lines hidden (view full) --- 811''') 812 813 code.write(str(target[0])) 814 815for name,flag in sorted(debug_flags.iteritems()): 816 n, compound, desc = flag 817 assert n == name 818 | 734 # Add the C++ source file 735 Source(proto.cc_file, **proto.guards) 736elif ProtoBuf.all: 737 print 'Got protobuf to build, but lacks support!' 738 Exit(1) 739 740# 741# Handle debug flags --- 80 unchanged lines hidden (view full) --- 822''') 823 824 code.write(str(target[0])) 825 826for name,flag in sorted(debug_flags.iteritems()): 827 n, compound, desc = flag 828 assert n == name 829 |
819 env.Command('debug/%s.hh' % name, Value(flag), | 830 hh_file = 'debug/%s.hh' % name 831 cc_file = 'debug/%s.cc' % name 832 env.Command(hh_file, Value(flag), |
820 MakeAction(makeDebugFlagHH, Transform("TRACING", 0))) | 833 MakeAction(makeDebugFlagHH, Transform("TRACING", 0))) |
821 env.Command('debug/%s.cc' % name, Value(flag), | 834 env.Command(cc_file, Value(flag), |
822 MakeAction(makeDebugFlagCC, Transform("TRACING", 0))) | 835 MakeAction(makeDebugFlagCC, Transform("TRACING", 0))) |
836 env.Depends(SWIG, [hh_file, cc_file]) |
|
823 Source('debug/%s.cc' % name) 824 825# Embed python files. All .py files that have been indicated by a 826# PySource() call in a SConscript need to be embedded into the M5 827# library. To do that, we compile the file to byte code, marshal the 828# byte code, compress it, and then generate a c++ file that 829# inserts the result into an array. 830def embedPyFile(target, source, env): --- 42 unchanged lines hidden (view full) --- 873 874} // anonymous namespace 875''') 876 code.write(str(target[0])) 877 878for source in PySource.all: 879 env.Command(source.cpp, source.tnode, 880 MakeAction(embedPyFile, Transform("EMBED PY"))) | 837 Source('debug/%s.cc' % name) 838 839# Embed python files. All .py files that have been indicated by a 840# PySource() call in a SConscript need to be embedded into the M5 841# library. To do that, we compile the file to byte code, marshal the 842# byte code, compress it, and then generate a c++ file that 843# inserts the result into an array. 844def embedPyFile(target, source, env): --- 42 unchanged lines hidden (view full) --- 887 888} // anonymous namespace 889''') 890 code.write(str(target[0])) 891 892for source in PySource.all: 893 env.Command(source.cpp, source.tnode, 894 MakeAction(embedPyFile, Transform("EMBED PY"))) |
895 env.Depends(SWIG, source.cpp) |
|
881 Source(source.cpp, skip_no_python=True) 882 883######################################################################## 884# 885# Define binaries. Each different build type (debug, opt, etc.) gets 886# a slightly different build environment. 887# 888 --- 280 unchanged lines hidden --- | 896 Source(source.cpp, skip_no_python=True) 897 898######################################################################## 899# 900# Define binaries. Each different build type (debug, opt, etc.) gets 901# a slightly different build environment. 902# 903 --- 280 unchanged lines hidden --- |