@@ -368,8 +368,6 @@ def build_cef_projects():
368368 if WINDOWS :
369369 fix_cmake_variables_permanently_windows ()
370370
371- fix_cef_include_files ()
372-
373371 # Find cef_binary directory.
374372 # Might already be set if --prebuilt-cef flag was passed.
375373 if not Options .cef_binary :
@@ -476,7 +474,7 @@ def build_wrapper_library_windows(runtime_library, msvs, vcvars):
476474 fix_cmake_variables_for_MD_library (try_undo = True )
477475
478476 # Command to build libcef_dll_wrapper
479- cmake_wrapper = prepare_build_command (build_lib = True , vcvars = vcvars )
477+ cmake_wrapper = prepare_build_command ()
480478 cmake_wrapper .extend (["cmake" , "-G" , "Ninja" ,
481479 "-DCMAKE_BUILD_TYPE=" + Options .build_type , ".." ])
482480
@@ -515,27 +513,14 @@ def build_wrapper_library_windows(runtime_library, msvs, vcvars):
515513 Options .gyp_msvs_version = msvs
516514 if runtime_library == RUNTIME_MD :
517515 fix_cmake_variables_for_MD_library ()
518- env = getenv ()
519- if msvs == "2010" :
520- # When Using WinSDK 7.1 vcvarsall.bat doesn't work. Use
521- # setuptools.msvc.msvc9_query_vcvarsall to query env vars.
522- from setuptools .msvc import msvc9_query_vcvarsall
523- env .update (msvc9_query_vcvarsall (10.0 , arch = VS_PLATFORM_ARG ))
524- # On Python 2.7 env values returned by both distutils
525- # and setuptools are unicode, but Python expects env
526- # dict values as strings.
527- for env_key in env :
528- env_value = env [env_key ]
529- if type (env_value ) != str :
530- env [env_key ] = env_value .encode ("utf-8" )
531- run_command (cmake_wrapper , working_dir = build_wrapper_dir , env = env )
516+ run_command (cmake_wrapper , working_dir = build_wrapper_dir )
532517 Options .gyp_msvs_version = old_gyp_msvs_version
533518 if runtime_library == RUNTIME_MD :
534519 fix_cmake_variables_for_MD_library (undo = True )
535520 print ("[automate.py] cmake OK" )
536521
537522 # Run ninja
538- ninja_wrapper = prepare_build_command (build_lib = True , vcvars = vcvars )
523+ ninja_wrapper = prepare_build_command ()
539524 ninja_wrapper .extend (["ninja" , "-j" , Options .ninja_jobs ,
540525 "libcef_dll_wrapper" ])
541526 run_command (ninja_wrapper , working_dir = build_wrapper_dir )
@@ -581,7 +566,6 @@ def fix_cmake_variables_for_MD_library(undo=False, try_undo=False):
581566 # Warnings are treated as errors so this needs to be ignored:
582567 # >> warning C4275: non dll-interface class 'stdext::exception'
583568 # >> used as base for dll-interface class 'std::bad_cast'
584- # This warning occurs only in VS2008, in VS2013 not.
585569 # This replacements must be unique for the undo operation
586570 # to be reliable.
587571
@@ -632,7 +616,7 @@ def build_wrapper_library_mac():
632616 # On Mac it is required to link libcef_dll_wrapper against
633617 # libc++ library, so must build this library separately
634618 # from cefclient.
635- cmake_wrapper = prepare_build_command (build_lib = True )
619+ cmake_wrapper = prepare_build_command ()
636620 cmake_wrapper .extend (["cmake" , "-G" , "Ninja" ,
637621 "-DPROJECT_ARCH=x86_64" ,
638622 "-DCMAKE_CXX_FLAGS=-stdlib=libc++" ,
@@ -664,56 +648,22 @@ def build_wrapper_library_mac():
664648 run_command (cmake_wrapper , build_wrapper_dir )
665649 print ("[automate.py] cmake OK" )
666650 # Ninja
667- ninja_wrapper = prepare_build_command (build_lib = True )
651+ ninja_wrapper = prepare_build_command ()
668652 ninja_wrapper .extend (["ninja" , "-j" , Options .ninja_jobs ,
669653 "libcef_dll_wrapper" ])
670654 run_command (ninja_wrapper , build_wrapper_dir )
671655 print ("[automate.py] ninja OK" )
672656 assert os .path .exists (wrapper_lib )
673657
674658
675- def prepare_build_command (build_lib = False , vcvars = None ):
676- """On Windows VS env variables must be set up by calling vcvarsall.bat"""
677- command = list ()
659+ def prepare_build_command ():
660+ """On Windows VS env variables must be set up by calling vcvarsall.bat. """
661+ command = []
678662 if platform .system () == "Windows" :
679- if build_lib :
680- if vcvars == VS2010_VCVARS :
681- # When using WinSDK 7.1 vcvarsall.bat is broken. Instead
682- # env variables are queried using setuptools.msvc.
683- return command
684- if vcvars :
685- command .append (vcvars )
686- else :
687- command .append (get_vcvars_for_python ())
688- command .append (VS_PLATFORM_ARG )
689- else :
690- if int (Options .cef_branch ) >= 2704 :
691- command .append (VS2015_VCVARS )
692- else :
693- command .append (VS2013_VCVARS )
694- command .append (VS_PLATFORM_ARG )
695- command .append ("&&" )
663+ command .extend ([VCVARS , VS_PLATFORM_ARG , "&&" ])
696664 return command
697665
698666
699- def fix_cef_include_files ():
700- """Fixes to CEF include header files for eg. VS2008 on Windows."""
701- # TODO: This was fixed in upstream CEF, remove this code during
702- # next CEF update on Windows.
703- if platform .system () == "Windows" and get_msvs_for_python () == "2008" :
704- print ("[automate.py] Fixing CEF include/ files" )
705- # cef_types_wrappers.h
706- cef_types_wrappers = os .path .join (Options .cef_binary , "include" ,
707- "internal" , "cef_types_wrappers.h" )
708- with open (cef_types_wrappers , "rb" ) as fp :
709- contents = fp .read ().decode ("utf-8" )
710- # error C2059: syntax error : '{'
711- contents = contents .replace ("s->range = {0, 0};" ,
712- "s->range.from = 0; s->range.to = 0;" )
713- with open (cef_types_wrappers , "wb" ) as fp :
714- fp .write (contents .encode ("utf-8" ))
715-
716-
717667def create_prebuilt_binaries ():
718668 """After building copy binaries/libs to build/cef_xxxx/.
719669 Not all projects may have been built on all platforms."""
@@ -866,25 +816,10 @@ def copy_app(app):
866816
867817
868818def get_available_python_compilers ():
869- all_python_compilers = OrderedDict ([
870- ("2008" , VS2008_VCVARS ),
871- ("2010" , VS2010_VCVARS ),
872- ("2015" , VS2015_VCVARS ),
873- ])
874- ret_compilers = OrderedDict ()
875- for msvs in all_python_compilers :
876- vcvars = all_python_compilers [msvs ]
877- if os .path .exists (vcvars ):
878- ret_compilers [msvs ] = vcvars
879- else :
880- print ("[automate.py] INFO: Visual Studio compiler not found:"
881- " {vcvars}" .format (vcvars = vcvars ))
882- return ret_compilers
883-
884-
885- def get_vcvars_for_python ():
886- msvs = get_msvs_for_python ()
887- return globals ()["VS" + msvs + "_VCVARS" ]
819+ if not os .path .exists (VCVARS ):
820+ print ("[automate.py] ERROR: vcvarsall.bat not found: {}" .format (VCVARS ))
821+ return OrderedDict ()
822+ return OrderedDict ([("2015" , VCVARS )])
888823
889824
890825def getenv ():
0 commit comments