|
1 | | -@REM Make sure ProgramFiles(x86) variable is defined |
2 | | -@SET "ProgramFilesBase=%ProgramFiles% (x86)" |
3 | | -@IF NOT EXIST "%ProgramFilesBase%" ( |
4 | | - SET "ProgramFilesBase=%ProgramFiles%" |
| 1 | +@rem Try to detect if running on 64-bit or 32-bit windows |
| 2 | +@rem Choose some sensible defaults |
| 3 | +set ProgramFilesBase=%ProgramFiles(x86)% |
| 4 | +if defined ProgramFiles(x86) ( |
| 5 | + if not defined BUILD_PLATFORM set BUILD_PLATFORM=win-x86_64 |
| 6 | +) else ( |
| 7 | + set ProgramFilesBase=%ProgramFiles% |
| 8 | + if not defined BUILD_PLATFORM set BUILD_PLATFORM=win-x86 |
5 | 9 | ) |
6 | 10 |
|
7 | | -ECHO %ProgramFilesBase% |
| 11 | +@rem Guess build mode |
| 12 | +if not defined BUILDTYPE set BUILDTYPE=Debug |
8 | 13 |
|
9 | | -@REM Set up environment so that we can run Visual Studio. |
10 | | -@REM More-or-less the same effect as running vcvars32.bat |
11 | | -@REM from the Visual Studio source tree. |
12 | | -@REM @call vcvars32 |
13 | | -@set "PATH=%ProgramFilesBase%\Microsoft Visual Studio 10.0\VSTSDB\Deploy;%ProgramFilesBase%\Microsoft Visual Studio 10.0\Common7\IDE\;%ProgramFilesBase%\Microsoft Visual Studio 10.0\VC\BIN;%ProgramFilesBase%\Microsoft Visual Studio 10.0\Common7\Tools;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Windows\Microsoft.NET\Framework\v3.5;%ProgramFilesBase%\Microsoft Visual Studio 10.0\VC\VCPackages;%ProgramFilesBase%\HTML Help Workshop;%ProgramFilesBase%\Microsoft SDKs\Windows\7.0A\bin\NETFX 4.0 Tools;%ProgramFilesBase%\Microsoft SDKs\Windows\7.0A\bin;C:\Perl64\site\bin;C:\Perl64\bin;C:\Perl\site\bin;C:\Perl\bin;C:\windows\system32;C:\windows;C:\windows\system32\wbem" |
| 14 | +@rem Guess build project |
| 15 | +if not defined BUILD_EDITION set BUILD_EDITION=community |
| 16 | +if /I "%BUILD_EDITION%"=="commercial" ( |
| 17 | + set BUILD_PROJECT=livecode-commercial.sln |
| 18 | +) else ( |
| 19 | + set BUILD_PROJECT=livecode\livecode.sln |
| 20 | +) |
14 | 21 |
|
15 | | -@REM Works around hangs when generating .pdb files |
16 | | -@REM Needs to run in the background as never terminates |
17 | | -@REM |
18 | | -@REM Run this with its CWD outside the build tree so that |
19 | | -@REM the fact it hangs around does not interfere with |
20 | | -@REM cleaning up the build tree. |
21 | | -@pushd \ |
22 | | -@REM @start /min mspdbsrv -start -spawn -shutdowntime -1 |
23 | | -@popd |
| 22 | +@rem Guess target architecture based on build platform |
| 23 | +if /I "%BUILD_PLATFORM%"=="win-x86_64" ( |
| 24 | + @set VSCMD_ARG_TGT_ARCH=x64 |
| 25 | + @set MSBUILD_PLATFORM=x64 |
| 26 | +) |
| 27 | +if /I "%BUILD_PLATFORM%"=="win-x86" ( |
| 28 | + @set VSCMD_ARG_TGT_ARCH=x86 |
| 29 | + @set MSBUILD_PLATFORM=Win32 |
| 30 | +) |
24 | 31 |
|
25 | | -@REM Select the correct build mode. |
26 | | -@REM |
27 | | -@IF NOT DEFINED BUILDTYPE SET BUILDTYPE=Debug |
| 32 | +@rem Try to build with VS 2015 build tools by default |
| 33 | +if not defined VSINSTALLDIR set VSINSTALLDIR=%ProgramFilesBase%\Microsoft Visual Studio 14.0\ |
| 34 | +call "%VSINSTALLDIR%VC\vcvarsall.bat" %VSCMD_ARG_TGT_ARCH% |
28 | 35 |
|
29 | | -@REM Select the correct build project file |
30 | | -@REM |
31 | | -IF NOT DEFINED BUILD_EDITION SET BUILD_EDITION=community |
32 | | -IF %BUILD_EDITION%==commercial ( |
33 | | - SET BUILD_PROJECT=livecode-commercial.sln |
34 | | -) ELSE ( |
35 | | - SET BUILD_PROJECT=livecode\livecode.sln |
36 | | -) |
| 36 | +@if "%1" NEQ "" set MSBUILD_TARGET_ARG=/t:%1 |
37 | 37 |
|
38 | | -IF -%1-==-- ( |
39 | | - @msbuild %BUILD_PROJECT% /fl /flp:Verbosity=normal /nologo /p:Configuration=%BUILDTYPE% /m:1 |
40 | | -) ELSE ( |
41 | | - @msbuild %BUILD_PROJECT% /fl /flp:Verbosity=normal /nologo /p:Configuration=%BUILDTYPE% /m:1 /t:%TARGET% |
42 | | -) |
| 38 | +msbuild %BUILD_PROJECT% /fl /flp:Verbosity=normal /nologo /m:1 %BUILD_TARGET_ARG% /p:Configuration=%BUILDTYPE% /p:Platform=%MSBUILD_PLATFORM% |
43 | 39 |
|
44 | 40 | @exit %ERRORLEVEL% |
0 commit comments