lib/wscript
changeset 1880 0148d5911946
parent 1879 876026968947
child 1881 24285ca5e94f
equal deleted inserted replaced
1879:876026968947 1880:0148d5911946
     1 ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
       
     2 import Object
       
     3 
       
     4 def build(bld):
       
     5     env = bld.env_of_name('default')
       
     6 
       
     7     if env['NS3_ENABLED_MODULES']:
       
     8         modules = env['NS3_ENABLED_MODULES']
       
     9         changed = True
       
    10         while changed:
       
    11             changed = False
       
    12             for module in modules:
       
    13                 module_obj = Object.name_to_obj(module)
       
    14                 if module_obj is None:
       
    15                     raise ValueError("module %s not found" % module)
       
    16                 for dep in module_obj.add_objects:
       
    17                     if not dep.startswith('ns3-'):
       
    18                         continue
       
    19                     if dep not in modules:
       
    20                         modules.append(dep)
       
    21                         changed = True
       
    22 
       
    23         ## remove objects that depend on modules not listed
       
    24         for obj in list(Object.g_allobjs):
       
    25             if hasattr(obj, 'ns3_module_dependencies'):
       
    26                 for dep in obj.ns3_module_dependencies:
       
    27                     if dep not in modules:
       
    28                         Object.g_allobjs.remove(obj)
       
    29                         break
       
    30             if obj.name in env['NS3_MODULES'] and obj.name not in modules:
       
    31                 Object.g_allobjs.remove(obj)
       
    32 
       
    33 
       
    34 
       
    35     ## Create a single ns3 library containing all modules
       
    36     lib = bld.create_obj('cpp', 'shlib')
       
    37     lib.name = 'ns3'
       
    38     lib.target = 'ns3'
       
    39     if env['NS3_ENABLED_MODULES']:
       
    40         lib.add_objects = list(modules)
       
    41     else:
       
    42         lib.add_objects = list(env['NS3_MODULES'])
       
    43 
       
    44