1How to build Mozc in Windows 2============================ 3 4# System Requirements 5 664-bit Windows is required to build Mozc for Windows. Mozc itself is expected to work on Windows 7 and later, including 32-bit Windows. 7 8# Software Requirements 9 10Building Mozc on Windows requires the following software. 11 12 * [Visual Studio 2015 Community Edition](http://visualstudio.com/free), or any greater edition. 13 * (optinal) [Qt 5](https://download.qt.io/official_releases/qt/) 14 * Commercial version and LGPL version are available. 15 * You must download msvs2015 32-bit version of Qt 5 since currently `mozc_tool.exe` needs to be built as a 32-bit executable. 16 17# Get dependent prebuilt binaries 18 19If you do not have `git`, `python 2.7`, and `ninja` in your build environment, you can use prebuilt binaries in [depot\_tools](https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html). You need to manually unzip `depot_tools.zip` and add the extracted directory into your `PATH`. 20 21``` 22set PATH=%PATH%;c:\work\depot_tools 23``` 24 25Then run `gclient` command twice so that dependent libraries can be installed automatically. 26 27``` 28gclient 29gclient 30``` 31 32# Get the Code 33 34You can download Mozc source code as follows: 35 36``` 37mkdir c:\work 38cd c:\work 39git clone https://github.com/google/mozc.git -b master --single-branch --recursive 40``` 41 42# Compilation 43 44First, you'll need to generate Visual C++ project files using a tool called [GYP](https://chromium.googlesource.com/external/gyp). 45 46``` 47cd c:\work\mozc\src 48python build_mozc.py gyp --qtdir=c:\Qt\Qt5.6.2\5.6\msvc2015 49``` 50 51The directory of Qt (`c:\Qt\Qt5.6.2\5.6\msvc2015` 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. 52 53You can also specify `--branding=GoogleJapaneseInput` option and `--wix_dir=<dir to WiX binaries>` option here to reproduce official Google Japanese Input binaries and installers. 54 55Then, build Mozc binaries: 56 57``` 58python build_mozc.py build -c Release package 59``` 60 61If you need debug information, you can build debug version of Mozc as follows. 62 63``` 64python build_mozc.py build -c Debug package 65``` 66 67# Executables 68 69You have release build binaries in `c:\work\mozc\src\out\Release` and `c:\work\mozc\src\out\Release_x64`. 70 71# Clean up the Tree 72 73To clean up the tree, execute the following. This will remove executables and intermediate files like object files, generated source files, project files, etc. 74 75``` 76python build_mozc.py clean 77``` 78 79# Installation and Uninstallation 80 81Although 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. 82 83Note 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. 84 85 86--- 87 88## Install Mozc (32-bit) 89 90Following files must be placed under %ProgramFiles%\Mozc. 91 92 * `C:\work\mozc\src\out\Release\mozc_broker32.exe` 93 * `C:\work\mozc\src\out\Release\mozc_cache_service.exe` 94 * `C:\work\mozc\src\out\Release\mozc_renderer.exe` 95 * `C:\work\mozc\src\out\Release\mozc_server.exe` 96 * `C:\work\mozc\src\out\Release\mozc_tool.exe` (if you specified `--noqt` option) 97 * `C:\work\mozc\src\out\ReleaseDynamic\mozc_tool.exe` (if you didn't specify `--noqt` option) 98 * `C:\work\mozc\src\out\ReleaseDynamic\Qt5Core.dll` (not required if you specified `--noqt` option) 99 * `C:\work\mozc\src\out\ReleaseDynamic\Qt5Gui.dll` (not required if you specified `--noqt` option) 100 * `C:\work\mozc\src\out\ReleaseDynamic\Qt5Widgets.dll` (not required if you specified `--noqt` option) 101 * `C:\work\mozc\src\out\ReleaseDynamic\platforms\qwindows.dll` (not required if you specified `--noqt` option) 102 103`Qt5Core.dll`, `Qt5Gui.dll`, `Qt5Widgets.dll`, and `qwindows.dll` are not required if you specified `--noqt` option into the gyp command. 104 105### Register Mozc for IMM32 into 32-bit environment 106 107Following files must be placed under `%windir%\System32`. 108 109 * `C:\work\mozc\src\out\Release\mozc_ja.ime` 110 111Finally, you must run `mozc_broker32.exe` with administrator privilege to register IME module as follows. 112 113``` 114"%ProgramFiles%\Mozc\mozc_broker32.exe" --mode=register_ime 115``` 116 117### Register Mozc for TSF into 32-bit environment 118 119Following file must be placed under `%ProgramFiles%\Mozc`. 120 121 * `C:\work\mozc\src\out\Release\mozc_ja_tip32.dll` 122 123Finally, you must run `regsvr32` with administrator privilege to register IME module as follows. 124 125``` 126regsvr32 "%ProgramFiles%\Mozc\mozc_ja_tip32.dll" 127``` 128 129--- 130 131## Uninstall Mozc (32-bit) 132 133### Unregister Mozc for IMM32 from 32-bit environment 134 135Run `mozc_broker32.exe` with administrator privilege to unregister IME module as follows. 136 137``` 138"%ProgramFiles%\Mozc\mozc_broker32.exe" --mode=unregister_ime 139``` 140 141Then delete the following file. 142 143 * `%windir%\System32\mozc_ja.ime` 144 145### Unregister Mozc for TSF from 32-bit environment 146 147Run `regsvr32` with administrator privilege to unregister IME module as follows. 148 149``` 150regsvr32 /u "%ProgramFiles%\Mozc\mozc_ja_tip32.dll" 151``` 152 153### Uninstall common files of Mozc from 32-bit environment 154 155Delete following directory and files after unregistering Mozc from IMM32/TSF. 156 157 * `%ProgramFiles%\Mozc\` 158 159--- 160 161## Install Mozc (64-bit) 162 163Following files must be placed under %ProgramFiles(x86)%\Mozc. 164 165 * `C:\work\mozc\src\out\Release\mozc_broker32.exe` 166 * `C:\work\mozc\src\out\Release\mozc_cache_service.exe` 167 * `C:\work\mozc\src\out\Release\mozc_renderer.exe` 168 * `C:\work\mozc\src\out\Release\mozc_server.exe` 169 * `C:\work\mozc\src\out\Release\mozc_tool.exe` (if you specified `--noqt` option) 170 * `C:\work\mozc\src\out\ReleaseDynamic\mozc\_tool.exe` (if you didn't specify `--noqt` option) 171 * `C:\work\mozc\src\out\ReleaseDynamic\Qt5Core.dll` (not required if you specified `--noqt` option) 172 * `C:\work\mozc\src\out\ReleaseDynamic\Qt5Gui.dll` (not required if you specified `--noqt` option) 173 * `C:\work\mozc\src\out\ReleaseDynamic\Qt5Widgets.dll` (not required if you specified `--noqt` option) 174 * `C:\work\mozc\src\out\ReleaseDynamic\platforms\qwindows.dll` (not required if you specified `--noqt` option) 175 * `C:\work\mozc\src\out\Release_x64\mozc_broker64.exe` 176 177`Qt5Core.dll`, `Qt5Gui.dll`, `Qt5Widgets.dll`, and `qwindows.dll` are not required if you specified `--noqt` option into the gyp command. 178 179### Register Mozc for IMM32 into 64-bit environment 180 181Following files must be placed under `%windir%\System32`. 182 183 * `C:\work\mozc\src\out\Release_x64\mozc_ja.ime` 184 185Following files must be placed under `%windir%\SysWOW64`. 186 187 * `C:\work\mozc\src\out\Release\mozc_ja.ime` 188 189Finally, you must run `mozc_broker64.exe` with administrator privilege to register IME module as follows. 190 191``` 192"%ProgramFiles(x86)%\Mozc\mozc_broker64.exe" --mode=register_ime 193``` 194 195### Register Mozc for TSF into 64-bit environment 196 197Following file must be placed under `%ProgramFiles(x86)%\Mozc`. 198 199 * `C:\work\mozc\src\out\Release\mozc_ja_tip32.dll` 200 * `C:\work\mozc\src\out\Release_x64\mozc_ja_tip64.dll` 201 202Finally, you must run `regsvr32` with administrator privilege to register IME module as follows. 203 204``` 205regsvr32 "%ProgramFiles(x86)%\Mozc\mozc_ja_tip32.dll" 206regsvr32 "%ProgramFiles(x86)%\Mozc\mozc_ja_tip64.dll" 207``` 208 209--- 210 211## Uninstall Mozc (64-bit) 212 213### Unregister Mozc for IMM32 from 64-bit environment 214 215Run `mozc_broker64.exe` with administrator privilege to unregister IME module as follows. 216 217``` 218"%ProgramFiles(x86)%\Mozc\mozc_broker64.exe" --mode=unregister_ime 219``` 220 221Then delete the following files. 222 223 * `%windir%\System32\mozc_ja.ime` 224 * `%windir%\SysWOW64\mozc_ja.ime` 225 226### Unregister Mozc for TSF from 64-bit environment 227 228Run `regsvr32` with administrator privilege to unregister IME module as follows. 229 230``` 231regsvr32 /u "%ProgramFiles(x86)%\Mozc\mozc_ja_tip32.dll" 232regsvr32 /u "%ProgramFiles(x86)%\Mozc\mozc_ja_tip64.dll" 233``` 234 235### Uninstall common files of Mozc from 64-bit environment 236 237Delete following directory and files after unregistering Mozc from IMM32/TSF. 238 239 * `%ProgramFiles(x86)%\Mozc\` 240 241--- 242 243 244# Run unit tests 245 246You can run unit tests as follows. 247 248``` 249cd c:\work\mozc\src 250python build_mozc.py gyp --noqt 251python build_mozc.py runtests -c Release 252``` 253 254Note that you can specify `--qtdir=` option instead of `--noqt` in GYP phase since currently there is no unit test that depends on Qt. 255