1111 automate.py (-h | --help) [type -h to show full description for options]
1212
1313Options:
14- -h --help Show this help message.
15- --prebuilt-cef Whether to use prebuilt CEF binaries. Prebuilt
16- binaries for Linux are built on Ubuntu.
17- --build-cef Whether to build CEF from sources with the cefpython
18- patches applied.
19- --cef-branch CEF branch. Defaults to CHROME_VERSION_BUILD from
20- "src/version/cef_version_{platform}.h" (TODO).
21- --cef-commit CEF revision. Defaults to CEF_COMMIT_HASH from
22- "src/version/cef_version_{platform}.h" (TODO).
23- --build-dir Build directory.
24- --cef-build-dir CEF build directory. By default same as --build-dir.
25- --ninja-jobs How many CEF jobs to run in parallel. To speed up
26- building set it to number of cores in your CPU.
27- By default set to cpu_count / 2.
28- --gyp-generators Set GYP_GENERATORS [default: ninja].
29- --gyp-msvs-version Set GYP_MSVS_VERSION.
14+ -h --help Show this help message.
15+ --prebuilt-cef Whether to use prebuilt CEF binaries. Prebuilt
16+ binaries for Linux are built on Ubuntu.
17+ --build-cef Whether to build CEF from sources with the cefpython
18+ patches applied.
19+ --cef-branch=<b> CEF branch. Defaults to CHROME_VERSION_BUILD from
20+ "src/version/cef_version_{platform}.h" (TODO).
21+ --cef-commit=<c> CEF revision. Defaults to CEF_COMMIT_HASH from
22+ "src/version/cef_version_{platform}.h" (TODO).
23+ --build-dir=<dir1> Build directory.
24+ --cef-build-dir=<dir2> CEF build directory. By default same
25+ as --build-dir.
26+ --ninja-jobs=<jobs> How many CEF jobs to run in parallel. To speed up
27+ building set it to number of cores in your CPU.
28+ By default set to cpu_count / 2.
29+ --gyp-generators=<gen> Set GYP_GENERATORS [default: ninja].
30+ --gyp-msvs-version=<v> Set GYP_MSVS_VERSION.
3031
3132"""
3233
@@ -118,12 +119,6 @@ def setup_options(docopt_args):
118119 usage = __doc__
119120 for key in docopt_args :
120121 value = docopt_args [key ]
121- if key .startswith ("--" ):
122- match = re .search (r"\[%s\s+([^\]]+)\]" % (re .escape (key ),),
123- usage )
124- if match :
125- arg_key = match .group (1 )
126- value = docopt_args [arg_key ]
127122 key2 = key .replace ("--" , "" ).replace ("-" , "_" )
128123 if hasattr (Options , key2 ) and value is not None :
129124 setattr (Options , key2 , value )
@@ -153,6 +148,8 @@ def setup_options(docopt_args):
153148 print ("[automate.py] ERROR: Build dir cannot contain spaces" )
154149 print (">> " + Options .build_dir )
155150 sys .exit (1 )
151+ if not os .path .exists (Options .build_dir ):
152+ os .makedirs (Options .build_dir )
156153
157154 # --cef-build-dir
158155 if Options .cef_build_dir :
@@ -163,6 +160,8 @@ def setup_options(docopt_args):
163160 print ("[automate.py] ERROR: CEF build dir cannot contain spaces" )
164161 print (">> " + Options .cef_build_dir )
165162 sys .exit (1 )
163+ if not os .path .exists (Options .cef_build_dir ):
164+ os .makedirs (Options .cef_build_dir )
166165
167166 # --depot-tools-dir
168167 Options .depot_tools_dir = os .path .join (Options .cef_build_dir ,
@@ -279,11 +278,7 @@ def build_cef_projects():
279278 cef_binary = symbols .replace ("_debug_symbols" , "" )
280279 assert "symbols" not in os .path .basename (cef_binary )
281280 build_cefclient = os .path .join (cef_binary , "build_cefclient" )
282- build_wrapper_mt = os .path .join (cef_binary , "build_wrapper_mt" )
283- build_wrapper_md = os .path .join (cef_binary , "build_wrapper_md" )
284281 os .makedirs (build_cefclient )
285- os .makedirs (build_wrapper_mt )
286- os .makedirs (build_wrapper_md )
287282
288283 # Build cefclient and cefsimple
289284 print ("[automate.py] Building cefclient and cefsimple..." )
@@ -301,6 +296,9 @@ def build_cef_projects():
301296 if platform .system () == "Windows" :
302297 assert (os .path .exists (os .path .join (build_cefclient , "cefclient" ,
303298 "cefclient.exe" )))
299+ else :
300+ assert (os .path .exists (os .path .join (build_cefclient , "cefclient" ,
301+ "cefclient" )))
304302
305303 # Command to build libcef_dll_wrapper
306304 wrapper_command = ""
@@ -310,16 +308,29 @@ def build_cef_projects():
310308 % Options .build_type
311309 wrapper_command += "ninja libcef_dll_wrapper"
312310
311+ # Build libcef_dll_wrapper libs
312+ if platform .system () == "Windows" :
313+ build_wrapper_windows (cef_binary , wrapper_command )
314+ elif platform .system () == "Linux" :
315+ build_wrapper_linux (cef_binary , wrapper_command )
316+
317+
318+ def build_wrapper_windows (cef_binary , wrapper_command ):
319+ # Directories
320+ build_wrapper_mt = os .path .join (cef_binary , "build_wrapper_mt" )
321+ build_wrapper_md = os .path .join (cef_binary , "build_wrapper_md" )
322+ os .makedirs (build_wrapper_mt )
323+ os .makedirs (build_wrapper_md )
324+
313325 # Build libcef_dll_wrapper_mt.lib
314326 print ("[automate.py] Building libcef_dll_wrapper /MT" )
315327 old_gyp_msvs_version = Options .gyp_msvs_version
316328 Options .gyp_msvs_version = get_msvs_for_python ()
317329 run_command (wrapper_command , build_wrapper_mt )
318330 Options .gyp_msvs_version = old_gyp_msvs_version
319331 print ("[automate.py] OK" )
320- if platform .system () == "Windows" :
321- assert (os .path .exists (os .path .join (build_wrapper_mt , "libcef_dll" ,
322- "libcef_dll_wrapper.lib" )))
332+ assert (os .path .exists (os .path .join (build_wrapper_mt , "libcef_dll" ,
333+ "libcef_dll_wrapper.lib" )))
323334
324335 # Build libcef_dll_wrapper_md.lib
325336 print ("[automate.py] Building libcef_dll_wrapper /MD" )
@@ -340,9 +351,21 @@ def build_cef_projects():
340351 run_command (wrapper_command , build_wrapper_md )
341352 Options .gyp_msvs_version = old_gyp_msvs_version
342353 print ("[automate.py] OK" )
343- if platform .system () == "Windows" :
344- assert (os .path .exists (os .path .join (build_wrapper_md , "libcef_dll" ,
345- "libcef_dll_wrapper.lib" )))
354+ assert (os .path .exists (os .path .join (build_wrapper_md , "libcef_dll" ,
355+ "libcef_dll_wrapper.lib" )))
356+
357+
358+ def build_wrapper_linux (cef_binary , wrapper_command ):
359+ # Directory
360+ build_wrapper = os .path .join (cef_binary , "build_wrapper" )
361+ os .makedirs (build_wrapper )
362+
363+ # Build libcef_dll_wrapper.a and .o files
364+ print ("[automate.py] Building libcef_dll_wrapper" )
365+ run_command (wrapper_command , build_wrapper )
366+ print ("[automate.py] OK" )
367+ assert (os .path .exists (os .path .join (build_wrapper , "libcef_dll" ,
368+ "libcef_dll_wrapper.a" )))
346369
347370
348371def get_msvs_for_python ():
@@ -415,7 +438,8 @@ def run_automate_git():
415438 ninja -v -j2 -Cout\Release cefclient
416439 """
417440 args = []
418- if ARCH64 :
441+ if ARCH64 and platform .system () != "Linux" :
442+ # The x64 build flag is only supported on Windows and Mac OS X.
419443 args .append ("--x64-build" )
420444 args .append ("--download-dir=" + Options .cef_build_dir )
421445 args .append ("--branch=" + Options .cef_branch )
0 commit comments