equal
deleted
inserted
replaced
35 raise optparse.OptionValueError("allowed --debug-level values" |
35 raise optparse.OptionValueError("allowed --debug-level values" |
36 " are debug, optimized.") |
36 " are debug, optimized.") |
37 |
37 |
38 opt.add_option('-d', '--debug-level', |
38 opt.add_option('-d', '--debug-level', |
39 action='callback', |
39 action='callback', |
40 type="string", dest='debug_level', default='debug', |
40 type="string", dest='debug_level', default='ultradebug', |
41 help=('Specify the debug level, does nothing if CFLAGS is set' |
41 help=('Specify the debug level, does nothing if CFLAGS is set' |
42 ' in the environment. [Allowed Values: debug, optimized].' |
42 ' in the environment. [Allowed Values: debug, optimized].' |
43 ' WARNING: this option only has effect ' |
43 ' WARNING: this option only has effect ' |
44 'with the configure command.'), |
44 'with the configure command.'), |
45 callback=debug_option_callback) |
45 callback=debug_option_callback) |
112 |
112 |
113 variant_env.append_value('CXXDEFINES', 'RUN_SELF_TESTS') |
113 variant_env.append_value('CXXDEFINES', 'RUN_SELF_TESTS') |
114 |
114 |
115 if (os.path.basename(conf.env['CXX']).startswith("g++") |
115 if (os.path.basename(conf.env['CXX']).startswith("g++") |
116 and 'CXXFLAGS' not in os.environ): |
116 and 'CXXFLAGS' not in os.environ): |
117 variant_env.append_value('CXXFLAGS', ['-Wall', '-Werror']) |
117 variant_env.append_value('CXXFLAGS', ['-Werror']) |
118 |
118 |
119 if 'debug' in Params.g_options.debug_level.lower(): |
119 if 'debug' in Params.g_options.debug_level.lower(): |
120 variant_env.append_value('CXXDEFINES', 'NS3_DEBUG_ENABLE') |
120 variant_env.append_value('CXXDEFINES', 'NS3_DEBUG_ENABLE') |
121 variant_env.append_value('CXXDEFINES', 'NS3_ASSERT_ENABLE') |
121 variant_env.append_value('CXXDEFINES', 'NS3_ASSERT_ENABLE') |
122 |
122 |
126 and 'CXXFLAGS' not in os.environ): |
126 and 'CXXFLAGS' not in os.environ): |
127 for flag in variant_env['CXXFLAGS_DEBUG']: |
127 for flag in variant_env['CXXFLAGS_DEBUG']: |
128 ## this probably doesn't work for MSVC |
128 ## this probably doesn't work for MSVC |
129 if flag.startswith('-g'): |
129 if flag.startswith('-g'): |
130 variant_env.append_value('CXXFLAGS', flag) |
130 variant_env.append_value('CXXFLAGS', flag) |
|
131 |
|
132 ## in optimized builds, replace -O2 with -O3 |
|
133 if 'optimized' in Params.g_options.debug_level.lower(): |
|
134 lst = variant_env['CXXFLAGS'] |
|
135 for i, flag in enumerate(lst): |
|
136 if flag == '-O2': |
|
137 lst[i] = '-O3' |
131 |
138 |
132 if sys.platform == 'win32': |
139 if sys.platform == 'win32': |
133 if os.path.basename(conf.env['CXX']).startswith("g++"): |
140 if os.path.basename(conf.env['CXX']).startswith("g++"): |
134 variant_env.append_value("LINKFLAGS", "-Wl,--enable-runtime-pseudo-reloc") |
141 variant_env.append_value("LINKFLAGS", "-Wl,--enable-runtime-pseudo-reloc") |
135 |
142 |