If you are not sure what the following commands do, please check the descriptions below and make sure the operations before running them.
git config --global core.autocrlf false
git config --global core.eol lf
mkdir C:\work
cd C:\work
git clone https://github.com/google/mozc.git -b master --single-branch --recursive
cd C:\work\mozc\src\third_party
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
python3 -m pip install six
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsamd64_x86.bat"
cd C:\work\mozc\src
python build_mozc.py gyp --qtdir=C:\Qt\Qt5.15.2\msvc2019 --msvs_version=2019
python build_mozc.py build -c Release package
64-bit Windows 10 or later.
Building Mozc on Windows requires the following software.
- Visual Studio 2017, or any greater edition.
- Python 3.7 or later
- git
- Qt 5 (optional for GUI)
- 32-bit version is required because
mozc_tool.exe
is build as a 32-bit executable.
- 32-bit version is required because
The following commands change your global configuration. If you use different configurations, you might want to restore the previous configurations after the build.
git config --global core.autocrlf false
git config --global core.eol lf
mkdir C:\work
cd C:\work
git clone https://github.com/google/mozc.git -b master --single-branch --recursive
cd C:\work\mozc\src\third_party
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
python3 -m pip install six
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 (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsamd64_x86.bat"
The following command builds Mozc without Qt based GUI tools.
cd C:\work\mozc\src
python build_mozc.py gyp --noqt --msvs_version=2019
python build_mozc.py build -c Release package
To build Mozc with GUI tools, you need to specify the Qt directory.
cd C:\work\mozc\src
python build_mozc.py gyp --qtdir=C:\Qt\Qt5.15.2\msvc2019 --msvs_version=2019
python build_mozc.py build -c Release package
The directory of Qt (C:\Qt\Qt5.12.2\msvc2019
in this example) differs
based on Qt version. If you specify --noqt
option
instead of --qtdir=<dir to Qt>
, mozc_tool will be built as a mock version,
which does nothing.
You need to specify your Visual Studio version to --msvs_version
.
The default value is 2017
.
If you need debug information, you can build debug version of Mozc as follows.
python build_mozc.py build -c Debug package
You have release build binaries in C:\work\mozc\src\out_win\Release
and C:\work\mozc\src\out_win\Release_x64
.
To clean up the tree, execute the following. This will remove executables and intermediate files like object files, generated source files, project files, etc.
python build_mozc.py clean
Although the code repository covers source files of the official Google Japanese Input installer (see win32/custom_action
and win32/installer
), building Windows Installer package for OSS Mozc is not supported yet. You need to manually copy Mozc binaries and run a command as follows.
Following files must be placed under %ProgramFiles%\Mozc.
C:\work\mozc\src\out_win\Release\mozc_broker32.exe
C:\work\mozc\src\out_win\Release\mozc_cache_service.exe
C:\work\mozc\src\out_win\Release\mozc_renderer.exe
C:\work\mozc\src\out_win\Release\mozc_server.exe
C:\work\mozc\src\out_win\Release\mozc_tool.exe
(if you specified--noqt
option)C:\work\mozc\src\out_win\ReleaseDynamic\mozc_tool.exe
(if you didn't specify--noqt
option)C:\work\mozc\src\out_win\ReleaseDynamic\Qt5Core.dll
(not required if you specified--noqt
option)C:\work\mozc\src\out_win\ReleaseDynamic\Qt5Gui.dll
(not required if you specified--noqt
option)C:\work\mozc\src\out_win\ReleaseDynamic\Qt5Widgets.dll
(not required if you specified--noqt
option)C:\work\mozc\src\out_win\ReleaseDynamic\platforms\qwindows.dll
(not required if you specified--noqt
option)
Qt5Core.dll
, Qt5Gui.dll
, Qt5Widgets.dll
, and qwindows.dll
are not required if you specified --noqt
option into the gyp command.
Following file must be placed under %ProgramFiles%\Mozc
.
C:\work\mozc\src\out_win\Release\mozc_ja_tip32.dll
Finally, you must run regsvr32
with administrator privilege to register IME module as follows.
regsvr32 "%ProgramFiles%\Mozc\mozc_ja_tip32.dll"
Run regsvr32
with administrator privilege to unregister IME module as follows.
regsvr32 /u "%ProgramFiles%\Mozc\mozc_ja_tip32.dll"
Delete following directory and files after unregistering Mozc from IMM32/TSF.
%ProgramFiles%\Mozc\
Following files must be placed under %ProgramFiles(x86)%\Mozc.
C:\work\mozc\src\out_win\Release\mozc_broker32.exe
C:\work\mozc\src\out_win\Release\mozc_cache_service.exe
C:\work\mozc\src\out_win\Release\mozc_renderer.exe
C:\work\mozc\src\out_win\Release\mozc_server.exe
C:\work\mozc\src\out_win\Release\mozc_tool.exe
(if you specified--noqt
option)C:\work\mozc\src\out_win\ReleaseDynamic\mozc\_tool.exe
(if you didn't specify--noqt
option)C:\work\mozc\src\out_win\ReleaseDynamic\Qt5Core.dll
(not required if you specified--noqt
option)C:\work\mozc\src\out_win\ReleaseDynamic\Qt5Gui.dll
(not required if you specified--noqt
option)C:\work\mozc\src\out_win\ReleaseDynamic\Qt5Widgets.dll
(not required if you specified--noqt
option)C:\work\mozc\src\out_win\ReleaseDynamic\platforms\qwindows.dll
(not required if you specified--noqt
option)C:\work\mozc\src\out_win\Release_x64\mozc_broker64.exe
Qt5Core.dll
, Qt5Gui.dll
, Qt5Widgets.dll
, and qwindows.dll
are not required if you specified --noqt
option into the gyp command.
Following file must be placed under %ProgramFiles(x86)%\Mozc
.
C:\work\mozc\src\out_win\Release\mozc_ja_tip32.dll
C:\work\mozc\src\out_win\Release_x64\mozc_ja_tip64.dll
Finally, you must run regsvr32
with administrator privilege to register IME module as follows.
regsvr32 "%ProgramFiles(x86)%\Mozc\mozc_ja_tip32.dll"
regsvr32 "%ProgramFiles(x86)%\Mozc\mozc_ja_tip64.dll"
Run regsvr32
with administrator privilege to unregister IME module as follows.
regsvr32 /u "%ProgramFiles(x86)%\Mozc\mozc_ja_tip32.dll"
regsvr32 /u "%ProgramFiles(x86)%\Mozc\mozc_ja_tip64.dll"
Delete following directory and files after unregistering Mozc from IMM32/TSF.
%ProgramFiles(x86)%\Mozc\
You can run unit tests as follows.
cd C:\work\mozc\src
python build_mozc.py gyp --noqt
python build_mozc.py runtests -c Release
Note that you can specify --qtdir=
option instead of --noqt
in GYP phase since currently there is no unit test that depends on Qt.