Skip to content

Commit

Permalink
build: update build.bat on building rime
Browse files Browse the repository at this point in the history
  • Loading branch information
fxliang committed May 23, 2024
1 parent 3cc096e commit 2a59deb
Showing 1 changed file with 17 additions and 35 deletions.
52 changes: 17 additions & 35 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -301,33 +301,18 @@ rem ---------------------------------------------------------------------------

rem ---------------------------------------------------------------------------
rem %1 : ARCH
rem %2 : push | pop , push to backup when pop to restore
:stash_build
pushd %WEASEL_ROOT%\librime
for %%a in ( build dist lib ^
deps\glog\build ^
deps\googletest\build ^
deps\leveldb\build ^
deps\marisa-trie\build ^
deps\opencc\build ^
deps\yaml-cpp\build ) do (
if "%2"=="push" (
if exist %%a move %%a %%a_%1
)
if "%2"=="pop" (
if exist %%a_%1 move %%a_%1 %%a
)
)
popd
exit /b

rem ---------------------------------------------------------------------------
rem %1 : ARCH
rem %2 : target_path of rime.lib, base %WEASEL_ROOT% or abs path
rem %3 : target_path of rime.dll, base %WEASEL_ROOT% or abs path
rem %2 : target_path of rime.lib, abs path
rem %3 : target_path of rime.dll, abs path
:build_librime_platform
rem restore backuped %1 build
call :stash_build %1 pop
if "%rime_build_variant%"=="release" (
set build_dir=build_%1
set rime_install_prefix=%WEASEL_ROOT%\librime\dist_%1
) else (
set build_dir=debug_%1
set rime_install_prefix=%WEASEL_ROOT%\librime\distd_%1
)
rem restore backuped lib_%1 build
if exist lib_%1 move lib_%1 lib

cd %WEASEL_ROOT%\librime
if not exist env.bat (
Expand All @@ -336,24 +321,21 @@ rem %3 : target_path of rime.dll, base %WEASEL_ROOT% or abs path
if not exist lib\opencc.lib (
call build.bat deps %rime_build_variant%
if errorlevel 1 (
call :stash_build %1 push
if exist lib move lib lib_%1
goto error
)
)
call build.bat %rime_build_variant%
if errorlevel 1 (
call :stash_build %1 push
goto error
)

cd %WEASEL_ROOT%\librime
call :stash_build %1 push
rem backup lib to lib_%1
if exist lib move lib lib_%1

copy /Y %WEASEL_ROOT%\librime\dist_%1\include\rime_*.h %WEASEL_ROOT%\include\
copy /Y %rime_install_prefix%\include\rime_*.h %WEASEL_ROOT%\include\
if errorlevel 1 goto error
copy /Y %WEASEL_ROOT%\librime\dist_%1\lib\rime.lib %2\
copy /Y %rime_install_prefix%\lib\rime.lib %2\
if errorlevel 1 goto error
copy /Y %WEASEL_ROOT%\librime\dist_%1\lib\rime.dll %3\
copy /Y %rime_install_prefix%\lib\rime.dll %3\
if errorlevel 1 goto error

exit /b
Expand Down

0 comments on commit 2a59deb

Please sign in to comment.