Skip to content

Commit

Permalink
build(build.bat): add x64 option
Browse files Browse the repository at this point in the history
  • Loading branch information
lotem committed Mar 6, 2024
1 parent 102d421 commit 345b11b
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ exit /b 1
echo BOOST_ROOT=%BOOST_ROOT%
echo.

set clean=0
set build_dir_base=build
set build_dir_suffix=
set build_config=Release
set build_deps=0
set build_librime=0
set build_shared=ON
set build_test=OFF
set clean=0
set dist_dir=dist
set enable_logging=ON

:parse_cmdline_options
Expand All @@ -51,6 +52,10 @@ if "%1" == "shared" (
set build_dir_suffix=
set build_shared=ON
)
if "%1" == "x64" (
set build_dir_suffix=%build_dir_suffix%_x64
set dist_dir=dist_x64
)
if "%1" == "test" (
set build_librime=1
set build_test=ON
Expand Down Expand Up @@ -79,18 +84,18 @@ if %build_deps% == 0 (
set build_librime=1
)))

set build_dir=%build_dir_base%%build_dir_suffix%

if %clean% == 1 (
rmdir /s /q build
rmdir /s /q deps\glog\build
rmdir /s /q deps\googletest\build
rmdir /s /q deps\leveldb\build
rmdir /s /q deps\marisa-trie\build
rmdir /s /q deps\opencc\build
rmdir /s /q deps\yaml-cpp\build
rmdir /s /q %build_dir%
rmdir /s /q deps\glog\%build_dir%
rmdir /s /q deps\googletest\%build_dir%
rmdir /s /q deps\leveldb\%build_dir%
rmdir /s /q deps\marisa-trie\%build_dir%
rmdir /s /q deps\opencc\%build_dir%
rmdir /s /q deps\yaml-cpp\%build_dir%
)

set build_dir=%build_dir_base%%build_dir_suffix%

if defined CMAKE_GENERATOR (
set common_cmake_flags=%common_cmake_flags% -G%CMAKE_GENERATOR%
)
Expand Down Expand Up @@ -184,7 +189,7 @@ set rime_cmake_flags=%common_cmake_flags%^
-DBUILD_SHARED_LIBS=%build_shared%^
-DBUILD_TEST=%build_test%^
-DENABLE_LOGGING=%enable_logging%^
-DCMAKE_INSTALL_PREFIX:PATH="%RIME_ROOT%\dist"
-DCMAKE_INSTALL_PREFIX:PATH="%RIME_ROOT%\%dist_dir%"

echo on
call cmake . -B%build_dir% %rime_cmake_flags%
Expand All @@ -200,7 +205,7 @@ cmake --build %build_dir% --config %build_config% --target install
if errorlevel 1 goto error

if "%build_test%" == "ON" (
copy /y dist\lib\rime.dll %build_dir%\test
copy /y %dist_dir%\lib\rime.dll %build_dir%\test
ctest --test-dir %build_dir%\test -C %build_config% --output-on-failure
if errorlevel 1 goto error
)
Expand Down

0 comments on commit 345b11b

Please sign in to comment.