|
110 | 110 | nargs='+',
|
111 | 111 | help='Source file(s) to compile / object file(s) to link')
|
112 | 112 |
|
| 113 | +parser.add_argument('--std', |
| 114 | + metavar='std', |
| 115 | + dest='std', |
| 116 | + required=False, |
| 117 | + help='Specify the C/C++ standard.') |
| 118 | + |
113 | 119 |
|
114 | 120 | args = parser.parse_args(args=sys.argv[1:])
|
115 | 121 |
|
@@ -231,6 +237,7 @@ def __init__(self, toolchain_type, args, obj_ext):
|
231 | 237 | self.verbose = args.verbose
|
232 | 238 | self.obj_ext = obj_ext
|
233 | 239 | self.lib_paths = args.libs_dir
|
| 240 | + self.std = args.std |
234 | 241 |
|
235 | 242 | def _exe_file_name(self):
|
236 | 243 | assert self.mode != 'compile'
|
@@ -581,6 +588,9 @@ def _get_compilation_command(self, source, obj):
|
581 | 588 | args.append('--')
|
582 | 589 | args.append(source)
|
583 | 590 |
|
| 591 | + if self.std: |
| 592 | + args.append('/std:' + self.std) |
| 593 | + |
584 | 594 | return ('compiling', [source], obj,
|
585 | 595 | self.compile_env,
|
586 | 596 | args)
|
@@ -652,6 +662,9 @@ def _get_compilation_command(self, source, obj):
|
652 | 662 | if sys.platform == 'darwin':
|
653 | 663 | args.extend(['-isysroot', self.apple_sdk])
|
654 | 664 |
|
| 665 | + if self.std: |
| 666 | + args.append('-std={0}'.format(self.std)) |
| 667 | + |
655 | 668 | return ('compiling', [source], obj, None, args)
|
656 | 669 |
|
657 | 670 | def _get_link_command(self):
|
@@ -789,6 +802,7 @@ def fix_arguments(args):
|
789 | 802 | print(' Verbose: ' + str(args.verbose))
|
790 | 803 | print(' Dryrun: ' + str(args.dry))
|
791 | 804 | print(' Inputs: ' + format_text(args.inputs, 0, 10))
|
| 805 | + print(' C/C++ Standard: ' + str(args.std)) |
792 | 806 | print('Script Environment:')
|
793 | 807 | print_environment(os.environ)
|
794 | 808 |
|
|
0 commit comments