aboutsummaryrefslogtreecommitdiff
path: root/tools/buildsteps/win32/make-xbmc.bat
blob: f6242e96c48ec1f54d1252288410c6790cd98bf9 (plain)
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
169
170
171
172
173
174
175
176
@ECHO OFF
rem ----Usage----
rem BuildSetup [clean|noclean]
rem clean to force a full rebuild
rem noclean to force a build without clean
rem noprompt to avoid all prompts
CLS
COLOR 1B
TITLE XBMC for Windows Build Script
rem ----PURPOSE----
rem - Create a working XBMC build with a single click
rem -------------------------------------------------------------
rem Config
rem If you get an error that Visual studio was not found, SET your path for VSNET main executable.
rem -------------------------------------------------------------
rem	CONFIG START
SET comp=vs2010
SET buildconfig=Release (DirectX)
SET buildmode=ask
SET promptlevel=prompt
SET buildmingwlibs=true
SET exitcode=0
FOR %%b in (%1, %2, %3, %4, %5) DO (
	IF %%b==clean SET buildmode=clean
	IF %%b==noclean SET buildmode=noclean
	IF %%b==noprompt SET promptlevel=noprompt
	IF %%b==nomingwlibs SET buildmingwlibs=false
)

IF $%Configuration%$ == $$ (
  IF %Configuration%==Release SET buildconfig=Release (DirectX)
  IF %Configuration%==Debug   SET buildconfig=Debug (DirectX)
)

SET BS_DIR=%WORKSPACE%\project\Win32BuildSetup
cd %BS_DIR%

IF %comp%==vs2010 (
  IF "%VS100COMNTOOLS%"=="" (
		set NET="%ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\VCExpress.exe"
	) ELSE IF EXIST "%VS100COMNTOOLS%\..\IDE\VCExpress.exe" (
		set NET="%VS100COMNTOOLS%\..\IDE\VCExpress.exe"
	) ELSE IF EXIST "%VS100COMNTOOLS%\..\IDE\devenv.exe" (
		set NET="%VS100COMNTOOLS%\..\IDE\devenv.exe"
	)
)

IF NOT EXIST %NET% (
 set DIETEXT=Visual Studio .NET 2010 Express was not found.
 goto DIE
)

set OPTS_EXE="..\VS2010Express\XBMC for Windows.sln" /build "%buildconfig%"
set CLEAN_EXE="..\VS2010Express\XBMC for Windows.sln" /clean "%buildconfig%"
set EXE= "..\VS2010Express\XBMC\%buildconfig%\XBMC.exe"
set PDB= "..\VS2010Express\XBMC\%buildconfig%\XBMC.pdb"

rem	CONFIG END
rem -------------------------------------------------------------

echo                         :                                                  
echo                        :::                                                 
echo                        ::::                                                
echo                        ::::                                                
echo    :::::::       :::::::::::::::::        ::::::      ::::::        :::::::
echo    :::::::::   ::::::::::::::::::::     ::::::::::  ::::::::::    :::::::::
echo     ::::::::: ::::::::::::::::::::::   ::::::::::::::::::::::::  ::::::::: 
echo          :::::::::     :::      ::::: :::::    ::::::::    :::: :::::      
echo           ::::::      ::::       :::: ::::      :::::       :::::::        
echo           :::::       ::::        :::::::       :::::       ::::::         
echo           :::::       :::         ::::::         :::        ::::::         
echo           ::::        :::         ::::::        ::::        ::::::         
echo           ::::        :::        :::::::        ::::        ::::::         
echo          :::::        ::::       :::::::        ::::        ::::::         
echo         :::::::       ::::      ::::::::        :::         :::::::        
echo     :::::::::::::::    :::::  ::::: :::         :::         :::::::::      
echo  :::::::::  :::::::::  :::::::::::  :::         :::         ::: :::::::::  
echo  ::::::::    :::::::::  :::::::::   :::         :::         :::  ::::::::  
echo ::::::         :::::::    :::::     :            ::          ::    ::::::   
echo Building %buildconfig%
goto EXE_COMPILE

