Commits

Peter Hosey committed 4008cd5

Added architecture support, defaulting to x86_64.

  • Participants
  • Parent commits 24eab56

Comments (0)

Files changed (1)

File incarnate.py

 create_build_folder(products_dir)
 
 OPT_CC = 'CC'
+OPT_ARCH = 'ARCH'
 OPT_CFLAGS = 'CFLAGS'
 OPT_LDFLAGS = 'LDFLAGS'
 OPT__FILE_TYPE = '_FILE_TYPE' #for cc -x
 default_CC = os.environ.get(OPT_CC, 'xcrun clang')
 default_CC = default_CC.split(' ')
 
+default_ARCH = os.environ.get(OPT_ARCH, 'x86_64')
+
 defaults = {
 	'm': {
 		OPT_CC: default_CC,
+		OPT_ARCH: default_ARCH,
 		OPT_CFLAGS: ['-c', '-std=c1x'] + ARC_args + warnings_c + warnings_objc,
 		OPT__FILE_TYPE: 'objective-c',
 		OPT__OUTPUT_TYPE: 'o',
 	},
 	'c': {
 		OPT_CC: default_CC,
+		OPT_ARCH: default_ARCH,
 		OPT_CFLAGS: ['-c', '-std=c1x'] + warnings_c,
 		OPT__FILE_TYPE: 'c',
 		OPT__OUTPUT_TYPE: 'o',
 	},
 	'pch': {
 		OPT_CC: default_CC,
+		OPT_ARCH: default_ARCH,
 		OPT_CFLAGS: ['-std=c1x'] + ARC_args + warnings_c + warnings_objc,
 		OPT__FILE_TYPE: 'objective-c-header',
 		OPT__OUTPUT_STRIP_INPUT_EXTENSION: False,
 		else:
 			type_args = ['-x', type_name]
 
-		argv = params[OPT_CC] +	type_args + include_flags_from_paths(input_dirs) + include_flags_from_paths([temps_dir]) + params[OPT_CFLAGS] + params[OPT_LDFLAGS] + [path, '-o', output_path]
+		arch_flags = ['-arch', params[OPT_ARCH]] if (OPT_ARCH in params) else []
+		argv = params[OPT_CC] +	type_args + include_flags_from_paths(input_dirs) + include_flags_from_paths([temps_dir]) + arch_flags + params[OPT_CFLAGS] + params[OPT_LDFLAGS] + [path, '-o', output_path]
 		print ' '.join(argv)
 		job = subprocess.Popen(argv)
 		jobs[job.pid] = job