blob: 10a2a8bc4d553fc144fa8a9ad7d7b216aa4b628d (
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
|
@ECHO OFF
SETLOCAL
SET EXITCODE=0
SET getdepends=true
SET install=false
SET noclean=false
SET addon=
FOR %%b in (%1, %2, %3, %4) DO (
IF %%b == nodepends (
SET getdepends=false
) ELSE ( IF %%b == install (
SET install=true
) ELSE ( IF %%b == noclean (
SET noclean=true
) ELSE ( IF %%b == clean (
SET noclean=false
) ELSE (
SET addon=%%b
))))
)
rem set Visual C++ build environment
call "%VS120COMNTOOLS%..\..\VC\bin\vcvars32.bat"
SET WORKDIR=%WORKSPACE%
IF "%WORKDIR%" == "" (
SET WORKDIR=%CD%\..\..\..
)
rem setup some paths that we need later
SET CUR_PATH=%CD%
SET BASE_PATH=%WORKDIR%\project\cmake
SET ADDONS_PATH=%BASE_PATH%\addons
SET ADDON_DEPENDS_PATH=%ADDONS_PATH%\output
SET ADDONS_BUILD_PATH=%ADDONS_PATH%\build
SET ERRORFILE=%BASE_PATH%\make-addons.error
SET XBMC_INCLUDE_PATH=%ADDON_DEPENDS_PATH%\include\xbmc
SET XBMC_LIB_PATH=%ADDON_DEPENDS_PATH%\lib\xbmc
rem determine whether make-addon-depends.bat should be called with noclean or not
SET addon_depends_mode=clean
IF %noclean% == true (
SET addon_depends_mode=noclean
)
IF %getdepends% == true (
ECHO --------------------------------------------------
ECHO Building addon dependencies
ECHO --------------------------------------------------
CALL make-addon-depends.bat %addon_depends_mode%
IF ERRORLEVEL 1 (
ECHO make-addon-depends error level: %ERRORLEVEL% > %ERRORFILE%
GOTO ERROR
)
ECHO.
)
IF %noclean% == false (
rem remove the build directory if it exists
IF EXIST "%ADDONS_BUILD_PATH%" (
RMDIR "%ADDONS_BUILD_PATH%" /S /Q > NUL
)
)
rem make sure the xbmc include and library paths exist
IF NOT EXIST "%XBMC_INCLUDE_PATH%" (
MKDIR "%XBMC_INCLUDE_PATH%"
)
IF NOT EXIST "%XBMC_LIB_PATH%" (
MKDIR "%XBMC_LIB_PATH%"
)
rem create the build directory
IF NOT EXIST "%ADDONS_BUILD_PATH%" MKDIR "%ADDONS_BUILD_PATH%"
rem go into the build directory
CD "%ADDONS_BUILD_PATH%"
rem determine the proper install path for the built addons
IF %install% == true (
SET ADDONS_INSTALL_PATH=%WORKDIR%\addons
) ELSE (
SET ADDONS_INSTALL_PATH=%WORKDIR%\project\Win32BuildSetup\BUILD_WIN32\Xbmc\xbmc-addons
)
ECHO --------------------------------------------------
ECHO Building addons
ECHO --------------------------------------------------
rem execute cmake to generate makefiles processable by nmake
cmake "%ADDONS_PATH%" -G "NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_USER_MAKE_RULES_OVERRIDE="%BASE_PATH%/xbmc-c-flag-overrides.cmake" ^
-DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX="%BASE_PATH%/xbmc-cxx-flag-overrides.cmake" ^
-DCMAKE_INSTALL_PREFIX=%ADDONS_INSTALL_PATH% ^
-DXBMCROOT=%WORKDIR% ^
-DDEPENDS_PATH=%ADDON_DEPENDS_PATH% ^
-DPACKAGE_ZIP=1 ^
-DARCH_DEFINES="-DTARGET_WINDOWS -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_USE_32BIT_TIME_T -D_WINSOCKAPI_"
IF ERRORLEVEL 1 (
ECHO cmake error level: %ERRORLEVEL% > %ERRORFILE%
GOTO ERROR
)
rem execute nmake to build the addons
nmake %addon%
IF ERRORLEVEL 1 (
ECHO nmake error level: %ERRORLEVEL% > %ERRORFILE%
GOTO ERROR
)
rem everything was fine
GOTO END
:ERROR
rem something went wrong
ECHO Failed to build addons
ECHO See %ERRORFILE% for more details
SET EXITCODE=1
:END
rem go back to the original directory
cd %CUR_PATH%
rem exit the script with the defined exitcode
EXIT /B %EXITCODE%
|