blob: 0b4f622e07841ce2e663b1e30781720d52645431 [file] [log] [blame]
Zachary Ware6b6e6872017-06-10 14:58:42 -05001@echo off
2setlocal
3set D=%~dp0
4set PCBUILD=%D%..\..\PCBuild\
Steve Dowerf0851912017-07-26 09:09:01 -07005if "%Py_OutDir%"=="" set Py_OutDir=%PCBUILD%
Zachary Ware6b6e6872017-06-10 14:58:42 -05006
7set BUILDX86=
8set BUILDX64=
9set REBUILD=
10set OUTPUT=
11set PACKAGES=
12
13:CheckOpts
14if "%~1" EQU "-h" goto Help
15if "%~1" EQU "-x86" (set BUILDX86=1) && shift && goto CheckOpts
16if "%~1" EQU "-x64" (set BUILDX64=1) && shift && goto CheckOpts
17if "%~1" EQU "-r" (set REBUILD=-r) && shift && goto CheckOpts
18if "%~1" EQU "-o" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts
19if "%~1" EQU "--out" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts
20if "%~1" EQU "-p" (set PACKAGES=%PACKAGES% %~2) && shift && shift && goto CheckOpts
21
22if not defined BUILDX86 if not defined BUILDX64 (set BUILDX86=1) && (set BUILDX64=1)
23
24call "%D%..\msi\get_externals.bat"
Steve Dower40a23e82017-06-19 10:34:25 -070025call "%PCBUILD%find_msbuild.bat" %MSBUILD%
26if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
Zachary Ware6b6e6872017-06-10 14:58:42 -050027
28if defined PACKAGES set PACKAGES="/p:Packages=%PACKAGES%"
29
30if defined BUILDX86 (
31 if defined REBUILD ( call "%PCBUILD%build.bat" -e -r
Steve Dowerf0851912017-07-26 09:09:01 -070032 ) else if not exist "%Py_OutDir%win32\python.exe" call "%PCBUILD%build.bat" -e
Zachary Ware6b6e6872017-06-10 14:58:42 -050033 if errorlevel 1 goto :eof
34
Steve Dower40a23e82017-06-19 10:34:25 -070035 %MSBUILD% "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x86 %OUTPUT% %PACKAGES%
Zachary Ware6b6e6872017-06-10 14:58:42 -050036 if errorlevel 1 goto :eof
37)
38
39if defined BUILDX64 (
40 if defined REBUILD ( call "%PCBUILD%build.bat" -p x64 -e -r
Steve Dowerf0851912017-07-26 09:09:01 -070041 ) else if not exist "%Py_OutDir%amd64\python.exe" call "%PCBUILD%build.bat" -p x64 -e
Zachary Ware6b6e6872017-06-10 14:58:42 -050042 if errorlevel 1 goto :eof
43
Steve Dower40a23e82017-06-19 10:34:25 -070044 %MSBUILD% "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x64 %OUTPUT% %PACKAGES%
Zachary Ware6b6e6872017-06-10 14:58:42 -050045 if errorlevel 1 goto :eof
46)
47
48exit /B 0
49
50:Help
51echo build.bat [-x86] [-x64] [--out DIR] [-r] [-h]
52echo.
53echo -x86 Build x86 installers
54echo -x64 Build x64 installers
55echo -r Rebuild rather than incremental build
56echo --out [DIR] Override output directory
57echo -h Show usage