forked from rbfx/rbfx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.cmd
73 lines (61 loc) · 1.98 KB
/
Makefile.cmd
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
@echo off
rem This file makes your life easier.
rem Running this file will automatically pick appropriate cmake project generator
rem and they will be forwarded to cmake.
setlocal enabledelayedexpansion
set "CMAKE_ARGS=%*"
IF NOT EXIST cmake-build (
mkdir cmake-build
)
if EXIST cmake-build\environment.cmd (
call cmake-build\environment.cmd
goto process
)
:prepare
if "!PROCESSOR_ARCHITECTURE!" == "AMD64" (
set /P "PLATFORM=Platform (x86/[x64]): " || set "PLATFORM=x64"
) else (
set "PLATFORM=x86"
)
echo set "PLATFORM=!PLATFORM!" > cmake-build\environment.cmd
set /P "VS=Visual Studio (2015/2017/[2019]): " || set "VS=2019"
echo set "VS=!VS!" >> cmake-build\environment.cmd
:process
set "VS_PLATFORM=!PLATFORM!"
if "!VS_PLATFORM!" == "x86" (
set "VS_PLATFORM=Win32"
)
set "CMAKE_GENRATOR=Visual Studio"
if "!VS!" == "2015" (
set "CMAKE_GENRATOR=!CMAKE_GENRATOR! 14"
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" !PLATFORM!
) else if "!VS!" == "2017" (
set "CMAKE_GENRATOR=!CMAKE_GENRATOR! 15"
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" !PLATFORM!
) else if "!VS!" == "2019" (
set "CMAKE_GENRATOR=!CMAKE_GENRATOR! 16"
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" !PLATFORM!
) else (
echo Unknown Visual Studio version
goto quit
)
set "CMAKE_GENRATOR=!CMAKE_GENRATOR! !vs!"
if "!VS!" == "2019" (
set "CMAKE_GENRATOR=!CMAKE_GENRATOR!"
set CMAKE_ARGS=-A !VS_PLATFORM! !CMAKE_ARGS!
) else if "!PLATFORM!" == "x64" (
set "CMAKE_GENRATOR=!CMAKE_GENRATOR! Win64"
) else if NOT "!PLATFORM!" == "x86" (
echo Unknown platform
goto quit
)
echo Using !CMAKE_GENRATOR! on !PLATFORM!
:build
pushd cmake-build
echo cmake.exe -G "!CMAKE_GENRATOR!" !CMAKE_ARGS! ..
cmake.exe -G "!CMAKE_GENRATOR!" !CMAKE_ARGS! ..
echo "Platform: !VS_PLATFORM!"
msbuild Urho3D.sln /p:Platform="!VS_PLATFORM!" /t:restore
popd
:quit
@pause