Skip to content

Commit

Permalink
feat(build.bat): customize PLATFORM_TOOLSET settings
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 323b5bb
Author: Chen Gong <chen.sst@gmail.com>
Date:   Thu Feb 22 01:01:45 2018 +0800

    chore(build.bat): fix typo [ci skip]

commit 0f12562
Author: Chen Gong <chen.sst@gmail.com>
Date:   Thu Feb 22 00:55:52 2018 +0800

    chore(render.js): display interpolated environment variables

commit 75999ec
Author: Prcuvu <prcuvu@gmail.com>
Date:   Wed Feb 21 20:19:51 2018 +0800

    fix(render.js): use ADO stream to handle UTF-8 encoding

commit 3edd85e
Author: Chen Gong <chen.sst@gmail.com>
Date:   Wed Feb 21 18:39:36 2018 +0800

    chore(appveyor): use auto-generated weasel.props

commit 796d202
Author: Chen Gong <chen.sst@gmail.com>
Date:   Wed Feb 21 18:37:12 2018 +0800

    feat(build.bat): generate weasel.props by interpolating variables in template

commit 709e697
Author: Chen Gong <chen.sst@gmail.com>
Date:   Wed Feb 21 17:57:26 2018 +0800

    chore(build.bat): let user set environment variables while providing defaults

commit 66787f0
Author: Prcuvu <prcuvu@gmail.com>
Date:   Wed Feb 21 17:07:39 2018 +0800

    Update INSTALL.md

commit ebf8575
Author: Prcuvu <prcuvu@gmail.com>
Date:   Wed Feb 21 17:00:18 2018 +0800

    chore(boost.bat): improve detection for :build_boost

commit 3c6d76c
Author: Prcuvu <prcuvu@gmail.com>
Date:   Wed Feb 21 14:05:18 2018 +0800

    Fix include order in project files.

commit 5a1bb45
Author: Chen Gong <chen.sst@gmail.com>
Date:   Mon Feb 19 03:08:05 2018 +0800

    feat(build.bat): customize PLATFORM_TOOLSET settings
  • Loading branch information
lotem committed Feb 25, 2018
1 parent b1d1ec4 commit c7a9a4f
Show file tree
Hide file tree
Showing 24 changed files with 659 additions and 763 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ ReleaseHant/
/lib/*.lib
/include/glog
/ipch
env.bat
weasel.props
*.log
*.user
Expand Down
99 changes: 33 additions & 66 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

## Preparation

Assume we already have a default installation of **Visual Studio 2015**.
Assume we already have an installation of **Visual Studio 2015** including the component
"MFC and ATL support".

Install dev tools: `git`, `cmake`
Download third-party libraries: `boost(>=1.60.0)`

Optional: install `python` for building OpenCC dictionaries

## Checkout source code

Make sure you also checkout submodules `brise` and `librime` under `weasel` directory.
Expand All @@ -15,97 +18,61 @@ Make sure you also checkout submodules `brise` and `librime` under `weasel` dire
git clone --recursive https://github.com/rime/weasel.git
```

## Fast build

If you want to build Weasel in minimal steps, jump to [this section] (#build-and-install-weasel).

## Build librime

This section guides you to build librime, the core input method library used by Weasel.

To be verbose, you'll get the following binaries as the build output of librime, as well as its
dependent third-party libraries including boost, glog, marisa-trie, leveldb, opencc, yaml-cpp.

* `librime\build\lib\Release\rime.dll` / `rime.lib`
* `thirdparty\bin\libglog.dll`
* `thirdparty\bin\opencc.dll`

### Using prebuilt binaries
## Build and Install Weasel

If you've already got a copy of prebuilt binaries of librime,
you can simply copy `.dll`s / `.lib`s into `weasel\output` / `weasel\lib` directories respectively.
Then go straight to building Weasel.
Locate `weasel` source directory.

### Setup build environment

Edit `librime\env.bat.template`, save your copy as `librime\env.bat`.

Make sure `BOOST_ROOT` is set to `\path\to\boost_1_57_0` in `librime\env.bat`.

Then, start VC command line tools from `librime\shell.bat`.
Start a Developer Command Prompt window.

### Build librime and its dependencies
Set `BOOST_ROOT` environment variable:

At the command prompt, enter the following command:
```batch
rem cd librime
rem shell.bat
build.bat boost thirdparty librime
set BOOST_ROOT=X:\path\to\boost_N_NN_N
```

With some luck, you now have a copy of the built library in `librime\build\lib\Release`:
* shared library - `rime.dll` / `rime.lib`, these will be used by Weasel
* static library - `librime.lib`, if built with `build.bat static`

### Play with Rime command line tools
Alternatively, save your build environment settings in `env.bat`.
You can create the file by copying `env.bat.template` and make modifications.
Make sure `BOOST_ROOT` is set to existing `X:\path\to\boost_N_NN_N` in your copy.

Rime comes with a REPL application by which you can test if the library is working.
### Build

Windows command line does not use UTF-8 character encoding, thus we save the output to a file.
```batch
rem cd librime
copy /Y thirdparty\bin\*.dll build\bin\
copy /Y build\lib\Release\rime.dll build\bin\
cd build\bin
echo zhongzhouyunshurufa | Release\rime_api_console.exe > output.txt
cd weasel
build.bat all
```

## Build and Install Weasel

Back to `weasel` directory.

### Setup build environment

Edit `env.bat.template`, save your copy as `env.bat`.

Edit `weasel.props.template`, save your copy as `weasel.props`.
Forget about Python. It's not used anyway.
Voila.

Then, start VC command line tools from `shell.bat`.
### Alternative: using prebuilt Rime binaries

### Build
If you've already got a copy of prebuilt binaries of librime,
you can simply copy `.dll`s / `.lib`s into `weasel\output` / `weasel\lib` directories respectively.
Then build Weasel without the `all` command line option.

```batch
rem cd \path\to\weasel
rem shell.bat
build.bat all
build.bat boost data hant
```

Or, if using prebuilt librime libraries (see "Using prebuilt binaries" section above):
### Install and try it live

```batch
build.bat boost data hant
cd output
install.bat
```

Voila.
### Optional: play with Rime command line tools

### Install and try it live
Rime comes with a REPL application which can be used to test if the library is working.

Windows command line does not use UTF-8 character encoding, thus we save the output to a file.
```batch
cd output
install.bat
cd librime
copy /Y thirdparty\bin\*.dll build\bin\
copy /Y build\lib\Release\rime.dll build\bin\
cd build\bin
echo zhongzhouyunshurufa | Release\rime_api_console.exe > output.txt
```

### Create installer packages
Expand All @@ -114,4 +81,4 @@ To create installer packages, you need to download and install [Unicode NSIS] (h

Then go to `output` directory, right-click and choose "Compile Unicode NSIS Script" with `install.nsi` and `expansion.nsi`.

Installers will be generated in `archives` directory.
Installers will be generated in `output\archives` directory.
Loading

0 comments on commit c7a9a4f

Please sign in to comment.