|
1 | | -Rime with Windows |
2 | | -=== |
| 1 | +# Rime with Windows |
| 2 | + |
| 3 | +## Prerequisites |
| 4 | + |
| 5 | +`librime` is tested to work on Windows with the following combinations of build |
| 6 | +tools and libraries: |
| 7 | + |
| 8 | + - Visual Studio 2017 |
| 9 | + - [Boost](http://www.boost.org/)=1.64 |
| 10 | + - [cmake](http://www.cmake.org/)>=3.8 |
| 11 | + |
| 12 | +and |
3 | 13 |
|
4 | | -Prerequisites |
5 | | ---- |
6 | | -librime is tested to work on Windows with the following build tools and libraries: |
7 | 14 | - Visual Studio 2015 |
8 | | - - [Boost](http://www.boost.org/)>=1.60 |
9 | | - - [cmake](http://www.cmake.org/)>=2.8 |
10 | | - |
11 | | -[Python](https://python.org)>=2.7 is needed to build opencc dictionaries. |
| 15 | + - [Boost](http://www.boost.org/)=1.60 |
| 16 | + - [cmake](http://www.cmake.org/)>=3.8 |
| 17 | + |
| 18 | +Boost and cmake versions need to match higher VS version. |
12 | 19 |
|
13 | | -You may need to update Boost when using a higher version of VS. |
| 20 | +[Python](https://python.org)>=2.7 is needed to build opencc dictionaries. |
14 | 21 |
|
15 | | -You can also build third-party libraries manually, by following instructions in the build script. |
| 22 | +## Get the code |
16 | 23 |
|
17 | | -Get the code |
18 | | ---- |
19 | 24 | ``` batch |
20 | 25 | git clone --recursive https://github.com/rime/librime.git |
21 | 26 | ``` |
22 | 27 | or [download from GitHub](https://github.com/rime/librime). |
23 | 28 |
|
24 | | -Setup a build environment |
25 | | ---- |
26 | | -Copy `env.bat.template` to `env.bat` and edit the script according to your setup. |
27 | | -Specifically, make sure `BOOST_ROOT` is set to the path to Boost source directory; |
28 | | -modify `CMAKE_GENERATOR` and `PLATFORM_TOOLSET` if using a different version of Visual Studio; |
29 | | -set `DEVTOOLS_PATH` for build tools installed to a custom location. |
| 29 | +## Setup a build environment |
| 30 | + |
| 31 | +Copy `env.bat.template` to `env.bat` and edit the file according to your setup. |
| 32 | +Specifically, make sure `BOOST_ROOT` is set to the root directory of Boost |
| 33 | +source tree; modify `BJAM_TOOLSET`, `CMAKE_GENERATOR` and `PLATFORM_TOOLSET` if |
| 34 | +using a different version of Visual Studio; also set `DEVTOOLS_PATH` for build |
| 35 | +tools installed to custom location. |
30 | 36 |
|
31 | | -When prepared, run the following commands in a Developer Command Prompt window. |
| 37 | +When prepared, do the following in a *Developer Command Prompt* window. |
| 38 | + |
| 39 | +## Build Boost |
32 | 40 |
|
33 | | -Build Boost |
34 | | ---- |
35 | 41 | ``` batch |
36 | 42 | build.bat boost |
37 | 43 | ``` |
38 | 44 |
|
39 | | -Build third-party libraries |
40 | | ---- |
| 45 | +## Build third-party libraries |
| 46 | + |
41 | 47 | ``` batch |
42 | 48 | build.bat thirdparty |
43 | 49 | ``` |
44 | | -This builds dependent libraries in `thirdparty\src\*`, and copies artifacts to `thirdparty\lib` and `thirdparty\bin`. |
| 50 | +This builds dependent libraries in `thirdparty\src\*`, and copies artifacts to |
| 51 | +`thirdparty\lib` and `thirdparty\bin`. |
| 52 | + |
| 53 | +## Build librime |
45 | 54 |
|
46 | | -Build librime |
47 | | ---- |
48 | 55 | ``` batch |
49 | 56 | build.bat librime |
50 | 57 | ``` |
51 | 58 | This creates `build\lib\Release\rime.dll`. |
52 | 59 |
|
53 | | -Try it in the console |
54 | | ---- |
| 60 | +Build artifacts - the shared library along with API headers and supporting files |
| 61 | +are gathered in `dist` directory. |
| 62 | + |
| 63 | +## Try it in the console |
| 64 | + |
| 65 | +`librime` comes with a REPL application which can be used to test if the library |
| 66 | +is working. |
| 67 | + |
55 | 68 | ``` batch |
56 | 69 | copy /Y build\lib\Release\rime.dll build\bin |
57 | 70 | cd build\bin |
58 | | -echo "congmingdeRime{space}shurufa" | Release\rime_api_console.exe > output.txt |
| 71 | +echo congmingdeRime{space}shurufa | Release\rime_api_console.exe > output.txt |
59 | 72 | ``` |
| 73 | + |
| 74 | +Instead of redirecting output to a file, you can set appropriate code page |
| 75 | +(`chcp 65001`) and font in the console to work with the REPL interactively. |
0 commit comments