forked from mangos/MaNGOS
-
Notifications
You must be signed in to change notification settings - Fork 77
/
project_setup.bat
executable file
·168 lines (145 loc) · 5.34 KB
/
project_setup.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
@ECHO off
COLOR 0B
REM *****************************************************************************************
REM Set your compiler and another features here. Possible VC1, VC11
REM currently possible VC10 (MS Visual studio 10 Pro) and VC11 (MS Visual studio 11 or 2012 Pro/Ultimate)
REM Warning! VS Express edition not supported! Also need check path (below) to VC10/11 binary
SET vs=Visual studio 11
REM Install path for MaNGOS (in this be created ./bin and ./etc folders)
SET INSTALL_PATH="C:\\MaNGOS"
REM Platform for build. Possible Win32, Win64. Warning! Win64 build possible only on 64-bit main OS!
SET BUILD_PLATFORM=Win32
REM Count of cores on PC, where project compiled. for speedup only
SET CORE_NUMBER=2
REM Used mangos memory manager. Possible managers - STD, TBB (not recommended), FASTMM (default)
SET MEMORY_MANAGER=FASTMM
SET vs_path=%ProgramFiles(x86)%
IF "%vs_path%"=="" (
SET "vs_path=%ProgramFiles%"
)
SET vs_path=%vs_path:\=/%
:menu
REM *****************************************************************************************
if "%vs%"=="Visual studio 11" (
SET COMPILER="Visual Studio 11"
if %BUILD_PLATFORM%==x64 (SET COMPILER="Visual Studio 11 Win64")
SET COMPILER_PATH="%vs_path%/Microsoft Visual Studio 11.0/VC/bin/cl.exe"
SET LINKER_PATH="%vs_path%/Microsoft Visual Studio 11.0/VC/bin/link.exe"
SET VC_VARS="%vs_path%\\Microsoft Visual Studio 11.0\\VC\\"
)
if "%vs%"=="Visual studio 10" (
SET COMPILER="Visual Studio 10"
if %BUILD_PLATFORM%==x64 (SET COMPILER="Visual Studio 10 Win64")
SET COMPILER_PATH="%vs_path%/Microsoft Visual Studio 10.0/VC/bin/cl.exe"
SET LINKER_PATH="%vs_path%/Microsoft Visual Studio 10.0/VC/bin/link.exe"
SET VC_VARS="%vs_path%\\Microsoft Visual Studio 10.0\\VC\\"
)
SET RESULT_CONF=Release
SET MEMMAN_STR1="0"
SET MEMMAN_STR3="0"
SET MEMMAN_STR2="0"
if %MEMORY_MANAGER%==STD (SET MEMMAN_STR2="1")
if %MEMORY_MANAGER%==TBB (SET MEMMAN_STR3="1")
if %MEMORY_MANAGER%==FASTMM (SET MEMMAN_STR1="1")
SET C_FLAGS="/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR"
SET CMakeConfiguration=-G %COMPILER% -DPCH=1 -DCMAKE_CXX_COMPILER=%COMPILER_PATH% -DCMAKE_CXX_FLAGS=%C_FLAGS% -DCMAKE_C_FLAGS=%C_FLAGS% -DCMAKE_CXX_COMPILER=%COMPILER_PATH% -DCMAKE_INSTALL_PREFIX=%INSTALL_PATH% -DUSE_FASTMM_MALLOC=%MEMMAN_STR1% -DUSE_STD_MALLOC=%MEMMAN_STR2% -DUSE_TBB_MALLOC=%MEMMAN_STR3% ..
SET MSBuildConfiguration=INSTALL.vcxproj /m:%CORE_NUMBER% /p:Configuration=%RESULT_CONF%;Platform=%BUILD_PLATFORM%
REM *****************************************************************************************
cls
echo ##########################
echo # Welcome to R2 compiler #
echo ##########################
echo.
REM *****************************************************************************************
echo +++++++++++++++++++++ Current CMake configuration +++++++++++++++++++++
echo cmake %CMakeConfiguration%
echo.
echo +++++++++++++++++++++ Current compiler configuration +++++++++++++++++++++
echo MSBuild %MSBuildConfiguration%
REM *****************************************************************************************
echo.
echo.
echo 0 - Exit R2 compiler
echo.
echo 1 - Change compiler [%vs%]
echo 2 - Change build platform [%BUILD_PLATFORM%]
echo 3 - Change install path [%INSTALL_PATH%]
echo 4 - Change CPU core(s) number [%CORE_NUMBER%]
echo.
echo 5 - Change VS Path [%vs_path%]
echo.
echo 8 - Create Project
echo 9 - Start compile
echo.
set /P menu=Select a number:
if "%menu%"=="0" goto end
if "%menu%"=="1" goto compiler
if "%menu%"=="2" goto platform
if "%menu%"=="3" goto path
if "%menu%"=="4" goto core
if "%menu%"=="5" goto win_part
if "%menu%"=="8" goto cmake
if "%menu%"=="9" goto build
if "%menu%"=="%menu%" echo. & echo Wrong number! & pause & goto menu
:compiler
cls
echo 1 - Visual studio 10
echo 2 - Visual studio 11
set /P menu=Select a number:
if "%menu%"=="1" SET vs=Visual studio 10& goto menu
if "%menu%"=="2" SET vs=Visual studio 11& goto menu
if "%menu%"=="%menu%" echo. & echo Wrong number! & pause & goto compiler
:path
cls
set /P install_drive=Enter the partition drive letter first:
set /P install_path=Enter the folder name:
set INSTALL_PATH="%install_drive%:\\%install_path%"
goto menu
:platform
cls
echo 1 - Win32
echo 2 - x64
set /P menu=Select a number:
if "%menu%"=="1" SET BUILD_PLATFORM=Win32& goto menu
if "%menu%"=="2" SET BUILD_PLATFORM=x64& goto menu
if "%menu%"=="%menu%" echo. & echo Wrong number! & pause & goto platform
:core
cls
set /P CORE_NUMBER=Enter your CPU core number:
goto menu
:win_part
cls
set /P vs_path=Enter the VS path:
goto menu
:cmake
REM *****************************************************************************************
if not exist build (
mkdir build
)
if not exist %INSTALL_PATH% (
mkdir %INSTALL_PATH%
if not exist %INSTALL_PATH% (
echo Please, make output directory %INSTALL_PATH%
pause
goto :menu
)
)
cd build
cmake %CMakeConfiguration%
cd ..
pause
goto :menu
REM *****************************************************************************************
:build
call %VC_VARS%vcvarsall.bat
cd build
MSBuild %MSBuildConfiguration%
cd ..
pause
goto :menu
REM *****************************************************************************************
:help
echo "Set up parameters in this bat file!"
goto :menu
REM *****************************************************************************************
:end