-
Notifications
You must be signed in to change notification settings - Fork 8
/
run_cmake.bat
87 lines (60 loc) · 1.44 KB
/
run_cmake.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
@echo off
setlocal enabledelayedexpansion
goto Start
:ECHORED
%Windir%\System32\WindowsPowerShell\v1.0\Powershell.exe write-host -foregroundcolor Red %1
goto :eof
:Exit
endlocal
exit /B 1
:ShowError
echo.
call :ECHORED %1
goto :eof
:ShowSyntax
rem Display the help
echo.
echo Usage: run_cmake ^<x86^|x64^> ^<windows^|linux^> [static]
echo.
goto Exit
:ParseArgs
if "%~1" NEQ "" (
set VCPKG_TARGET_TRIPLET=%~1
)
if "%~2" NEQ "" (
set VCPKG_TARGET_TRIPLET=%VCPKG_TARGET_TRIPLET%-%~2
if "%~2" EQU "windows" (
if "%~1" EQU "x64" (
set CMAKE_GENERATOR=%CMAKE_GENERATOR% Win64
)
)
)
if "%~3" NEQ "" (
set VCPKG_TARGET_TRIPLET=%VCPKG_TARGET_TRIPLET%-%~3
)
if "%~3" EQU "static" (
set BUILD_SHARED_LIBS=OFF
) else (
set BUILD_SHARED_LIBS=ON
)
goto :eof
:Start
setlocal
set VCPKG_TARGET_TRIPLET=
set BUILD_SHARED_LIBS=
set CMAKE_GENERATOR=Visual Studio 15 2017
call :ParseArgs %*
echo "%VCPKG_TARGET_TRIPLET%"
echo "%BUILD_SHARED_LIBS%"
echo "%CMAKE_GENERATOR%"
if "" == "%VCPKG_TARGET_TRIPLET%" (
goto ShowSyntax
)
if "" == "%BUILD_SHARED_LIBS%" (
goto ShowSyntax
)
vcpkg install zlib:%VCPKG_TARGET_TRIPLET%
vcpkg install gtest:%VCPKG_TARGET_TRIPLET%
cmake.exe -G "%CMAKE_GENERATOR%" -DCMAKE_TOOLCHAIN_FILE=D:\sourcecode\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=%VCPKG_TARGET_TRIPLET% -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% -DCMAKE_INSTALL_PREFIX=D:\easyzip -DBUILD_TESTS=ON -S %~dp0 -B %~dp0build
endlocal
goto :eof