(runtime_library, msvs, vcvars)
| 474 | |
| 475 | |
| 476 | def build_wrapper_library_windows(runtime_library, msvs, vcvars): |
| 477 | # When building library cmake variables file is being modified |
| 478 | # for the /MD build. If the build fails and variables aren't |
| 479 | # restored then the next /MT build would be broken. Make sure |
| 480 | # that original contents of cmake variables files is always |
| 481 | # restored. |
| 482 | fix_cmake_variables_for_MD_library(try_undo=True) |
| 483 | |
| 484 | # Command to build libcef_dll_wrapper |
| 485 | cmake_wrapper = prepare_build_command(build_lib=True, vcvars=vcvars) |
| 486 | cmake_wrapper.extend(["cmake", "-G", "Ninja", |
| 487 | "-DCMAKE_BUILD_TYPE="+Options.build_type, ".."]) |
| 488 | |
| 489 | # Build directory and library path |
| 490 | build_wrapper_dir = os.path.join( |
| 491 | Options.cef_binary, |
| 492 | "build_wrapper_{runtime_library}_VS{msvs}" |
| 493 | .format(runtime_library=runtime_library, msvs=msvs)) |
| 494 | wrapper_lib = os.path.join(build_wrapper_dir, "libcef_dll_wrapper", |
| 495 | "libcef_dll_wrapper{ext}".format(ext=LIB_EXT)) |
| 496 | |
| 497 | # Check whether library is already built |
| 498 | mt_already_built = False |
| 499 | if os.path.exists(wrapper_lib): |
| 500 | mt_already_built = True |
| 501 | elif os.path.exists(build_wrapper_dir): |
| 502 | # Last build failed, clean directory |
| 503 | assert build_wrapper_dir |
| 504 | shutil.rmtree(build_wrapper_dir) |
| 505 | os.makedirs(build_wrapper_dir) |
| 506 | else: |
| 507 | os.makedirs(build_wrapper_dir) |
| 508 | |
| 509 | # Build library |
| 510 | if mt_already_built: |
| 511 | print("[automate.py] Already built: libcef_dll_wrapper" |
| 512 | " /{runtime_library} for VS{msvs}" |
| 513 | .format(runtime_library=runtime_library, msvs=msvs)) |
| 514 | else: |
| 515 | print("[automate.py] Build libcef_dll_wrapper" |
| 516 | " /{runtime_library} for VS{msvs}" |
| 517 | .format(runtime_library=runtime_library, msvs=msvs)) |
| 518 | |
| 519 | # Run cmake |
| 520 | old_gyp_msvs_version = Options.gyp_msvs_version |
| 521 | Options.gyp_msvs_version = msvs |
| 522 | if runtime_library == RUNTIME_MD: |
| 523 | fix_cmake_variables_for_MD_library() |
| 524 | env = getenv() |
| 525 | if msvs == "2010": |
| 526 | # When Using WinSDK 7.1 vcvarsall.bat doesn't work. Use |
| 527 | # setuptools.msvc.msvc9_query_vcvarsall to query env vars. |
| 528 | env.update(msvc9_query_vcvarsall(10.0, arch=VS_PLATFORM_ARG)) |
| 529 | # On Python 2.7 env values returned by both distutils |
| 530 | # and setuptools are unicode, but Python expects env |
| 531 | # dict values as strings. |
| 532 | for env_key in env: |
| 533 | env_value = env[env_key] |
no test coverage detected