forked from rime/weasel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.bat
130 lines (113 loc) · 3.38 KB
/
build.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
setlocal
if exist env.bat call env.bat
set work=%cd%
set build_option=/t:Build
set build_boost=0
set build_data=0
set build_hant=0
set build_rime=0
set build_x64=1
:parse_cmdline_options
if "%1" == "" goto end_parsing_cmdline_options
if "%1" == "rebuild" set build_option=/t:Rebuild
if "%1" == "boost" set build_boost=1
if "%1" == "data" set build_data=1
if "%1" == "hant" set build_hant=1
if "%1" == "rime" set build_rime=1
if "%1" == "librime" set build_rime=1
if "%1" == "all" (
set build_boost=1
set build_data=1
set build_hant=1
set build_rime=1
)
if "%1" == "nox64" set build_x64=0
shift
goto parse_cmdline_options
:end_parsing_cmdline_options
cd %work%
if exist output\weaselserver.exe (
output\weaselserver.exe /q
)
if %build_boost% == 1 (
call :build_boost
cd %work%
)
if %build_rime% == 1 (
cd %work%\librime
if not exist librime\thirdparty\lib\opencc.lib (
call build.bat thirdparty
)
call build.bat
cd %work%
rem copy /Y librime\thirdparty\lib\*.lib lib\
copy /Y librime\build\lib\Release\rime.dll output\
)
if %build_data% == 1 (
call :build_data
) else if not exist output\data\essay.txt (
call :build_data
)
del msbuild*.log
if %build_hant% == 1 (
if %build_x64% == 1 (
msbuild.exe weasel.sln %build_option% /p:Configuration=ReleaseHant /p:Platform="x64" /fl4
if errorlevel 1 goto error
)
msbuild.exe weasel.sln %build_option% /p:Configuration=ReleaseHant /p:Platform="Win32" /fl3
if errorlevel 1 goto error
)
if %build_x64% == 1 (
msbuild.exe weasel.sln %build_option% /p:Configuration=Release /p:Platform="x64" /fl2
if errorlevel 1 goto error
)
msbuild.exe weasel.sln %build_option% /p:Configuration=Release /p:Platform="Win32" /fl1
if errorlevel 1 goto error
goto end
:build_boost
set boost_build_flags=toolset=msvc-14.0 variant=release link=static threading=multi runtime-link=static
set boost_libs=--with-date_time --with-filesystem --with-locale --with-regex --with-signals --with-system --with-thread
cd %BOOST_ROOT%
if not exist bjam.exe call bootstrap.bat
if %ERRORLEVEL% NEQ 0 goto error
bjam %boost_build_flags% stage %boost_libs%
if %ERRORLEVEL% NEQ 0 goto error
if %build_x64% == 1 (
bjam %boost_build_flags% address-model=64 --stagedir=stage_x64 stage %boost_libs%
if %ERRORLEVEL% NEQ 0 goto error
)
exit /b
:build_data
rem call :build_essay
copy %work%\LICENSE.txt output\
copy %work%\README.md output\README.txt
copy %work%\brise\essay.txt output\data\
copy %work%\brise\default.yaml output\data\
copy %work%\brise\symbols.yaml output\data\
copy %work%\brise\preset\*.yaml output\data\
copy %work%\brise\supplement\*.yaml output\data\
if not exist output\expansion mkdir output\expansion
copy %work%\brise\extra\*.yaml output\expansion\
call :build_opencc_data
exit /b
:build_essay
rem essay.kct is deprecated.
copy %work%\librime\thirdparty\bin\kctreemgr.exe %work%\brise\
copy %work%\librime\thirdparty\bin\zlib1.dll %work%\brise\
cd %work%\brise
call make_essay.bat
cd %work%
exit /b
:build_opencc_data
if not exist %work%\librime\thirdparty\data\opencc\TSCharacters.ocd (
cd %work%\librime
call build.bat thirdparty
)
cd %work%
if not exist output\data\opencc mkdir output\data\opencc
copy %work%\librime\thirdparty\data\opencc\*.* output\data\opencc\
exit /b
:error
echo error building weasel...
:end
cd %work%