diff options
author | wolenetz@chromium.org <wolenetz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-01 20:55:21 +0000 |
---|---|---|
committer | wolenetz@chromium.org <wolenetz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-01 20:55:21 +0000 |
commit | 22ff1a8b9f4f4aad7516bb46537badc525dc2cba (patch) | |
tree | 65ab9d20d74b6d695cd9e569b197c3ac0b658b64 /tools/generate_stubs | |
parent | d8d54635ad77587e09560ceef0a08850ae79713c (diff) | |
download | chromium_src-22ff1a8b9f4f4aad7516bb46537badc525dc2cba.zip chromium_src-22ff1a8b9f4f4aad7516bb46537badc525dc2cba.tar.gz chromium_src-22ff1a8b9f4f4aad7516bb46537badc525dc2cba.tar.bz2 |
Enable win64 stub library generation.
Previously, /machine:X86 was the hardcoded lib option.
This patch enables /machine:X64, if the file type parameter is 'windows_lib_x64'. To unblock media <-> ffmpeg win64 linking, this patch along with a separate patch to ffmpeg.gyp will be necessary.
BUG=172938, 166496
TEST=win_rel try bot (win32). Private with additional fix to use 'windows_lib_x64' for win64 in ffmpeg.gyp eliminates media<->ffmpeg link errors in win64. Unittests.
Review URL: https://chromiumcodereview.appspot.com/12087128
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180184 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/generate_stubs')
-rwxr-xr-x | tools/generate_stubs/generate_stubs.py | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/tools/generate_stubs/generate_stubs.py b/tools/generate_stubs/generate_stubs.py index 1c97c25..27f8d5a 100755 --- a/tools/generate_stubs/generate_stubs.py +++ b/tools/generate_stubs/generate_stubs.py @@ -76,7 +76,8 @@ SIGNATURE_REGEX = re.compile('(?P<return_type>.+?)' INVALID_C_IDENT_CHARS = re.compile('[^_a-zA-Z0-9]') # Constants defning the supported file types options. -FILE_TYPE_WIN = 'windows_lib' +FILE_TYPE_WIN_X86 = 'windows_lib' +FILE_TYPE_WIN_X64 = 'windows_lib_x64' FILE_TYPE_POSIX_STUB = 'posix_stubs' FILE_TYPE_WIN_DEF = 'windows_def' @@ -452,7 +453,8 @@ def QuietRun(args, filter=None, write_to=sys.stdout): return popen.returncode -def CreateWindowsLib(module_name, signatures, intermediate_dir, outdir_path): +def CreateWindowsLib(module_name, signatures, intermediate_dir, outdir_path, + machine): """Creates a windows library file. Calling this function will create a lib file in the outdir_path that exports @@ -465,6 +467,7 @@ def CreateWindowsLib(module_name, signatures, intermediate_dir, outdir_path): to create stubs for. intermediate_dir: The directory where the generated .def files should go. outdir_path: The directory where generated .lib files should go. + machine: String holding the machine type, 'X86' or 'X64'. Raises: SubprocessError: If invoking the windows "lib" tool fails, this is raised @@ -483,7 +486,8 @@ def CreateWindowsLib(module_name, signatures, intermediate_dir, outdir_path): # Invoke the "lib" program on Windows to create stub .lib files for the # generated definitions. These .lib files can then be used during # delayloading of the dynamic libraries. - ret = QuietRun(['lib', '/nologo', '/machine:X86', + ret = QuietRun(['lib', '/nologo', + '/machine:' + machine, '/def:' + def_file_path, '/out:' + lib_file_path], filter=' Creating library') @@ -882,9 +886,10 @@ def CreateOptionParser(): '--type', dest='type', default=None, - help=('Type of file. Valid types are "%s" or "%s" or "%s"' % - (FILE_TYPE_POSIX_STUB, FILE_TYPE_WIN, - FILE_TYPE_WIN_DEF))) + help=('Type of file. Valid types are "%s" or "%s" or "%s" ' + 'or "%s"' % + (FILE_TYPE_POSIX_STUB, FILE_TYPE_WIN_X86, + FILE_TYPE_WIN_X64, FILE_TYPE_WIN_DEF))) parser.add_option('-s', '--stubfile_name', dest='stubfile_name', @@ -901,14 +906,16 @@ def CreateOptionParser(): 'header guard and namespace for our initializer ' 'functions and does NOT affect the physical output ' 'location of the file like -o does. Ignored for ' - ' %s type.' % FILE_TYPE_WIN)) + '%s and %s types.' % + (FILE_TYPE_WIN_X86, FILE_TYPE_WIN_X64))) parser.add_option('-e', '--extra_stub_header', dest='extra_stub_header', default=None, help=('File to insert after the system includes in the ' 'generated stub implemenation file. Ignored for ' - '%s type.' % FILE_TYPE_WIN)) + '%s and %s types.' % + (FILE_TYPE_WIN_X86, FILE_TYPE_WIN_X64))) parser.add_option('-m', '--module_name', dest='module_name', @@ -936,7 +943,8 @@ def ParseOptions(): parser.error('Output location not specified') if (options.type not in - [FILE_TYPE_WIN, FILE_TYPE_POSIX_STUB, FILE_TYPE_WIN_DEF]): + [FILE_TYPE_WIN_X86, FILE_TYPE_WIN_X64, FILE_TYPE_POSIX_STUB, + FILE_TYPE_WIN_DEF]): parser.error('Invalid output file type: %s' % options.type) if options.type == FILE_TYPE_POSIX_STUB: @@ -988,7 +996,7 @@ def CreateOutputDirectories(options): return out_dir, intermediate_dir -def CreateWindowsLibForSigFiles(sig_files, out_dir, intermediate_dir): +def CreateWindowsLibForSigFiles(sig_files, out_dir, intermediate_dir, machine): """For each signature file, create a windows lib. Args: @@ -996,13 +1004,15 @@ def CreateWindowsLibForSigFiles(sig_files, out_dir, intermediate_dir): out_dir: String holding path to directory where the generated libs go. intermediate_dir: String holding path to directory generated intermdiate artifacts. + machine: String holding the machine type, 'X86' or 'X64'. """ for input_path in sig_files: infile = open(input_path, 'r') try: signatures = ParseSignatures(infile) module_name = ExtractModuleName(os.path.basename(input_path)) - CreateWindowsLib(module_name, signatures, intermediate_dir, out_dir) + CreateWindowsLib(module_name, signatures, intermediate_dir, out_dir, + machine) finally: infile.close() @@ -1105,8 +1115,10 @@ def main(): options, args = ParseOptions() out_dir, intermediate_dir = CreateOutputDirectories(options) - if options.type == FILE_TYPE_WIN: - CreateWindowsLibForSigFiles(args, out_dir, intermediate_dir) + if options.type == FILE_TYPE_WIN_X86: + CreateWindowsLibForSigFiles(args, out_dir, intermediate_dir, 'X86') + elif options.type == FILE_TYPE_WIN_X64: + CreateWindowsLibForSigFiles(args, out_dir, intermediate_dir, 'X64') elif options.type == FILE_TYPE_POSIX_STUB: CreatePosixStubsForSigFiles(args, options.stubfile_name, out_dir, intermediate_dir, options.path_from_source, |