@@ -26,14 +26,12 @@ exit /b 1
26
26
echo BOOST_ROOT=%BOOST_ROOT%
27
27
echo .
28
28
29
- set clean = 0
30
- set build_dir_base = build
31
- set build_dir_suffix =
32
29
set build_config = Release
33
30
set build_deps = 0
34
31
set build_librime = 0
35
32
set build_shared = ON
36
33
set build_test = OFF
34
+ set clean = 0
37
35
set enable_logging = ON
38
36
39
37
:parse_cmdline_options
@@ -44,23 +42,21 @@ rem `thirdparty` is deprecated in favor of `deps`
44
42
if " %1 " == " thirdparty" set build_deps = 1
45
43
if " %1 " == " librime" set build_librime = 1
46
44
if " %1 " == " static" (
47
- set build_dir_suffix = -static
48
45
set build_shared = OFF
49
46
)
50
47
if " %1 " == " shared" (
51
- set build_dir_suffix =
52
48
set build_shared = ON
53
49
)
54
50
if " %1 " == " test" (
55
51
set build_librime = 1
56
52
set build_test = ON
57
53
)
58
54
if " %1 " == " debug" (
59
- set build_dir_base = debug
55
+ if not defined build_dir set build_dir = debug
60
56
set build_config = Debug
61
57
)
62
58
if " %1 " == " release" (
63
- set build_dir_base = build
59
+ if not defined build_dir set build_dir = build
64
60
set build_config = Release
65
61
)
66
62
if " %1 " == " logging" (
@@ -79,18 +75,20 @@ if %build_deps% == 0 (
79
75
set build_librime = 1
80
76
)))
81
77
78
+ if not defined build_dir set build_dir = build
79
+ if not defined deps_install_prefix set deps_install_prefix = %RIME_ROOT%
80
+ if not defined rime_install_prefix set rime_install_prefix = %RIME_ROOT% \dist
81
+
82
82
if %clean% == 1 (
83
- rmdir /s /q build
84
- rmdir /s /q deps\glog\build
85
- rmdir /s /q deps\googletest\build
86
- rmdir /s /q deps\leveldb\build
87
- rmdir /s /q deps\marisa-trie\build
88
- rmdir /s /q deps\opencc\build
89
- rmdir /s /q deps\yaml-cpp\build
83
+ rmdir /s /q %build_dir%
84
+ rmdir /s /q deps\glog\%build_dir%
85
+ rmdir /s /q deps\googletest\%build_dir%
86
+ rmdir /s /q deps\leveldb\%build_dir%
87
+ rmdir /s /q deps\marisa-trie\%build_dir%
88
+ rmdir /s /q deps\opencc\%build_dir%
89
+ rmdir /s /q deps\yaml-cpp\%build_dir%
90
90
)
91
91
92
- set build_dir = %build_dir_base%%build_dir_suffix%
93
-
94
92
if defined CMAKE_GENERATOR (
95
93
set common_cmake_flags = %common_cmake_flags% -G%CMAKE_GENERATOR%
96
94
)
@@ -111,7 +109,7 @@ set common_cmake_flags=%common_cmake_flags%^
111
109
112
110
set deps_cmake_flags = %common_cmake_flags% ^
113
111
-DBUILD_SHARED_LIBS:BOOL=OFF^
114
- -DCMAKE_INSTALL_PREFIX:PATH=" %RIME_ROOT % "
112
+ -DCMAKE_INSTALL_PREFIX:PATH=" %deps_install_prefix % "
115
113
116
114
if %build_deps% == 1 (
117
115
echo building glog.
@@ -184,7 +182,8 @@ set rime_cmake_flags=%common_cmake_flags%^
184
182
-DBUILD_SHARED_LIBS=%build_shared% ^
185
183
-DBUILD_TEST=%build_test% ^
186
184
-DENABLE_LOGGING=%enable_logging% ^
187
- -DCMAKE_INSTALL_PREFIX:PATH=" %RIME_ROOT% \dist"
185
+ -DCMAKE_PREFIX_PATH:PATH=" %deps_install_prefix% " ^
186
+ -DCMAKE_INSTALL_PREFIX:PATH=" %rime_install_prefix% "
188
187
189
188
echo on
190
189
call cmake . -B%build_dir% %rime_cmake_flags%
@@ -200,7 +199,7 @@ cmake --build %build_dir% --config %build_config% --target install
200
199
if errorlevel 1 goto error
201
200
202
201
if " %build_test% " == " ON" (
203
- copy /y dist \lib\rime.dll %build_dir% \test
202
+ copy /y %rime_install_prefix% \lib\rime.dll %build_dir% \test
204
203
ctest --test-dir %build_dir% \test -C %build_config% --output-on-failure
205
204
if errorlevel 1 goto error
206
205
)
0 commit comments