:EXE_COMPILE
  IF EXIST buildlog.html del buildlog.html /q
  IF %buildmode%==clean goto COMPILE_EXE
  IF %buildmode%==noclean goto COMPILE_NO_CLEAN_EXE
  rem ---------------------------------------------
  rem	check for existing exe
  rem ---------------------------------------------
  
  IF EXIST %EXE% (
    goto EXE_EXIST
  )
  goto COMPILE_EXE

:EXE_EXIST
  IF %promptlevel%==noprompt goto COMPILE_EXE
  ECHO ------------------------------------------------------------
  ECHO Found a previous Compiled WIN32 EXE!
  ECHO [1] a NEW EXE will be compiled for the BUILD_WIN32
  ECHO [2] existing EXE will be updated (quick mode compile) for the BUILD_WIN32
  ECHO ------------------------------------------------------------
  set /P XBMC_COMPILE_ANSWER=Compile a new EXE? [1/2]:
  if /I %XBMC_COMPILE_ANSWER% EQU 1 goto COMPILE_EXE
  if /I %XBMC_COMPILE_ANSWER% EQU 2 goto COMPILE_NO_CLEAN_EXE
  
:COMPILE_EXE
  ECHO Wait while preparing the build.
  ECHO ------------------------------------------------------------
  ECHO Cleaning Solution...
  %NET% %CLEAN_EXE%
  ECHO Compiling XBMC...
  %NET% %OPTS_EXE%
  IF NOT EXIST %EXE% (
  	set DIETEXT="XBMC.EXE failed to build!  See %WORKSPACE%\project\vs2010express\XBMC\%buildconfig%\objs\XBMC.log"
	IF %promptlevel%==noprompt (
		type "%WORKSPACE%\project\vs2010express\XBMC\%buildconfig%\objs\XBMC.log"
	)
  	goto DIE
  )
  ECHO Done!
  ECHO ------------------------------------------------------------
  set buildmode=clean
  GOTO MAKE_BUILD_EXE
  
:COMPILE_NO_CLEAN_EXE
  ECHO Wait while preparing the build.
  ECHO ------------------------------------------------------------
  ECHO Compiling Solution...
  %NET% %OPTS_EXE%
  IF NOT EXIST %EXE% (
  	set DIETEXT="XBMC.EXE failed to build!  See %WORKSPACE%\project\vs2010express\XBMC\%buildconfig%\objs\XBMC.log"
	IF %promptlevel%==noprompt (
		type "%WORKSPACE%\project\vs2010express\XBMC\%buildconfig%\objs\XBMC.log"
	)
  	goto DIE
  )
  ECHO Done!
  ECHO ------------------------------------------------------------
  GOTO END
  
  
:DIE
  ECHO ------------------------------------------------------------
  ECHO !-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-
  ECHO    ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR
  ECHO !-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-
  set DIETEXT=ERROR: %DIETEXT%
  echo %DIETEXT%
  SET exitcode=1
  ECHO ------------------------------------------------------------

:VIEWLOG_EXE
  SET log="%WORKSPACE%\project\vs2010express\XBMC\%buildconfig%\objs\XBMC.log"
  IF NOT EXIST %log% goto END
  
  copy %log% ./buildlog.html > NUL

  IF %promptlevel%==noprompt (
  goto END
  )

  set /P XBMC_BUILD_ANSWER=View the build log in your HTML browser? [y/n]
  if /I %XBMC_BUILD_ANSWER% NEQ y goto END
  
  SET log="%WORKSPACE%\project\vs2010express\XBMC\%buildconfig%\objs\" XBMC.log
  
  start /D%log%
  goto END

:END
  IF %promptlevel% NEQ noprompt (
  ECHO Press any key to exit...
  pause > NUL
  )
  EXIT /B %exitcode%