blob: 25fab66409caeb7b1d548056262b77456f874a73 (
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
177
178
179
180
181
182
183
184
185
186
187
188
|
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
REM ==================================
REM Path setup and initial checks
REM ==================================
IF "%ProgramW6432%" =="" (
SET PROGRAMFILES_PATH=%ProgramFiles%
) else (
REM doublequote the whole SET command prevents an error with parentheses
SET "PROGRAMFILES_PATH=%ProgramFiles(x86)%"
)
rem ====== Edit to suit your environment =========
SET VCVERSION=141
SET PARAM_VCVARSVER=14.1
SET "BUILDTOOLS_PATH=%PROGRAMFILES_PATH%\Microsoft Visual Studio\2017\BuildTools\VC"
SET BUILDTOOLS_SCRIPT=Auxiliary\Build\vcvarsall.bat
IF EXIST "%BUILDTOOLS_PATH%" (
echo Building with preconfigured path at: "%BUILDTOOLS_PATH%"
) ELSE (
call :function_get_product
IF ERRORLEVEL 1 (
echo.
echo Could not find "%BUILDTOOLS_PATH%" and the detection of product didn't work
echo Edit the %~nx0 file and/or install the required software
echo http://landinghub.visualstudio.com/visual-cpp-build-tools
echo https://www.microsoft.com/en-us/download/details.aspx?id=8279
exit /b 1
)
REM END NO PRODUCT
)
REM END EXIST BUILDTOOLS_PATH
REM Check whether we have a 64-bit compiler available.
call :function_has_64bit
IF ERRORLEVEL 1 (
echo Using 32-bit compiler.
SET COMPILER_X86=x86
SET COMPILER_X64=x86_amd64
) ELSE (
echo Using 64-bit compiler.
SET COMPILER_X86=amd64_x86
SET COMPILER_X64=amd64
)
REM ==================================
REM Parameter reading and variable setup
REM ==================================
REM ^ is the escape character.
if "%3" == "" (
echo Missing parameters. Usage: ^(Note: keep same case and order^)
echo.
echo build_mixxx.bat x64^|x86 debug^|release^|release-fastbuild ^<winlib-path^> [skiptest] [skipinstaller]
echo.
echo skiptest means that we don't want to build and execute the mixxx-test.
echo skipinstaller means that we don't want to generate the installer after the build.
echo.
echo Example: build_mixxx.bat x64 release c:\mixxx\environments\2.3-j00013-x64-release-static-36f44bd2-minimal
exit /b 1
)
set MACHINE_X86="%1" == "x86"
if "%2" == "release" (
set CONFIG_RELEASE=1==1
set PARAM_OPTIMIZE=portable
)
if "%2" == "release-fastbuild" (
set CONFIG_RELEASE=1==1
set PARAM_OPTIMIZE=fastbuild
)
if "%2" == "debug" (
set CONFIG_RELEASE=0==1
set PARAM_OPTIMIZE=portable
)
if "%4" == "skiptest" (
set PARAM_TEST=0
) else (
set PARAM_TEST=1
)
if "%4" == "skipinstaller" (
set PARAM_INSTALLER=
) else (
if "%5" == "skipinstaller" (
set PARAM_INSTALLER=
) else (
set PARAM_INSTALLER=makerelease
)
)
set WINLIB_DIR=%3
SET BIN_DIR=%WINLIB_DIR%\bin
SET LIB_DIR=%WINLIB_DIR%\lib
SET INCLUDE_DIR=%WINLIB_DIR%\include
FOR /D %%G IN (%WINLIB_DIR%\Qt-*) DO SET QTDIR=%%G
IF "!QTDIR!" EQU "" (
echo QT not found on %WINLIB_DIR%
exit /b 1
)
if NOT EXIST "%BIN_DIR%\scons.py" (
echo.
echo You need to obtain and copy SCons to the folder:
echo %BIN_DIR%
exit /b 1
)
if NOT EXIST "%QTDIR%" (
echo.
echo Could not find Qt %QT_VERSION% at "%QT_DIR%".
exit /b 1
)
REM Everything prepared. Setup the compiler.
if %MACHINE_X86% (
call "%BUILDTOOLS_PATH%\%BUILDTOOLS_SCRIPT%" %COMPILER_X86% -vcvars_ver=%PARAM_VCVARSVER%
set MACHINE_TYPE=x86
) else (
call "%BUILDTOOLS_PATH%\%BUILDTOOLS_SCRIPT%" %COMPILER_X64% -vcvars_ver=%PARAM_VCVARSVER%
set MACHINE_TYPE=x86_64
)
if %CONFIG_RELEASE% (
set BUILD_TYPE=release
) else (
set BUILD_TYPE=debug
)
rem /MP Use all CPU cores.
rem /FS force synchronous PDB writes (prevents PDB corruption with /MP)
rem /EHsc Do not handle SEH in try / except blocks.
set CXXFLAGS=/MP /FS /EHsc
set CFLAGS=/MP /FS /EHsc
REM Now build Mixxx.
set PATH=%BIN_DIR%;%PATH%
scons.py %SCONS_NUMBER_PROCESSORS% mixxx %PARAM_INSTALLER% toolchain=msvs winlib=%WINLIB_DIR% build=%BUILD_TYPE% staticlibs=1 staticqt=1 debug_assertions_fatal=1 verbose=0 machine=%MACHINE_TYPE% qtdir=%QTDIR% hss1394=1 mediafoundation=1 opus=1 localecompare=1 optimize=%PARAM_OPTIMIZE% virtualize=0 test=%PARAM_TEST% qt_sqlite_plugin=0 build_number_in_title_bar=0 bundle_pdbs=0
IF ERRORLEVEL 1 (
echo ==============================
echo.
echo Building Mixxx failed.
echo.
REM For debugging, print the configuration log.
REM echo Printing config.log:
REM type config.log
ENDLOCAL
exit /b 1
) else (
echo Mixxx built successfully
ENDLOCAL
)
EXIT /b 0
:function_get_product
FOR %%Y IN (2019,2017) DO (
FOR %%P IN (Community,Professional,Enterprise) DO (
SET "LOCAL_VS_PATH=%PROGRAMFILES_PATH%\Microsoft Visual Studio\%%Y\%%P\VC"
IF EXIST "!LOCAL_VS_PATH!" (
SET "BUILDTOOLS_PATH=!LOCAL_VS_PATH!"
ECHO Using Visual Studio %%Y %%P at: !LOCAL_VS_PATH!
EXIT /B 0
)
)
REM FOR
SET "LOCAL_BT_PATH=%PROGRAMFILES_PATH%\Microsoft Visual Studio\%%Y\BuildTools\VC"
IF EXIST "!LOCAL_BT_PATH!" (
SET "BUILDTOOLS_PATH=!LOCAL_BT_PATH!"
ECHO Using BuildTools %%Y at: !LOCAL_BT_PATH!
EXIT /B 0
)
REM BT
)
REM FOR
EXIT /B 1
:function_has_64bit
FOR /F %%G IN ('dir "%BUILDTOOLS_PATH%\Tools\MSVC\%PARAM_VCVARSVER%*" /b /ad-h /o-n') DO (
set "LOCAL_64_CL=%BUILDTOOLS_PATH%\Tools\MSVC\%%G\bin\Hostx64\x64\cl.exe"
if EXIST "!LOCAL_64_CL!" (
EXIT /B 0
)
)
EXIT /B 1
|