mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02:00 
			
		
		
		
	Windows: Support building with a custom VS toolchain (issue #1470).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1950 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
		| @@ -18,8 +18,8 @@ patches = [ | |||||||
|     # Disable Warning 4702 ("Unreachable code") for Windows VS builds. |     # Disable Warning 4702 ("Unreachable code") for Windows VS builds. | ||||||
|     # https://code.google.com/p/chromium/issues/detail?id=346399#c55 |     # https://code.google.com/p/chromium/issues/detail?id=346399#c55 | ||||||
|     # |     # | ||||||
|     # Allow use of the make gyp generator on Linux. |     # Include build variables in custom environment files. | ||||||
|     # https://code.google.com/p/chromiumembedded/issues/detail?id=1304 |     # https://code.google.com/p/chromium/issues/detail?id=313974#c6 | ||||||
|     'name': 'build', |     'name': 'build', | ||||||
|     'path': '../build/', |     'path': '../build/', | ||||||
|   }, |   }, | ||||||
|   | |||||||
| @@ -22,23 +22,6 @@ index f97bf66..116c7bc 100644 | |||||||
|          ], |          ], | ||||||
|          'msvs_settings': { |          'msvs_settings': { | ||||||
|            'VCCLCompilerTool': { |            'VCCLCompilerTool': { | ||||||
| diff --git gyp_chromium gyp_chromium |  | ||||||
| index ad2796b..1407d9c 100755 |  | ||||||
| --- gyp_chromium |  | ||||||
| +++ gyp_chromium |  | ||||||
| @@ -269,12 +269,6 @@ if __name__ == '__main__': |  | ||||||
|    if sys.platform not in ('darwin',): |  | ||||||
|      args.append('--no-circular-check') |  | ||||||
|   |  | ||||||
| -  # We explicitly don't support the make gyp generator (crbug.com/348686). Be |  | ||||||
| -  # nice and fail here, rather than choking in gyp. |  | ||||||
| -  if re.search(r'(^|,|\s)make($|,|\s)', os.environ.get('GYP_GENERATORS', '')): |  | ||||||
| -    print 'Error: make gyp generator not supported (check GYP_GENERATORS).' |  | ||||||
| -    sys.exit(1) |  | ||||||
| - |  | ||||||
|    # If CHROMIUM_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check |  | ||||||
|    # to enfore syntax checking. |  | ||||||
|    syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') |  | ||||||
| diff --git mac/strip_save_dsym mac/strip_save_dsym | diff --git mac/strip_save_dsym mac/strip_save_dsym | ||||||
| index c9cf226..0dedbe3 100755 | index c9cf226..0dedbe3 100755 | ||||||
| --- mac/strip_save_dsym | --- mac/strip_save_dsym | ||||||
| @@ -52,3 +35,16 @@ index c9cf226..0dedbe3 100755 | |||||||
|                                stdout=subprocess.PIPE) |                                stdout=subprocess.PIPE) | ||||||
|   |   | ||||||
|    archs = [] |    archs = [] | ||||||
|  | diff --git toolchain/win/setup_toolchain.py toolchain/win/setup_toolchain.py | ||||||
|  | index 5e292ab..70ad093 100644 | ||||||
|  | --- toolchain/win/setup_toolchain.py | ||||||
|  | +++ toolchain/win/setup_toolchain.py | ||||||
|  | @@ -25,6 +25,8 @@ def ExtractImportantEnvironment(): | ||||||
|  |    envvars_to_save = ( | ||||||
|  |        'goma_.*',  # TODO(scottmg): This is ugly, but needed for goma. | ||||||
|  |        'include',  # Needed by midl compiler. | ||||||
|  | +      'lib', | ||||||
|  | +      'libpath', | ||||||
|  |        'path', | ||||||
|  |        'pathext', | ||||||
|  |        'systemroot', | ||||||
|   | |||||||
| @@ -6,8 +6,10 @@ | |||||||
| from gclient_util import * | from gclient_util import * | ||||||
| import os, sys | import os, sys | ||||||
|  |  | ||||||
| # The CEF root directory is the parent directory of _this_ script. | # The CEF directory is the parent directory of _this_ script. | ||||||
| cef_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) | cef_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) | ||||||
|  | # The src directory is the parent directory of the CEF directory. | ||||||
|  | src_dir = os.path.abspath(os.path.join(cef_dir, os.pardir)) | ||||||
|  |  | ||||||
| print "\nGenerating CEF version header file..." | print "\nGenerating CEF version header file..." | ||||||
| gyper = [ 'python', 'tools/make_version_header.py', | gyper = [ 'python', 'tools/make_version_header.py', | ||||||
| @@ -30,6 +32,77 @@ print "\nGenerating CEF project files..." | |||||||
| if not 'DEPOT_TOOLS_WIN_TOOLCHAIN' in os.environ.keys(): | if not 'DEPOT_TOOLS_WIN_TOOLCHAIN' in os.environ.keys(): | ||||||
|   os.environ['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0' |   os.environ['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0' | ||||||
|  |  | ||||||
|  | # By default GYP+Ninja on Windows expects Visual Studio to be installed on the | ||||||
|  | # local machine. To build when Visual Studio is extracted to a directory but not | ||||||
|  | # installed (e.g. via a custom toolchain) you have two options: | ||||||
|  | # | ||||||
|  | # 1. Set up the environment using only environment variables: | ||||||
|  | #   set WIN_CUSTOM_TOOLCHAIN=1 | ||||||
|  | #   set VS_ROOT=<VS root directory> | ||||||
|  | #   set SDK_ROOT=<Platform SDK root directory> | ||||||
|  | #   set INCLUDE=<VS include paths> | ||||||
|  | #   set PATH=<VS executable paths> | ||||||
|  | #   set LIB=<VS library paths> | ||||||
|  | # | ||||||
|  | # 2. Set up the environment using a combination of environment variables and the | ||||||
|  | #    "%GYP_MSVS_OVERRIDE_PATH%\VC\vcvarsall.bat" script: | ||||||
|  | #   set GYP_MSVS_OVERRIDE_PATH=<VS root directory> | ||||||
|  | #   set GYP_DEFINES="windows_sdk_path=<Platform SDK root directory>" | ||||||
|  | # | ||||||
|  | # The following environment variables must also be set: | ||||||
|  | #   set DEPOT_TOOLS_WIN_TOOLCHAIN=0 | ||||||
|  | #   set GYP_MSVS_VERSION=<VS version> | ||||||
|  | #   set CEF_VCVARS=<empty .bat file> | ||||||
|  | custom_toolchain = False | ||||||
|  | if 'WIN_CUSTOM_TOOLCHAIN' in os.environ.keys() and \ | ||||||
|  |     os.environ['WIN_CUSTOM_TOOLCHAIN'] == '1': | ||||||
|  |   required_vars = [ | ||||||
|  |     'GYP_MSVS_VERSION', | ||||||
|  |     'VS_ROOT', | ||||||
|  |     'SDK_ROOT', | ||||||
|  |     'INCLUDE', | ||||||
|  |     'PATH', | ||||||
|  |     'LIB', | ||||||
|  |   ] | ||||||
|  |   for var in required_vars: | ||||||
|  |     if not var in os.environ.keys(): | ||||||
|  |       raise Exception('%s environment variable must be set' % var) | ||||||
|  |  | ||||||
|  |   custom_toolchain = True | ||||||
|  |  | ||||||
|  |   # Set windows_sdk_path via GYP_DEFINES. | ||||||
|  |   gyp_defines = '' | ||||||
|  |   if 'GYP_DEFINES' in os.environ.keys(): | ||||||
|  |     gyp_defines = os.environ['GYP_DEFINES'] + ' ' | ||||||
|  |   gyp_defines = gyp_defines + \ | ||||||
|  |                 'windows_sdk_path=' + os.environ['SDK_ROOT'].replace('\\', '/') | ||||||
|  |   os.environ['GYP_DEFINES'] = gyp_defines | ||||||
|  |  | ||||||
|  |   # Necessary to return correct VS version information via GetVSVersion in | ||||||
|  |   # src/tools/gyp/pylib/gyp/msvs_emulation.py. | ||||||
|  |   os.environ['GYP_MSVS_OVERRIDE_PATH'] = os.environ['VS_ROOT'] | ||||||
|  |  | ||||||
|  |   # Generate environment files (environment.x64, environment.x86) in each | ||||||
|  |   # build output directory. | ||||||
|  |   # When using the default toolchain this is done by GenerateEnvironmentFiles | ||||||
|  |   # in src/tools/gyp/pylib/gyp/msvs_emulation.py. | ||||||
|  |   setup_script = \ | ||||||
|  |       os.path.join(src_dir, 'build/toolchain/win/setup_toolchain.py') | ||||||
|  |   win_tool_script = os.path.join(src_dir, 'tools/gyp/pylib/gyp/win_tool.py') | ||||||
|  |   out_dirs = ['Debug', 'Debug_x64', 'Release', 'Release_x64'] | ||||||
|  |   for out_dir in out_dirs: | ||||||
|  |     out_dir_abs = os.path.join(src_dir, 'out', out_dir) | ||||||
|  |     if not os.path.exists(out_dir_abs): | ||||||
|  |       os.makedirs(out_dir_abs) | ||||||
|  |     cmd = ['python', setup_script, | ||||||
|  |            os.environ['VS_ROOT'], win_tool_script, os.environ['SDK_ROOT']] | ||||||
|  |     RunAction(out_dir_abs, cmd) | ||||||
|  |  | ||||||
| os.environ['CEF_DIRECTORY'] = os.path.basename(cef_dir) | os.environ['CEF_DIRECTORY'] = os.path.basename(cef_dir) | ||||||
| gyper = [ 'python', '../build/gyp_chromium', 'cef.gyp', '-I', 'cef.gypi' ] | gyper = [ 'python', '../build/gyp_chromium', 'cef.gyp', '-I', 'cef.gypi' ] | ||||||
|  | if custom_toolchain: | ||||||
|  |   # Disable GYP's auto-detection of the VS install. | ||||||
|  |   gyper.extend(['-G', 'ninja_use_custom_environment_files']) | ||||||
|  | if 'GYP_ARGUMENTS' in os.environ.keys(): | ||||||
|  |   gyper.extend(os.environ['GYP_ARGUMENTS'].split(' ')) | ||||||
| RunAction(cef_dir, gyper) | RunAction(cef_dir, gyper) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user