Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: tools/build_command_buffer.py

Issue 1710983002: Make build_command_buffer.py work on Windows (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove debug print Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright 2016 Google Inc. 3 # Copyright 2016 Google Inc.
4 # 4 #
5 # Use of this source code is governed by a BSD-style license that can be 5 # Use of this source code is governed by a BSD-style license that can be
6 # found in the LICENSE file. 6 # found in the LICENSE file.
7 7
8 8
9 """ 9 """
10 Script to build the command buffer shared library and copy it to Skia tree 10 Script to build the command buffer shared library and copy it to Skia tree
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 sys.exit(args.output_dir + ' exists but is a file.') 80 sys.exit(args.output_dir + ' exists but is a file.')
81 elif not os.path.isdir(args.output_dir): 81 elif not os.path.isdir(args.output_dir):
82 if args.make_output_dir: 82 if args.make_output_dir:
83 os.makedirs(args.output_dir) 83 os.makedirs(args.output_dir)
84 else: 84 else:
85 sys.exit(args.output_dir + ' does not exist (specify --make-output-dir ' 85 sys.exit(args.output_dir + ' does not exist (specify --make-output-dir '
86 'to create).') 86 'to create).')
87 87
88 chrome_target_dir_rel = os.path.join('out', args.chrome_build_type) 88 chrome_target_dir_rel = os.path.join('out', args.chrome_build_type)
89 89
90 # The command buffer shared library will have a different name on Linux,
91 # Mac, and Windows. Also, on Linux it will be in a 'lib' subdirectory and
92 # needs to be placed in a 'lib' subdirectory of the directory containing the
93 # Skia executable. Also, the name of the gclient executable we call out to has
94 # a .bat file extension on Windows.
95 platform = sys.platform
96 if platform == 'cygwin':
97 platform = 'win32'
98
99 shared_lib_name = 'libcommand_buffer_gles2.so'
100 shared_lib_subdir = 'lib'
101 gclient = 'gclient'
102 if platform == 'darwin':
103 shared_lib_name = 'libcommand_buffer_gles2.dylib'
104 shared_lib_subdir = ''
105 elif platform == 'win32':
106 shared_lib_name = 'command_buffer_gles2.dll'
107 shared_lib_subdir = ''
108 gclient = 'gclient.bat'
109
90 if not args.no_sync: 110 if not args.no_sync:
91 try: 111 try:
92 subprocess.check_call(['git', 'fetch'], cwd=chrome_src_dir) 112 subprocess.check_call(['git', 'fetch'], cwd=chrome_src_dir)
93 except subprocess.CalledProcessError as error: 113 except subprocess.CalledProcessError as error:
94 sys.exit('Error (ret code: %s) calling "%s" in %s' % error.returncode, 114 sys.exit('Error (ret code: %s) calling "%s" in %s' % error.returncode,
95 error.cmd, chrome_src_dir) 115 error.cmd, chrome_src_dir)
96 116
97 try: 117 try:
98 subprocess.check_call(['git', 'checkout', args.chrome_revision], 118 subprocess.check_call(['git', 'checkout', args.chrome_revision],
99 cwd=chrome_src_dir) 119 cwd=chrome_src_dir)
100 except subprocess.CalledProcessError as error: 120 except subprocess.CalledProcessError as error:
101 sys.exit('Error (ret code: %s) calling "%s" in %s' % error.returncode, 121 sys.exit('Error (ret code: %s) calling "%s" in %s' % error.returncode,
102 error.cmd, chrome_src_dir) 122 error.cmd, chrome_src_dir)
103 123
104 if not args.no_sync: 124 if not args.no_sync:
105 try: 125 try:
106 os.environ['GYP_GENERATORS'] = 'ninja' 126 os.environ['GYP_GENERATORS'] = 'ninja'
107 subprocess.check_call(['gclient', 'sync', '--reset', '--force'], 127 subprocess.check_call([gclient, 'sync', '--reset', '--force'],
108 cwd=chrome_src_dir) 128 cwd=chrome_src_dir)
109 except subprocess.CalledProcessError as error: 129 except subprocess.CalledProcessError as error:
110 sys.exit('Error (ret code: %s) calling "%s" in %s' % error.returncode, 130 sys.exit('Error (ret code: %s) calling "%s" in %s' % error.returncode,
111 error.cmd, chrome_src_dir) 131 error.cmd, chrome_src_dir)
112 132
113 try: 133 try:
114 subprocess.check_call(['ninja'] + shlex.split(args.extra_ninja_args) + 134 subprocess.check_call(['ninja'] + shlex.split(args.extra_ninja_args) +
115 ['-C', chrome_target_dir_rel, 'command_buffer_gles2'], 135 ['-C', chrome_target_dir_rel, 'command_buffer_gles2'],
116 cwd=chrome_src_dir) 136 cwd=chrome_src_dir)
117 except subprocess.CalledProcessError as error: 137 except subprocess.CalledProcessError as error:
118 sys.exit('Error (ret code: %s) calling "%s" in %s' % error.returncode, 138 sys.exit('Error (ret code: %s) calling "%s" in %s' % error.returncode,
119 error.cmd, chrome_src_dir) 139 error.cmd, chrome_src_dir)
120 140
121 # The command buffer shared library will have a different extension on Linux,
122 # Mac, and Windows. Also, on Linux it will be in a 'lib' subdirectory and
123 # needs to be placed in a 'lib' subdirectory of the directory containing the
124 # Skia executable.
125 platform = sys.platform
126 if platform == 'cygwin':
127 platform = 'win32'
128
129 shared_lib_ext = '.so'
130 shared_lib_subdir = 'lib'
131 if platform == 'darwin':
132 shared_lib_ext = '.dylib'
133 shared_lib_subdir = ''
134 elif platform == 'win32':
135 shared_lib_ext = '.dll'
136 shared_lib_subdir = ''
137
138 shared_lib_src_dir = os.path.join(chrome_src_dir, chrome_target_dir_rel, 141 shared_lib_src_dir = os.path.join(chrome_src_dir, chrome_target_dir_rel,
139 shared_lib_subdir) 142 shared_lib_subdir)
140 shared_lib_dst_dir = os.path.join(args.output_dir, shared_lib_subdir) 143 shared_lib_dst_dir = os.path.join(args.output_dir, shared_lib_subdir)
141 # Make the subdir for the dst if does not exist 144 # Make the subdir for the dst if does not exist
142 if shared_lib_subdir and not os.path.isdir(shared_lib_dst_dir): 145 if shared_lib_subdir and not os.path.isdir(shared_lib_dst_dir):
143 os.mkdir(shared_lib_dst_dir) 146 os.mkdir(shared_lib_dst_dir)
144 147
145 shared_lib_name = 'libcommand_buffer_gles2' + shared_lib_ext
146 shared_lib_src = os.path.join(shared_lib_src_dir, shared_lib_name) 148 shared_lib_src = os.path.join(shared_lib_src_dir, shared_lib_name)
147 shared_lib_dst = os.path.join(shared_lib_dst_dir, shared_lib_name) 149 shared_lib_dst = os.path.join(shared_lib_dst_dir, shared_lib_name)
148 150
149 if not os.path.isfile(shared_lib_src): 151 if not os.path.isfile(shared_lib_src):
150 sys.exit('Command buffer shared library not at expected location: ' + 152 sys.exit('Command buffer shared library not at expected location: ' +
151 shared_lib_src) 153 shared_lib_src)
152 154
153 shutil.copy2(shared_lib_src, shared_lib_dst) 155 shutil.copy2(shared_lib_src, shared_lib_dst)
154 156
155 if not os.path.isfile(shared_lib_dst): 157 if not os.path.isfile(shared_lib_dst):
156 sys.exit('Command buffer library not copied to ' + shared_lib_dst) 158 sys.exit('Command buffer library not copied to ' + shared_lib_dst)
157 159
158 print('Command buffer library copied to ' + shared_lib_dst) 160 print('Command buffer library copied to ' + shared_lib_dst)
159 161
160 162
161 if __name__ == '__main__': 163 if __name__ == '__main__':
162 main() 164 main()
163 165
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698