mirror of
https://github.com/mii443/mozc.git
synced 2025-08-23 00:25:34 +00:00
Stop requiring vcvarsall.bat
before build_mozc.py
With this commit 'vcvarsall.bat' (and its variant) are no longer requires to be executed before running 'build_mozc.py', like 'build_qt.py' has never required 'vcvarsall.bat' (and its variant) [1]. '--vcvarsall_path' option, which is available in 'build_qt.py' [2], is also available to explicitly specify a custom path of vcvarsall.bat as follows. build_mozc.py --vcvarsall_path=C:\VS\VC\Auxiliary\Build\vcvarsall.bat Overall this commit should make our build instructions simpler and easier to keep maintaining. Closes #923. #codehealth [1]:baf418832c
[2]:c777896808
PiperOrigin-RevId: 629293616
This commit is contained in:
committed by
Hiroyuki Komatsu
parent
fcbd2d3a1a
commit
1d82d685ae
4
.github/workflows/windows.yaml
vendored
4
.github/workflows/windows.yaml
vendored
@ -59,14 +59,12 @@ jobs:
|
||||
shell: cmd
|
||||
working-directory: .\src
|
||||
run: |
|
||||
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsamd64_x86.bat"
|
||||
python build_mozc.py gyp
|
||||
|
||||
- name: build package
|
||||
shell: cmd
|
||||
working-directory: .\src
|
||||
run: |
|
||||
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsamd64_x86.bat"
|
||||
python build_mozc.py build -c Release package
|
||||
|
||||
- name: upload Mozc64.msi
|
||||
@ -110,14 +108,12 @@ jobs:
|
||||
shell: cmd
|
||||
working-directory: .\src
|
||||
run: |
|
||||
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsamd64_x86.bat"
|
||||
python build_mozc.py gyp --noqt --msvs_version=2022
|
||||
|
||||
- name: runtests
|
||||
shell: cmd
|
||||
working-directory: .\src
|
||||
run: |
|
||||
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsamd64_x86.bat"
|
||||
python build_mozc.py runtests -c Debug
|
||||
|
||||
# actions/cache works without this job, but having this would increase the likelihood of cache hit
|
||||
|
@ -14,9 +14,6 @@ git clone https://github.com/google/mozc.git
|
||||
cd mozc\src
|
||||
|
||||
python build_tools/update_deps.py
|
||||
|
||||
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsamd64_x86.bat"
|
||||
|
||||
python build_tools/build_qt.py --release --confirm_license
|
||||
python build_mozc.py gyp
|
||||
python build_mozc.py build -c Release package
|
||||
@ -76,15 +73,6 @@ You can skip this step if you would like to manually download these libraries.
|
||||
|
||||
## Build
|
||||
|
||||
### Setup Build system
|
||||
|
||||
If you have not set up the build system in your command prompt, you might need
|
||||
to execute the setup command like this.
|
||||
|
||||
```
|
||||
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsamd64_x86.bat"
|
||||
```
|
||||
|
||||
### Build Qt
|
||||
|
||||
```
|
||||
|
@ -62,6 +62,7 @@ from build_tools.util import RemoveDirectoryRecursively
|
||||
from build_tools.util import RemoveFile
|
||||
from build_tools.util import RunOrDie
|
||||
from build_tools.util import RunOrDieError
|
||||
from build_tools.vs_util import get_vs_env_vars
|
||||
|
||||
SRC_DIR = '.'
|
||||
OSS_SRC_DIR = '.'
|
||||
@ -252,6 +253,8 @@ def ParseGypOptions(args):
|
||||
parser.add_option('--msvs_version', dest='msvs_version',
|
||||
default='2022',
|
||||
help='Version of the Visual Studio.')
|
||||
parser.add_option('--vcvarsall_path', help='Path of vcvarsall.bat',
|
||||
default=None)
|
||||
|
||||
if IsWindows() or IsMac():
|
||||
parser.add_option('--qtdir', dest='qtdir',
|
||||
@ -373,6 +376,15 @@ def UpdateEnvironmentFilesForWindows(out_dir):
|
||||
|
||||
def GypMain(options, unused_args):
|
||||
"""The main function for the 'gyp' command."""
|
||||
if IsWindows():
|
||||
# GYP captures environment variables while running so setting them up as if
|
||||
# the developer manually executed 'vcvarsall.bat' command. Otherwise we end
|
||||
# up having to explain how to do that for both cmd.exe and PowerShell.
|
||||
# See https://github.com/google/mozc/pull/923
|
||||
env_vars = get_vs_env_vars('x64', options.vcvarsall_path)
|
||||
for (key, value) in env_vars.items():
|
||||
os.environ[key] = value
|
||||
|
||||
# Generate a version definition file.
|
||||
logging.info('Generating version definition file...')
|
||||
template_path = '%s/%s' % (OSS_SRC_DIR, options.version_file)
|
||||
@ -863,11 +875,6 @@ def main():
|
||||
command = sys.argv[1]
|
||||
args = sys.argv[2:]
|
||||
|
||||
if IsWindows() and (not os.environ.get('VCToolsRedistDir', '')):
|
||||
print('VCToolsRedistDir is not defined.')
|
||||
print('Please use Developer Command Prompt or run vcvarsamd64_x86.bat')
|
||||
return 1
|
||||
|
||||
if command == 'gyp':
|
||||
(cmd_opts, cmd_args) = ParseGypOptions(args)
|
||||
GypMain(cmd_opts, cmd_args)
|
||||
|
Reference in New Issue
Block a user