64-bit Windows is required to build Mozc for Windows. Mozc itself is expected to work on Windows Vista SP2 and later, including 32-bit Windows.
Building Mozc on Windows requires the following software.
First, you'll need to download the gclient depot_tools, and add depot_tools to your PATH.
set PATH=%PATH%;c:\work\depot_tools
Then download the code:
mkdir c:\work\mozc cd c:\work\mozc gclient config https://github.com/google/mozc.git --name=. --deps-file=src/DEPS gclient sync
Execute the following command to update to the latest revision.
gclient sync
Updating the tree sometimes causes a mysterious build error. Try build_mozc.py clean if it occurs.
First, you'll need to generate Visual C++ project files using a tool called GYP, which is automatically downloaded by gclient sync:
cd c:\work\mozc\src python build_mozc.py gyp --qtdir=c:\Qt\4.8.0
The directory of Qt (C:\Qt\4.8.0 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 can also specify --branding=GoogleJapaneseInput option and --wix_dir=<dir to WiX binaries> option here to reproduce official Google Japanese Input binaries and installers.
Then, build Mozc binaries:
python build_mozc.py build -c Release package
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\Release and c:\work\mozc\src\out\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.
Note that Mozc now supports two input method APIs called IMM32 and TSF (Text Services Framework). Although you can register Mozc for both APIs at the same time, IMM32 is not recommended on Windows 8 and later.
Following files must be placed under %ProgramFiles%\Mozc.
C:\work\mozc\src\out\Release\mozc_broker32.exeC:\work\mozc\src\out\Release\mozc_cache_service.exeC:\work\mozc\src\out\Release\mozc_renderer.exeC:\work\mozc\src\out\Release\mozc_server.exeC:\work\mozc\src\out\Release\mozc_tool.exe (if you specified --noqt option)C:\work\mozc\src\out\ReleaseDynamic\mozc_tool.exe (if you didn't specify --noqt option)C:\work\mozc\src\out\ReleaseDynamic\QtCore4.dll (not required if you specified --noqt option)C:\work\mozc\src\out\ReleaseDynamic\QtGui4.dll (not required if you specified --noqt option)QtCore4.dll and QtGui4.dll are not required if you specified --noqt option into the gyp command.
Following files must be placed under %windir%\System32.
C:\work\mozc\src\out\Release\mozc_ja.imeFinally, you must run mozc_broker32.exe with administrator privilege to register IME module as follows.
"%ProgramFiles%\Mozc\mozc_broker32.exe" --mode=register_ime
Following file must be placed under %ProgramFiles%\Mozc.
C:\work\mozc\src\out\Release\mozc_ja_tip32.dllFinally, you must run regsvr32 with administrator privilege to register IME module as follows.
regsvr32 "%ProgramFiles%\Mozc\mozc_ja_tip32.dll"
Run mozc_broker32.exe with administrator privilege to unregister IME module as follows.
"%ProgramFiles%\Mozc\mozc_broker32.exe" --mode=unregister_ime
Then delete the following file.
%windir%\System32\mozc_ja.imeRun 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\Release\mozc_broker32.exeC:\work\mozc\src\out\Release\mozc_cache_service.exeC:\work\mozc\src\out\Release\mozc_renderer.exeC:\work\mozc\src\out\Release\mozc_server.exeC:\work\mozc\src\out\Release\mozc_tool.exe (if you specified --noqt option)C:\work\mozc\src\out\ReleaseDynamic\mozc\_tool.exe (if you didn't specify --noqt option)C:\work\mozc\src\out\ReleaseDynamic\QtCore4.dll (not required if you specified --noqt option)C:\work\mozc\src\out\ReleaseDynamic\QtGui4.dll (not required if you specified --noqt option)C:\work\mozc\src\out\Release_x64\mozc_broker64.exeFollowing files must be placed under %windir%\System32.
C:\work\mozc\src\out\Release_x64\mozc_ja.imeFollowing files must be placed under %windir%\SysWOW64.
C:\work\mozc\src\out\Release\mozc_ja.imeFinally, you must run mozc_broker64.exe with administrator privilege to register IME module as follows.
"%ProgramFiles(x86)%\Mozc\mozc_broker64.exe" --mode=register_ime
Following file must be placed under %ProgramFiles(x86)%\Mozc.
C:\work\mozc\src\out\Release\mozc_ja_tip32.dllC:\work\mozc\src\out\Release_x64\mozc_ja_tip64.dllFinally, 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 mozc_broker64.exe with administrator privilege to unregister IME module as follows.
"%ProgramFiles(x86)%\Mozc\mozc_broker64.exe" --mode=unregister_ime
Then delete the following files.
%windir%\System32\mozc_ja.ime%windir%\SysWOW64\mozc_ja.imeRun 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, currently there is no unit test that depends on Qt.