319 env.append_value('DEFINES', 'NS3_ASSERT_ENABLE') |
319 env.append_value('DEFINES', 'NS3_ASSERT_ENABLE') |
320 env.append_value('DEFINES', 'NS3_LOG_ENABLE') |
320 env.append_value('DEFINES', 'NS3_LOG_ENABLE') |
321 |
321 |
322 env['PLATFORM'] = sys.platform |
322 env['PLATFORM'] = sys.platform |
323 env['BUILD_PROFILE'] = Options.options.build_profile |
323 env['BUILD_PROFILE'] = Options.options.build_profile |
|
324 if Options.options.build_profile == "release": |
|
325 env['BUILD_SUFFIX'] = '' |
|
326 else: |
|
327 env['BUILD_SUFFIX'] = '-'+Options.options.build_profile |
|
328 |
324 env['APPNAME'] = wutils.APPNAME |
329 env['APPNAME'] = wutils.APPNAME |
325 env['VERSION'] = wutils.VERSION |
330 env['VERSION'] = wutils.VERSION |
326 |
331 |
327 if conf.env['CXX_NAME'] in ['gcc', 'icc']: |
332 if conf.env['CXX_NAME'] in ['gcc', 'icc']: |
328 if Options.options.build_profile == 'release': |
333 if Options.options.build_profile == 'release': |
329 env.append_value('CXXFLAGS', '-fomit-frame-pointer') |
334 env.append_value('CXXFLAGS', '-fomit-frame-pointer') |
|
335 if Options.options.build_profile == 'optimized': |
330 if conf.check_compilation_flag('-march=native'): |
336 if conf.check_compilation_flag('-march=native'): |
331 env.append_value('CXXFLAGS', '-march=native') |
337 env.append_value('CXXFLAGS', '-march=native') |
332 |
338 |
333 if sys.platform == 'win32': |
339 if sys.platform == 'win32': |
334 env.append_value("LINKFLAGS", "-Wl,--enable-runtime-pseudo-reloc") |
340 env.append_value("LINKFLAGS", "-Wl,--enable-runtime-pseudo-reloc") |
574 bld.add_group() # this to make sure no two sudo tasks run at the same time |
580 bld.add_group() # this to make sure no two sudo tasks run at the same time |
575 program = bld.new_task_gen(features=['cxx', 'cxxprogram']) |
581 program = bld.new_task_gen(features=['cxx', 'cxxprogram']) |
576 program.is_ns3_program = True |
582 program.is_ns3_program = True |
577 program.module_deps = list() |
583 program.module_deps = list() |
578 program.name = name |
584 program.name = name |
579 program.target = "%s%s-%s-%s" % (wutils.APPNAME, wutils.VERSION, name, bld.env.BUILD_PROFILE) |
585 program.target = "%s%s-%s%s" % (wutils.APPNAME, wutils.VERSION, name, bld.env.BUILD_SUFFIX) |
580 |
586 |
581 if bld.env['ENABLE_SUDO']: |
587 if bld.env['ENABLE_SUDO']: |
582 program.create_task("SuidBuild") |
588 program.create_task("SuidBuild") |
583 |
589 |
584 bld.set_group(grp) |
590 bld.set_group(grp) |
588 def create_ns3_program(bld, name, dependencies=('core',)): |
594 def create_ns3_program(bld, name, dependencies=('core',)): |
589 program = bld.new_task_gen(features=['cxx', 'cxxprogram']) |
595 program = bld.new_task_gen(features=['cxx', 'cxxprogram']) |
590 |
596 |
591 program.is_ns3_program = True |
597 program.is_ns3_program = True |
592 program.name = name |
598 program.name = name |
593 program.target = "%s%s-%s-%s" % (wutils.APPNAME, wutils.VERSION, name, bld.env.BUILD_PROFILE) |
599 program.target = "%s%s-%s%s" % (wutils.APPNAME, wutils.VERSION, name, bld.env.BUILD_SUFFIX) |
594 # Each of the modules this program depends on has its own library. |
600 # Each of the modules this program depends on has its own library. |
595 program.ns3_module_dependencies = ['ns3-'+dep for dep in dependencies] |
601 program.ns3_module_dependencies = ['ns3-'+dep for dep in dependencies] |
596 program.includes = "# #/.." |
602 program.includes = "# #/.." |
597 program.use = program.ns3_module_dependencies |
603 program.use = program.ns3_module_dependencies |
598 if program.env['ENABLE_STATIC_NS3']: |
604 if program.env['ENABLE_STATIC_NS3']: |
763 break |
769 break |
764 |
770 |
765 # Add this program to the list if all of its |
771 # Add this program to the list if all of its |
766 # dependencies will be built. |
772 # dependencies will be built. |
767 if program_built: |
773 if program_built: |
768 object_name = "%s%s-%s-%s" % (wutils.APPNAME, wutils.VERSION, |
774 object_name = "%s%s-%s%s" % (wutils.APPNAME, wutils.VERSION, |
769 obj.name, bld.env.BUILD_PROFILE) |
775 obj.name, bld.env.BUILD_SUFFIX) |
770 bld.env.append_value('NS3_RUNNABLE_PROGRAMS', object_name) |
776 bld.env.append_value('NS3_RUNNABLE_PROGRAMS', object_name) |
771 |
777 |
772 # disable the modules themselves |
778 # disable the modules themselves |
773 if hasattr(obj, "is_ns3_module") and obj.name not in modules: |
779 if hasattr(obj, "is_ns3_module") and obj.name not in modules: |
774 bld.exclude_taskgen(obj) # kill the module |
780 bld.exclude_taskgen(obj) # kill the module |