144 |
144 |
145 # the local customization file may or not exist |
145 # the local customization file may or not exist |
146 if bld.path.find_resource("bindings/modulegen_local.py"): |
146 if bld.path.find_resource("bindings/modulegen_local.py"): |
147 source.append("bindings/modulegen_local.py") |
147 source.append("bindings/modulegen_local.py") |
148 |
148 |
149 target = ['bindings/module.cc'] |
149 target = ['bindings/ns3module.cc', 'bindings/ns3module.h', 'bindings/ns3modulegen.log'] |
150 #if not debug: |
150 #if not debug: |
151 # target.append('ns3modulegen.log') |
151 # target.append('ns3modulegen.log') |
152 |
152 |
153 argv = ['NS3_ENABLED_FEATURES=${FEATURES}', '${PYTHON}'] |
153 argv = ['NS3_ENABLED_FEATURES=${FEATURES}', '${PYTHON}'] |
154 #if debug: |
154 #if debug: |
155 # argv.extend(["-m", "pdb"]) |
155 # argv.extend(["-m", "pdb"]) |
156 |
156 |
157 argv.extend(['${SRC[0]}', module_abs_src_path, apidefs, '>', '${TGT[0]}']) |
157 argv.extend(['${SRC[0]}', module_abs_src_path, apidefs, '${TGT[0]}']) |
158 #if not debug: |
158 |
159 # argv.extend(['2>', '${TGT[2]}']) # 2> ns3modulegen.log |
159 argv.extend(['2>', '${TGT[2]}']) # 2> ns3modulegen.log |
160 |
160 |
161 features = [] |
161 features = [] |
162 for (name, caption, was_enabled, reason_not_enabled) in env['NS3_OPTIONAL_FEATURES']: |
162 for (name, caption, was_enabled, reason_not_enabled) in env['NS3_OPTIONAL_FEATURES']: |
163 if was_enabled: |
163 if was_enabled: |
164 features.append(name) |
164 features.append(name) |
169 bindgen.before = 'cxx' |
169 bindgen.before = 'cxx' |
170 bindgen.after = 'gen_ns3_module_header_task' |
170 bindgen.after = 'gen_ns3_module_header_task' |
171 bindgen.name = "pybindgen(ns3 module %s)" % module |
171 bindgen.name = "pybindgen(ns3 module %s)" % module |
172 |
172 |
173 pymod = bld.new_task_gen(features='cxx cshlib pyext') |
173 pymod = bld.new_task_gen(features='cxx cshlib pyext') |
174 pymod.source = ['bindings/module.cc'] |
174 pymod.source = ['bindings/ns3module.cc'] |
175 pymod.target = '%s/%s' % (bld.srcnode.find_dir("bindings/python/ns").relpath_gen(bld.path), module) |
175 pymod.target = '%s/%s' % (bld.srcnode.find_dir("bindings/python/ns").relpath_gen(bld.path), module) |
176 pymod.name = 'ns3module_%s' % module |
176 pymod.name = 'ns3module_%s' % module |
177 pymod.uselib_local = "ns3" |
177 pymod.uselib_local = "ns3" |
178 if pymod.env['ENABLE_STATIC_NS3']: |
178 if pymod.env['ENABLE_STATIC_NS3']: |
179 if sys.platform == 'darwin': |
179 if sys.platform == 'darwin': |
189 try: |
189 try: |
190 defines.remove('_DEBUG') # causes undefined symbols on win32 |
190 defines.remove('_DEBUG') # causes undefined symbols on win32 |
191 except ValueError: |
191 except ValueError: |
192 pass |
192 pass |
193 pymod.env['CXXDEFINES'] = defines |
193 pymod.env['CXXDEFINES'] = defines |
|
194 pymod.includes = 'bindings' |
|
195 return pymod |
194 |
196 |
195 |
197 |
196 def build(bld): |
198 def build(bld): |
197 bld.create_ns3_module = types.MethodType(create_ns3_module, bld) |
199 bld.create_ns3_module = types.MethodType(create_ns3_module, bld) |
198 bld.create_obj = types.MethodType(create_obj, bld) |
200 bld.create_obj = types.MethodType(create_obj, bld) |