-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.bat
65 lines (53 loc) · 1.32 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
@echo off
setlocal ENABLEDELAYEDEXPANSION
:: handle argv
set count=0
for %%x in (%*) do (
set /a count+=1
)
if %count% LSS 2 (
echo "[ERROR] build.bat without build type"
echo "[ERROR] Usage: build.bat <Debug|Release> <shared|static>"
exit /b
)
set BUILD_TYPE=%~1
set LIB_TYPE=%~2
set "CMAKE_SHARED_LIBS=ON"
if "%LIB_TYPE%"=="shared" (
set "CMAKE_SHARED_LIBS=ON"
) else (
set "CMAKE_SHARED_LIBS=OFF"
)
echo build type: %BUILD_TYPE%
echo lib type: %LIB_TYPE%
echo CMAKE_SHARED_LIBS: %CMAKE_SHARED_LIBS%
set origin_dir=%~dp0
set build_dir=%origin_dir%build
set install_dir=%origin_dir%dist
set dep_search_path=f:\\.local\\usr
if exist %build_dir% (
echo remove build dir
rd /s /q %build_dir%
)
echo make build dir
md %build_dir%
if exist %install_dir% (
echo remove install dir
rd /s /q %install_dir%
)
cd %build_dir%
cmake ^
-S %origin_dir% -B %build_dir% ^
-DCMAKE_PREFIX_PATH=%dep_search_path% ^
-DBUILD_SHARED_LIBS=%CMAKE_SHARED_LIBS% ^
-DMUGGLE_BUILD_STATIC_PIC=ON ^
-DMUGGLE_BUILD_TRACE=OFF ^
-DMUGGLE_BUILD_SANITIZER=OFF ^
-DBUILD_TESTING=OFF ^
-DMUGGLE_BUILD_EXAMPLE=OFF ^
-DMUGGLE_BUILD_BENCHMARK=OFF ^
-DMUGGLE_INSTALL_BIN=OFF ^
-DCMAKE_INSTALL_PREFIX=%install_dir%
:: cmake --build . --config Release --target INSTALL
cmake --build . --config Release
cmake --build . --config Release --target install