Skip to content

Commit 61e7e2c

Browse files
committed
chore(build.bat, appveyor): upgrade to Visual Studio 2017
1 parent e8e1247 commit 61e7e2c

5 files changed

Lines changed: 61 additions & 53 deletions

File tree

README-windows.md

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,75 @@
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
313

4-
Prerequisites
5-
---
6-
librime is tested to work on Windows with the following build tools and libraries:
714
- 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.
1219

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.
1421

15-
You can also build third-party libraries manually, by following instructions in the build script.
22+
## Get the code
1623

17-
Get the code
18-
---
1924
``` batch
2025
git clone --recursive https://github.com/rime/librime.git
2126
```
2227
or [download from GitHub](https://github.com/rime/librime).
2328

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.
3036

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
3240

33-
Build Boost
34-
---
3541
``` batch
3642
build.bat boost
3743
```
3844

39-
Build third-party libraries
40-
---
45+
## Build third-party libraries
46+
4147
``` batch
4248
build.bat thirdparty
4349
```
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
4554

46-
Build librime
47-
---
4855
``` batch
4956
build.bat librime
5057
```
5158
This creates `build\lib\Release\rime.dll`.
5259

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+
5568
``` batch
5669
copy /Y build\lib\Release\rime.dll build\bin
5770
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
5972
```
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.

appveyor.install.bat

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
setlocal
22

3-
set boost_build_options=toolset=msvc-14.0^
3+
set boost_build_options=toolset=msvc-14.1^
44
variant=release^
55
link=static^
66
threading=multi^
@@ -17,21 +17,16 @@ set boost_build_options=toolset=msvc-14.0^
1717
set nocache=0
1818

1919
if not exist thirdparty.cached set nocache=1
20-
if not exist %BOOST_ROOT% set nocache=1
21-
22-
git submodule update --init
20+
if not exist %BOOST_ROOT%\stage set nocache=1
2321

2422
if %nocache% == 1 (
25-
pushd C:\Libraries
26-
appveyor DownloadFile https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.7z
27-
7z x boost_1_68_0.7z | find "ing archive"
28-
cd boost_1_68_0
23+
pushd %BOOST_ROOT%
2924
call .\bootstrap.bat
30-
call .\b2.exe --prefix=%BOOST_ROOT% %boost_build_options% -q -d0 install
31-
xcopy /e /i /y /q %BOOST_ROOT%\include\boost-1_68\boost %BOOST_ROOT%\boost
25+
.\b2.exe %boost_build_options% -q -d0 stage
3226
popd
3327
if %ERRORLEVEL% NEQ 0 goto ERROR
3428

29+
git submodule update --init
3530
call .\build.bat thirdparty
3631
if %ERRORLEVEL% NEQ 0 goto ERROR
3732

appveyor.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ pull_requests:
44
do_not_increment_build_number: true
55

66
version: '{branch} build {build}'
7-
image: Visual Studio 2015
7+
image: Visual Studio 2017
88

99
environment:
10-
BOOST_ROOT: C:\Libraries\libboost
10+
BOOST_ROOT: C:\Libraries\boost_1_69_0
1111
CL: /Zc:threadSafeInit-
1212

1313
cache:
@@ -16,7 +16,7 @@ cache:
1616
- thirdparty\include -> appveyor.install.bat
1717
- thirdparty\lib -> appveyor.install.bat
1818
- thirdparty\share -> appveyor.install.bat
19-
- C:\Libraries\libboost -> appveyor.install.bat
19+
- C:\Libraries\boost_1_69_0\stage -> appveyor.install.bat
2020

2121
init:
2222
- git --version

build.bat

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,17 @@ echo.
3030

3131
if not defined BJAM_TOOLSET (
3232
rem the number actually means platform toolset, not %VisualStudioVersion%
33-
set BJAM_TOOLSET=msvc-14.0
33+
set BJAM_TOOLSET=msvc-14.1
3434
)
3535

3636
if not defined CMAKE_GENERATOR (
37-
set CMAKE_GENERATOR="Visual Studio 14 2015"
37+
set CMAKE_GENERATOR="Visual Studio 15 2017"
3838
)
3939

4040
if not defined PLATFORM_TOOLSET (
41-
set PLATFORM_TOOLSET=v140_xp
41+
set PLATFORM_TOOLSET=v141_xp
4242
)
4343

44-
rem used when building marisa
45-
set VS_LATEST=vs2015
46-
4744
set build=build
4845
set build_boost=0
4946
set build_boost_x64=0

env.bat.template

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ rem Customize your build environment and save the modified copy to env.bat
33
set RIME_ROOT=%CD%
44

55
rem REQUIRED: path to Boost source directory
6-
set BOOST_ROOT=%USERPROFILE%\source\vendor\boost_1_60_0
6+
set BOOST_ROOT=C:\Libraries\boost_1_69_0
77

88
rem OPTIONAL: Visual Studio version and platform toolset
9-
rem set BJAM_TOOLSET=msvc-14.0
10-
rem set CMAKE_GENERATOR="Visual Studio 14 2015"
11-
rem set PLATFORM_TOOLSET=v140_xp
9+
rem set BJAM_TOOLSET=msvc-14.1
10+
rem set CMAKE_GENERATOR="Visual Studio 15 2017"
11+
rem set PLATFORM_TOOLSET=v141_xp
1212

1313
rem OPTIONAL: path to additional build tools
1414
rem set DEVTOOLS_PATH=%ProgramFiles%\Git\cmd;%ProgramFiles%\CMake\bin;C:\Python27;

0 commit comments

Comments
 (0)