@echo off

@rem The -t here is just to avoid infinite looping if %PYTHON_EXECUTABLE% isn't set
@rem for some reason.

%PYTHON_EXECUTABLE% -t %LLVM_SRC_ROOT%\test\Scripts\macho-dump %1 %2 %3 %4 %5 %6 %7 %8 %9

Make macho-dump.bat actually work.

tests: Make macho-dump.bat actually work.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@105891 91177308-0d34-0410-b5e6-96231b3b80d8


python C:\\Users\\micro\\Downloads\\gyp-master\\gyp_main.py binding.gyp -f msvs -G msvs_version=auto --depth=. --generator-output ./build

python C:\\github\\gyp\\gyp_main.py config.gyp -f msvs -G msvs_version=auto --depth=. --generator-output ./build

Update build script

Update build script


@echo off
setlocal EnableDelayedExpansion
set R2_BASE=""
set frida_version=15.1.3
if "%PLATFORM%" == "x64" (set frida_os_arch=x86_64) else (set frida_os_arch=x86)
for /f %%i in ('radare2 -H R2_USER_PLUGINS') do set R2_PLUGDIR=%%i
REM for /f %%i in ('where radare2') do set R2_BASE=%%i\..
set R2_BASE=%cd%\radare2
set DEBUG=/O2
set INSTALL=

for /f %%i in ('radare2 -qv') do set R2V=%%i

if not exist %R2_BASE% (
	echo radare2 not found
	set /p R2_BASE="Please enter full path of radare2 installation: "
	set /p R2_PLUGDIR="Please enter full path of radare2 plugin dir (radare2 -H): "
)

echo Using R2_BASE: %R2_BASE%
set R2_INC=/I"%R2_BASE%\include" /I"%R2_BASE%\include\libr" /I"%R2_BASE%\include\libr\sdb"

for %%i in (%*) do (
	if "%%i"=="debug" (set DEBUG=/Z7)
	if "%%i"=="install" (set INSTALL=1)
)

copy config.h.w64 config.h
call npm install
cd src
cat .\_agent.js | xxd -i > .\_agent.h || (echo "xxd not in path?" & exit /b 1)
REM radare2 -nfqcpc _agent.js | grep 0x > _agent.h || (echo "radare2.exe must be in path & exit /b 1)

mkdir frida > nul 2>&1
cd frida

set FRIDA_SDK_URL="https://github.com/frida/frida/releases/download/!frida_version!/frida-core-devkit-!frida_version!-windows-!frida_os_arch!.exe"

if not exist ".\frida-core-sdk-!frida_version!-!frida_os_arch!.exe" (
	echo Downloading Frida Core Sdk

	powershell -command "(New-Object System.Net.WebClient).DownloadFile($env:FRIDA_SDK_URL, ""frida-core-sdk.exe-!frida_version!-!frida_os_arch!"")" ^
	|| wget -q --show-progress %FRIDA_SDK_URL% .\frida-core-sdk.exe -O .\frida-core-sdk-!frida_version!-!frida_os_arch!.exe || python -m wget %FRIDA_SDK_URL% -o frida-core-sdk-!frida_version!-!frida_os_arch!.exe

	echo Extracting...
	.\frida-core-sdk-!frida_version!-!frida_os_arch!.exe || (echo Failed to extract & exit /b 1)
)
cd ..

echo Compiling...
echo cl %DEBUG% /MT /nologo /LD /Gy /D_USRDLL /D_WINDLL /DFRIDA_VERSION_STRING="!frida_version!" io_frida.c %R2_INC% /I"%cd%" /I"%cd%\frida" "%cd%\frida\frida-core.lib" "%R2_BASE%\lib\*.lib"
cl %DEBUG% /MT /nologo /LD /Gy /D_USRDLL /D_WINDLL /DFRIDA_VERSION_STRING="""!frida_version!""" io_frida.c %R2_INC% /I"%cd%" /I"%cd%\frida" "%cd%\frida\frida-core.lib" "%R2_BASE%\lib\*.lib" || (echo Compilation Failed & exit /b 1)

del ..\r2frida-%R2V%-w64.zip
zip ..\r2frida-%R2V%-w64.zip io_frida.dll
if not "%INSTALL%"=="" (
	echo Installing...
	mkdir "%R2_PLUGDIR%" > nul 2>&1
	echo Copying 'io_frida.dll' to %R2_PLUGDIR%
	copy io_frida.dll "%R2_PLUGDIR%\io_frida.dll"
	if not "%DEBUG%"=="/O2" (
		echo Copying 'io_frida.pdb' to %R2_PLUGDIR%
		cp io_frida.pdb "%R2_PLUGDIR%\io_frida.pdb"
	)
)

@echo off
setlocal EnableDelayedExpansion
set R2_BASE=""
set frida_version=15.1.4
if "%PLATFORM%" == "x64" (set frida_os_arch=x86_64) else (set frida_os_arch=x86)
for /f %%i in ('radare2 -H R2_USER_PLUGINS') do set R2_PLUGDIR=%%i
REM for /f %%i in ('where radare2') do set R2_BASE=%%i\..
set R2_BASE=%cd%\radare2
set DEBUG=/O2
set INSTALL=

for /f %%i in ('radare2 -qv') do set R2V=%%i

if not exist %R2_BASE% (
	echo radare2 not found
	set /p R2_BASE="Please enter full path of radare2 installation: "
	set /p R2_PLUGDIR="Please enter full path of radare2 plugin dir (radare2 -H): "
)

echo Using R2_BASE: %R2_BASE%
set R2_INC=/I"%R2_BASE%\include" /I"%R2_BASE%\include\libr" /I"%R2_BASE%\include\libr\sdb"

for %%i in (%*) do (
	if "%%i"=="debug" (set DEBUG=/Z7)
	if "%%i"=="install" (set INSTALL=1)
)

copy config.h.w64 config.h
call npm install
cd src
cat .\_agent.js | xxd -i > .\_agent.h || (echo "xxd not in path?" & exit /b 1)
REM radare2 -nfqcpc _agent.js | grep 0x > _agent.h || (echo "radare2.exe must be in path & exit /b 1)

mkdir frida > nul 2>&1
cd frida

set FRIDA_SDK_URL="https://github.com/frida/frida/releases/download/!frida_version!/frida-core-devkit-!frida_version!-windows-!frida_os_arch!.exe"

if not exist ".\frida-core-sdk-!frida_version!-!frida_os_arch!.exe" (
	echo Downloading Frida Core Sdk

	powershell -command "(New-Object System.Net.WebClient).DownloadFile($env:FRIDA_SDK_URL, ""frida-core-sdk.exe-!frida_version!-!frida_os_arch!"")" ^
	|| wget -q --show-progress %FRIDA_SDK_URL% .\frida-core-sdk.exe -O .\frida-core-sdk-!frida_version!-!frida_os_arch!.exe || python -m wget %FRIDA_SDK_URL% -o frida-core-sdk-!frida_version!-!frida_os_arch!.exe

	echo Extracting...
	.\frida-core-sdk-!frida_version!-!frida_os_arch!.exe || (echo Failed to extract & exit /b 1)
)
cd ..

echo Compiling...
echo cl %DEBUG% /MT /nologo /LD /Gy /D_USRDLL /D_WINDLL /DFRIDA_VERSION_STRING="!frida_version!" io_frida.c %R2_INC% /I"%cd%" /I"%cd%\frida" "%cd%\frida\frida-core.lib" "%R2_BASE%\lib\*.lib"
cl %DEBUG% /MT /nologo /LD /Gy /D_USRDLL /D_WINDLL /DFRIDA_VERSION_STRING="""!frida_version!""" io_frida.c %R2_INC% /I"%cd%" /I"%cd%\frida" "%cd%\frida\frida-core.lib" "%R2_BASE%\lib\*.lib" || (echo Compilation Failed & exit /b 1)

del ..\r2frida-%R2V%-w64.zip
zip ..\r2frida-%R2V%-w64.zip io_frida.dll
if not "%INSTALL%"=="" (
	echo Installing...
	mkdir "%R2_PLUGDIR%" > nul 2>&1
	echo Copying 'io_frida.dll' to %R2_PLUGDIR%
	copy io_frida.dll "%R2_PLUGDIR%\io_frida.dll"
	if not "%DEBUG%"=="/O2" (
		echo Copying 'io_frida.pdb' to %R2_PLUGDIR%
		cp io_frida.pdb "%R2_PLUGDIR%\io_frida.pdb"
	)
)

Bump Frida 15.1.4

Bump Frida 15.1.4


@echo off
setlocal EnableDelayedExpansion

set ScriptRoot=%~dp0
set VisualStudioInstallation=%ProgramFiles(x86)%\Microsoft Visual Studio\2017

echo Searching for Visual Studio in: "%VisualStudioInstallation%"

if defined DevEnvDir (
    echo Visual Studio 2017 development environment has already been set.
) else (
    echo Setting Visual Studio 2017 environment...

    for /F %%G in ('dir /b "%VisualStudioInstallation%"') do (

        set VisualStudioCommonTools=!VisualStudioInstallation!\%%G\Common7\Tools\VsDevCmd.bat

        if exist "!VisualStudioCommonTools!" (
            call "!VisualStudioCommonTools!"

            goto :RunBuild
        ) else (
            echo ERROR: Could not locate "!VisualStudioCommonTools!".  Trying next installation...
        )
    )
)

:RunBuild

if not defined DevEnvDir (
    echo Visual Studio 2017 environment should have been set.
    exit /b 1
)

msbuild %ScriptRoot%\Build\EasyNetQ.proj

pause

@echo off
setlocal EnableDelayedExpansion

set ScriptRoot=%~dp0
set VisualStudioInstallation=%ProgramFiles(x86)%\Microsoft Visual Studio\2019

echo Searching for Visual Studio in: "%VisualStudioInstallation%"

if defined DevEnvDir (
    echo Visual Studio 2019 development environment has already been set.
) else (
    echo Setting Visual Studio 2019 environment...

    for /F %%G in ('dir /b "%VisualStudioInstallation%"') do (

        set VisualStudioCommonTools=!VisualStudioInstallation!\%%G\Common7\Tools\VsDevCmd.bat

        if exist "!VisualStudioCommonTools!" (
            call "!VisualStudioCommonTools!"

            goto :RunBuild
        ) else (
            echo ERROR: Could not locate "!VisualStudioCommonTools!".  Trying next installation...
        )
    )
)

:RunBuild

if not defined DevEnvDir (
    echo Visual Studio 2019 environment should have been set.
    exit /b
)

msbuild %ScriptRoot%\Build\EasyNetQ.proj

pause

update build.bat to use visual studio 2019


@echo Off
set config=%1
if "%config%" == "" (
   set config=Release
)

set version=
if not "%BuildCounter%" == "" (
   set version=--version-suffix ci-%BuildCounter%
)

REM Restore
call dotnet restore
if not "%errorlevel%"=="0" goto failure

REM Build
REM - Option 1: Run dotnet build for every source folder in the project
REM   e.g. call dotnet build <path> --configuration %config%
REM - Option 2: Let msbuild handle things and build the solution
call "%msbuild%" Marvin.Cache.Headers.sln /p:Configuration="%config%" /m /v:M /fl /flp:LogFile=msbuild.log;Verbosity=Normal /nr:false
REM call dotnet build --configuration %config%
if not "%errorlevel%"=="0" goto failure

REM Unit tests
call dotnet test test\Marvin.Cache.Headers.Test --configuration %config%
if not "%errorlevel%"=="0" goto failure

REM Package
mkdir %cd%\artifacts
call dotnet pack src\Marvin.Cache.Headers --configuration %config% %version% --output artifacts
if not "%errorlevel%"=="0" goto failure

:success
exit 0

:failure
exit -1

@echo Off
set config=%1
if "%config%" == "" (
   set config=Release
)

set version=
if not "%BuildCounter%" == "" (
   set version=--version-suffix ci-%BuildCounter%
)

REM Restore
call dotnet restore
if not "%errorlevel%"=="0" goto failure

REM Build
REM - Option 1: Run dotnet build for every source folder in the project
REM   e.g. call dotnet build <path> --configuration %config%
REM - Option 2: Let msbuild handle things and build the solution
call "%msbuild%" Marvin.Cache.Headers.sln /p:Configuration="%config%" /m /v:M /fl /flp:LogFile=msbuild.log;Verbosity=Normal /nr:false
REM call dotnet build --configuration %config%
if not "%errorlevel%"=="0" goto failure

REM Unit tests
rem call dotnet test test\Marvin.Cache.Headers.Test --configuration %config%
rem if not "%errorlevel%"=="0" goto failure

REM Package
mkdir %cd%\artifacts
call dotnet pack src\Marvin.Cache.Headers --configuration %config% %version% --output artifacts
if not "%errorlevel%"=="0" goto failure

:success
exit 0

:failure
exit -1

Build script

Build script


@echo off
cd %~dp0

SETLOCAL
SET NUGET_VERSION=latest
SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe
SET BUILDCMD_KOREBUILD_VERSION=""
SET BUILDCMD_DNX_VERSION=""

IF EXIST %CACHED_NUGET% goto copynuget
echo Downloading latest version of NuGet.exe...
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'"

:copynuget
IF EXIST .nuget\nuget.exe goto restore
md .nuget
copy %CACHED_NUGET% .nuget\nuget.exe > nul

:restore
IF EXIST packages\Sake goto getdnx
IF %BUILDCMD_KOREBUILD_VERSION%=="" (
    .nuget\nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
) ELSE (
    .nuget\nuget.exe install KoreBuild -version %BUILDCMD_KOREBUILD_VERSION% -ExcludeVersion -o packages -nocache -pre
)
.nuget\NuGet.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages

:getdnx
IF "%SKIP_DNX_INSTALL%"=="" (
    IF "%BUILDCMD_DNX_VERSION%"=="" (
        BUILDCMD_DNX_VERSION=latest
    )
    CALL packages\KoreBuild\build\dnvm install %BUILDCMD_DNX_VERSION% -runtime CoreCLR -arch x86 -alias default
    CALL packages\KoreBuild\build\dnvm install default -runtime CLR -arch x86 -alias default
) ELSE (
    CALL packages\KoreBuild\build\dnvm use default -runtime CLR -arch x86
)

packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %*

@echo off
cd %~dp0

SETLOCAL
SET NUGET_VERSION=latest
SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe
SET BUILDCMD_KOREBUILD_VERSION=
SET BUILDCMD_DNX_VERSION=

IF EXIST %CACHED_NUGET% goto copynuget
echo Downloading latest version of NuGet.exe...
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'"

:copynuget
IF EXIST .nuget\nuget.exe goto restore
md .nuget
copy %CACHED_NUGET% .nuget\nuget.exe > nul

:restore
IF EXIST packages\Sake goto getdnx
IF "%BUILDCMD_KOREBUILD_VERSION%"=="" (
    .nuget\nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
) ELSE (
    .nuget\nuget.exe install KoreBuild -version %BUILDCMD_KOREBUILD_VERSION% -ExcludeVersion -o packages -nocache -pre
)
.nuget\NuGet.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages

:getdnx
IF "%BUILDCMD_DNX_VERSION%"=="" (
    SET BUILDCMD_DNX_VERSION=latest
)
IF "%SKIP_DNX_INSTALL%"=="" (
    CALL packages\KoreBuild\build\dnvm install %BUILDCMD_DNX_VERSION% -runtime CoreCLR -arch x86 -alias default
    CALL packages\KoreBuild\build\dnvm install default -runtime CLR -arch x86 -alias default
) ELSE (
    CALL packages\KoreBuild\build\dnvm use default -runtime CLR -arch x86
)

packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %*

Fix local build break

Fix local build break


@echo off
cls

.paket\paket.bootstrapper.exe
if errorlevel 1 (
  exit /b %errorlevel%
)

.paket\paket.exe restore
if errorlevel 1 (
  exit /b %errorlevel%
)

packages\build\FAKE\tools\FAKE.exe build.fsx %*

Fix build.cmd encoding to UT8 (was UTF8-BOM) - it was messing up console output on Windows


set GOARCH=386
go build -ldflags "-s -w -H=windowsgui" -o breathless_parks.exe

Add Windows build script

Add Windows build script


@echo off
set "picklesVersion=1.0.0"

cls

cd ".\src\Pickles\packages\NuGet.CommandLine.*\tools\"

".\NuGet.exe" "Install" "FAKE" "-OutputDirectory" "..\..\..\..\..\packages" "-ExcludeVersion"

cd ..\..\..\..\..

"packages\FAKE\tools\Fake.exe" build.fsx --envvar version %picklesVersion%
"packages\FAKE\tools\Fake.exe" nuget.fsx --envvar version %picklesVersion%
"packages\FAKE\tools\Fake.exe" chocolatey.fsx --envvar version %picklesVersion%

call unzip.cmd %picklesVersion%

FOR %%A IN (testRunnerCmd testRunnerMsBuild testRunnerPowerShell) DO (
call %%A.cmd %picklesVersion%
if errorlevel 1 goto handleerror1orhigher
)

@ECHO all fine
goto end

:handleerror1orhigher

@ECHO Something went wrong!
goto end

:end

@echo off
set "picklesVersion=1.0.1"

cls

cd ".\src\Pickles\packages\NuGet.CommandLine.*\tools\"

".\NuGet.exe" "Install" "FAKE" "-OutputDirectory" "..\..\..\..\..\packages" "-ExcludeVersion"

cd ..\..\..\..\..

"packages\FAKE\tools\Fake.exe" build.fsx --envvar version %picklesVersion%
"packages\FAKE\tools\Fake.exe" nuget.fsx --envvar version %picklesVersion%
"packages\FAKE\tools\Fake.exe" chocolatey.fsx --envvar version %picklesVersion%

call unzip.cmd %picklesVersion%

FOR %%A IN (testRunnerCmd testRunnerMsBuild testRunnerPowerShell) DO (
call %%A.cmd %picklesVersion%
if errorlevel 1 goto handleerror1orhigher
)

@ECHO all fine
goto end

:handleerror1orhigher

@ECHO Something went wrong!
goto end

:end

Update version to 1.0.1

Update version to 1.0.1


REM @echo Off
set config=%1
if "%config%" == "" (
   set config=NugetBuild
)

set version=1.0.0
if not "%PackageVersion%" == "" (
   set version=%PackageVersion%
)

set nuget=
if "%nuget%" == "" (
	set nuget=nuget
)

powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe','nuget.exe')"

copy nuget.exe Sigma.Core/
copy nuget.exe Sigma.Core.Monitors.WPF/

nuget.exe restore Sigma.sln

"%programfiles(x86)%\MSBuild\14.0\Bin\MsBuild.exe" Sigma.sln /p:Configuration="%config%" /p:Platform=x64

REM pack Sigma.Core

cd Sigma.Core
nuget.exe pack "Sigma.Core.csproj" -IncludeReferencedProjects -Prop Platform=x64 -Verbosity detailed -Prop Configuration=%config% -Version %version%

cd ..

REM pack Sigma.Core.Monitors.WPF

cd Sigma.Core.Monitors.WPF

REM update the targets file

cd build
powershell -Command "(gc Sigma.Core.Monitors.WPF.targets) -replace '~version~', '%version%' | Out-File Sigma.Core.Monitors.WPF.targets"

cd ..
nuget.exe pack "Sigma.Core.Monitors.WPF.csproj" -IncludeReferencedProjects -Prop Platform=x64 -Verbosity detailed -Prop Configuration=%config% -Version %version%

REM @echo Off
set config=%1
if "%config%" == "" (
   set config=NugetBuild
)

set version=1.0.0
if not "%PackageVersion%" == "" (
   set version=%PackageVersion%
)

set nuget=
if "%nuget%" == "" (
	set nuget=nuget
)

powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe','nuget.exe')"

copy nuget.exe Sigma.Core
copy nuget.exe Sigma.Core.Monitors.WPF

nuget.exe restore Sigma.sln

"%programfiles(x86)%\MSBuild\14.0\Bin\MsBuild.exe" Sigma.sln /p:Configuration="%config%" /p:Platform=x64

REM pack Sigma.Core

cd Sigma.Core
nuget.exe pack "Sigma.Core.csproj" -IncludeReferencedProjects -Prop Platform=x64 -Verbosity detailed -Prop Configuration=%config% -Version %version%

cd ..

REM pack Sigma.Core.Monitors.WPF

cd Sigma.Core.Monitors.WPF

REM update the targets file

cd build
powershell -Command "(gc Sigma.Core.Monitors.WPF.targets) -replace '~version~', '%version%' | Out-File Sigma.Core.Monitors.WPF.targets"

cd ..
nuget.exe pack "Sigma.Core.Monitors.WPF.csproj" -IncludeReferencedProjects -Prop Platform=x64 -Verbosity detailed -Prop Configuration=%config% -Version %version%

Fix copy command again

Fix copy command again


@echo off
cd %~dp0

SETLOCAL
SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe

IF EXIST %CACHED_NUGET% goto copynuget
echo Downloading latest version of NuGet.exe...
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '%CACHED_NUGET%'"

:copynuget
IF EXIST .nuget\nuget.exe goto restore
md .nuget
copy %CACHED_NUGET% .nuget\nuget.exe > nul

:restore
IF EXIST packages\KoreBuild goto run
.nuget\NuGet.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
.nuget\NuGet.exe install Sake -version 0.2 -o packages -ExcludeVersion

IF "%SKIP_KRE_INSTALL%"=="1" goto run
CALL packages\KoreBuild\build\dotnetsdk upgrade -runtime CLR -x86
CALL packages\KoreBuild\build\dotnetsdk install default -runtime CoreCLR -x86

:run
CALL packages\KoreBuild\build\dotnetsdk use default -runtime CLR -x86
packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %*

@echo off
cd %~dp0

SETLOCAL
SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe

IF EXIST %CACHED_NUGET% goto copynuget
echo Downloading latest version of NuGet.exe...
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '%CACHED_NUGET%'"

:copynuget
IF EXIST .nuget\nuget.exe goto restore
md .nuget
copy %CACHED_NUGET% .nuget\nuget.exe > nul

:restore
IF EXIST packages\KoreBuild goto run
.nuget\NuGet.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
.nuget\NuGet.exe install Sake -version 0.2 -o packages -ExcludeVersion

IF "%SKIP_DOTNET_INSTALL%"=="1" goto run
CALL packages\KoreBuild\build\dotnetsdk upgrade -runtime CLR -x86
CALL packages\KoreBuild\build\dotnetsdk install default -runtime CoreCLR -x86

:run
CALL packages\KoreBuild\build\dotnetsdk use default -runtime CLR -x86
packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %*

Rename SKIP_KRE_INSTALL to SKIP_DOTNET_INSTALL


Fix local build break

Fix local build break


@echo off

PUSHD %~dp0
REM cls

IF exist packages\FAKE ( echo skipping FAKE download ) ELSE (
echo downloading FAKE
REM dir
"bin\nuget.exe" "install" "FAKE" "-Version" "3.35.2" "-OutputDirectory" "Packages" "-ExcludeVersion"
REM "bin\nuget.exe" "install" "FSharp.Formatting.CommandTool" "-OutputDirectory" "Packages" "-ExcludeVersion"
REM "bin\nuget.exe" "install" "SourceLink.Fake" "-OutputDirectory" "Packages" "-ExcludeVersion"
REM "bin\nuget.exe" "install" "NUnit.Runners" "-OutputDirectory" "Packages" "-ExcludeVersion"
"bin\nuget.exe" "install" "Paket.Core" "-OutputDirectory" "packages" "-ExcludeVersion"
"bin\nuget.exe" "install" "Paket.Core" "-OutputDirectory" "packages" "-ExcludeVersion"
)

bin\wget.exe -q --no-check-certificate https://github.com/vrvis/Aardvark.Fake/raw/master/bin/Aardvark.Fake.dll -O bin/Aardvark.Fake.dll

SET TARGET=Default
IF NOT [%1]==[] (set TARGET=%1)

>tmp ECHO(%*
SET /P t=<tmp
SETLOCAL EnableDelayedExpansion
IF DEFINED t SET "t=!t:%1 =!"
SET args=!t!
del tmp

"packages\FAKE\tools\Fake.exe" "build.fsx" "target=%TARGET%" %args%

@echo off

PUSHD %~dp0
REM cls

IF exist packages\FAKE ( echo skipping FAKE download ) ELSE (
echo downloading FAKE
REM dir
"bin\nuget.exe" "install" "FAKE" "-Version" "3.35.2" "-OutputDirectory" "Packages" "-ExcludeVersion"
REM "bin\nuget.exe" "install" "FSharp.Formatting.CommandTool" "-OutputDirectory" "Packages" "-ExcludeVersion"
REM "bin\nuget.exe" "install" "SourceLink.Fake" "-OutputDirectory" "Packages" "-ExcludeVersion"
REM "bin\nuget.exe" "install" "NUnit.Runners" "-OutputDirectory" "Packages" "-ExcludeVersion"
"bin\nuget.exe" "install" "Paket.Core" "-Version" "1.18.5" "-OutputDirectory" "packages" "-ExcludeVersion"
"bin\nuget.exe" "install" "Paket.Core" "-Version" "1.18.5" "-OutputDirectory" "packages" "-ExcludeVersion"
)

bin\wget.exe -q --no-check-certificate https://github.com/vrvis/Aardvark.Fake/raw/master/bin/Aardvark.Fake.dll -O bin/Aardvark.Fake.dll

SET TARGET=Default
IF NOT [%1]==[] (set TARGET=%1)

>tmp ECHO(%*
SET /P t=<tmp
SETLOCAL EnableDelayedExpansion
IF DEFINED t SET "t=!t:%1 =!"
SET args=!t!
del tmp

"packages\FAKE\tools\Fake.exe" "build.fsx" "target=%TARGET%" %args%

build script: CI fix

build script: CI fix


copy  /Y     cvsignore    %USERPROFILE%\.cvsignore
copy  /Y     gitconfig    %USERPROFILE%\.gitconfig
copy  /Y     vimrc        %USERPROFILE%\.vimrc
copy  /Y     zshrc        %USERPROFILE%\.zshrc
rmdir /S/Q                %USERPROFILE%\vimfiles
xcopy /Y/S/I vim          %USERPROFILE%\vimfiles

copy  /Y     cvsignore    %USERPROFILE%\.cvsignore
copy  /Y     emacs        %USERPROFILE%\.emacs
copy  /Y     gitconfig    %USERPROFILE%\.gitconfig
copy  /Y     vimrc        %USERPROFILE%\.vimrc
copy  /Y     zshrc        %USERPROFILE%\.zshrc
rmdir /S/Q                %USERPROFILE%\vimfiles
xcopy /Y/S/I vim          %USERPROFILE%\vimfiles

install emacs config too

install emacs config too


@set PATH=%PATH%;%ProgramFiles%\NSIS

@call vc9.bat
@IF ERRORLEVEL 1 goto NO_VC9

@rem @pushd .

@rem check if makensis exists
@makensis /version >nul
@IF ERRORLEVEL 1 goto NSIS_NEEDED

python buildandupload.py -noupload
@IF ERRORLEVEL 1 goto BUILD_FAILED

@goto END

:NO_VC9
echo vc9.bat failed
@goto END

:INSTALLER_FAILED
echo Installer script failed
@goto END

:BUILD_FAILED
echo Build failed!
@goto END

:NSIS_NEEDED
echo NSIS doesn't seem to be installed. Get it from http://nsis.sourceforge.net/Download
@goto END

:END
@popd

add build-no-upload.bat script

add build-no-upload.bat script


echo OFF

set UPLOAD_TARGETS=python-parse python-pkgtk

if "%ANACONDA_USERNAME%" == "" (
  set /p ANACONDA_USERNAME="Username: "
) else (
  echo Username: %ANACONDA_USERNAME%;
)

if "%ANACONDA_PASSWORD%" == "" (
  set /p ANACONDA_USERNAME=%ANACONDA_USERNAME%%"'s password: "
) else (
  echo %ANACONDA_USERNAME%'s password: [secure];
)

set ANACONDA_UPLOAD_FLAGS=-c conda-forge %ANACONDA_UPLOAD_FLAGS%
if "%ANACONDA_CHANNEL%" == "" (
    set ANACONDA_CHANNEL=statiskit
) else (
    echo Using anaconda channel: %ANACONDA_CHANNEL%
    set ANACONDA_UPLOAD_FLAGS=-c statiskit "%ANACONDA_UPLOAD_FLAGS%
)

echo ON

conda install -n root anaconda-client
if %errorlevel% neq 0 (
  exit /b %errorlevel%
)

echo OFF

echo y|anaconda login --username %ANACONDA_USERNAME% --password %ANACONDA_PASSWORD%
if %errorlevel% neq 0 (
  exit /b %errorlevel%
)

echo ON

git clone https://gist.github.com/c491cb08d570beeba2c417826a50a9c3.git toolchain
if %errorlevel% neq 0 (
  anaconda logout
  exit /b %errorlevel%
)
cd toolchain
call config.bat
if %errorlevel% neq 0 (
  cd ..
  anaconda logout
  rmdir toolchain /s /q
  exit /b %errorlevel%
)
cd ..
rmdir toolchain /s /q

for %%x in (%UPLOAD_TARGETS%) do (
  echo | set /p "for /f %%i in ('conda build " > _upload.bat
  more _upload.bat
  <nul set /p %%x >> _upload.bat
  more _upload.bat
  <nul set /p " -c " >> _upload.bat
  more _upload.bat
  <nul set /p %ANACONDA_CHANNEL% >> _upload.bat
  more _upload.bat
  <nul set /p " " >> _upload.bat
  more _upload.bat
  <nul set /p %ANACONDA_FLAGS% >> _upload.bat
  echo --output >> _upload.bat
  more _upload.bat
  echo anaconda upload --user %ANACONDA_CHANNEL% %UPLOAD_FILE% >> _upload.bat
  more _upload.bat
  echo if \%errorlevel\% neq 0 echo upload failed >> _upload.bat
  more _upload.bat
  del _upload.bat
)

anaconda logout

echo OFF

set UPLOAD_TARGETS=python-parse python-pkgtk

if "%ANACONDA_USERNAME%" == "" (
  set /p ANACONDA_USERNAME="Username: "
) else (
  echo Username: %ANACONDA_USERNAME%;
)

if "%ANACONDA_PASSWORD%" == "" (
  set /p ANACONDA_USERNAME=%ANACONDA_USERNAME%%"'s password: "
) else (
  echo %ANACONDA_USERNAME%'s password: [secure];
)

set ANACONDA_UPLOAD_FLAGS=-c conda-forge %ANACONDA_UPLOAD_FLAGS%
if "%ANACONDA_CHANNEL%" == "" (
    set ANACONDA_CHANNEL=statiskit
) else (
    echo Using anaconda channel: %ANACONDA_CHANNEL%
    set ANACONDA_UPLOAD_FLAGS=-c statiskit "%ANACONDA_UPLOAD_FLAGS%
)

echo ON

conda install -n root anaconda-client
if %errorlevel% neq 0 (
  exit /b %errorlevel%
)

echo OFF

echo y|anaconda login --username %ANACONDA_USERNAME% --password %ANACONDA_PASSWORD%
if %errorlevel% neq 0 (
  exit /b %errorlevel%
)

echo ON

git clone https://gist.github.com/c491cb08d570beeba2c417826a50a9c3.git toolchain
if %errorlevel% neq 0 (
  anaconda logout
  exit /b %errorlevel%
)
cd toolchain
call config.bat
if %errorlevel% neq 0 (
  cd ..
  anaconda logout
  rmdir toolchain /s /q
  exit /b %errorlevel%
)
cd ..
rmdir toolchain /s /q

for %%x in (%UPLOAD_TARGETS%) do (
  echo | set /p "for /f %%i in ('conda build " >> _upload.bat
  more _upload.bat
  <nul set /p %%x >> _upload.bat
  more _upload.bat
  <nul set /p " -c " >> _upload.bat
  more _upload.bat
  <nul set /p %ANACONDA_CHANNEL% >> _upload.bat
  more _upload.bat
  <nul set /p " " >> _upload.bat
  more _upload.bat
  <nul set /p %ANACONDA_FLAGS% >> _upload.bat
  echo --output >> _upload.bat
  more _upload.bat
  echo anaconda upload --user %ANACONDA_CHANNEL% %UPLOAD_FILE% >> _upload.bat
  more _upload.bat
  echo if \%errorlevel\% neq 0 echo upload failed >> _upload.bat
  more _upload.bat
  del _upload.bat
)

anaconda logout

Update upload.bat

Update upload.bat


REM As you may have noticed, I implemented the DS library and the Falcon QML
REM widgets as submodules. I still cannot say if that was a good idea...
REM
REM Run this script often to ensure that we use the lastest versions of the
REM registered submodules.
git submodule foreach git pull origin master

:: As you may have noticed, I implemented the DS library and the Falcon QML
:: widgets as submodules. I still cannot say if that was a good idea...
::
:: Run this script often to ensure that we use the lastest versions of the
:: registered submodules.
::
git submodule foreach git pull origin master

Update sync.bat

Update sync.bat


mkdir build
cd build

cmake ^
    -G "NMake Makefiles" ^
    -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=True ^
    -DBUILD_TESTING=ON ^
    %SRC_DIR%
if errorlevel 1 exit 1

:: Build.
cmake --build . --config Release
if errorlevel 1 exit 1

:: Install.
cmake --build . --config Release --target install
if errorlevel 1 exit 1

:: Test
ctest --output-on-failure -C Release
if errorlevel 1 exit 1

Create bld.bat

Create bld.bat


doxygen tnl_dd.doxy
doxygen vbo.doxy
doxygen math.doxy
doxygen swrast.doxy
doxygen swrast_setup.doxy
doxygen tnl.doxy
doxygen core.doxy
doxygen glapi.doxy

echo Building again, to resolve tags
doxygen tnl_dd.doxy
doxygen vbo.doxy
doxygen math.doxy
doxygen swrast.doxy
doxygen swrast_setup.doxy
doxygen tnl.doxy
doxygen glapi.doxy

doxygen tnl_dd.doxy
doxygen vbo.doxy
doxygen math.doxy
doxygen swrast.doxy
doxygen swrast_setup.doxy
doxygen tnl.doxy
doxygen core.doxy
doxygen glapi.doxy
doxygen glsl.doxy
doxygen nir.doxy
doxygen i965.doxy

echo Building again, to resolve tags
doxygen tnl_dd.doxy
doxygen vbo.doxy
doxygen math.doxy
doxygen swrast.doxy
doxygen swrast_setup.doxy
doxygen tnl.doxy
doxygen core.doxy
doxygen glapi.doxy
doxygen glsl.doxy
doxygen nir.doxy
doxygen i965.doxy

Add missing modules to Windows runner

doxygen: Add missing modules to Windows runner

Acked-by: Rhys Kidd <0b3b315d08353e2046d43a86d41e3fd1dff3d6ad@gmail.com>


@echo off
REM --------------------------------------------------------------
REM Set PATH, INCLUDE, and LIB environment variables so
REM that CMAKE can be invoked and Condor can be built from
REM the command line.
REM
REM Note that the existing PATH is not preserved, although the new
REM path will still have Windows, PERL, and CMAKE in it.
REM
REM if USER_TOOLS_DIR and/or USER_TOOLS_DIR2 are set, they will be
REM added to the path, USER_TOOLS_DIR will be a the beginning
REM and USER_TOOLS_DIR2 will be at the end of the path.
REM
REM This batch file will setup the following environment variables
REM if they do not already exist.
REM  CMAKE_BIN_DIR - short path to cmake\bin
REM  WIX_BIN_DIR   - short path to Wix\bin
REM  ZIP_BIN_DIR   - short path to 7-Zip
REM  PERL_BIN_DIR  - short path to Perl (c:\Perl\bin)
REM  GIT_BIN_DIR   - short path to git\bin
REM  VS_DIR        - the short path to the Visual Studio 2008 directory tree
REM  VC_DIR        - the short path to %VS_DIR%\VC (used to set include and lib)
REM  VC_BIN        - the short path to %VS_DIR%\VC\bin (where the compiler is)
REM  SDK_DIR       - the short path to the Windows SDK (v7.0)
REM  DOTNET_DIRS   - paths to .NET 3.5 and 2.0
REM
REM  PATH, LIB, and INCLUDE are then constructed from these
REM
REM Requirements:
REM
REM   before executing this batch script, CMAKE.EXE must
REM   be in the PATH, or CMAKE_BIN_DIR must be set to its location
REM   or CMAKE must be installed in c:\tools\cmake
REM
REM   MSCONFIG_TOOLS_DIR must be set to the condor sources msconfig dir
REM   or this batch file must be run from that directory
REM
REM   the location of the MS C compiler is derived from the
REM   VS90COMNTOOLS environment variable. (which is set in all
REM   user's environments by the default compiler install.)
REM
REM

:: check to see if MSCONFIG_TOOLS_DIR is set, if it is not set assume that it
:: is where this file is. also strip off an trailing \ from the path.
::
if "~%MSCONFIG_TOOLS_DIR%"=="~" set MSCONFIG_TOOLS_DIR=%~sdp0
if "~%MSCONFIG_TOOLS_DIR:~-1%"=="~\" Set MSCONFIG_TOOLS_DIR=%MSCONFIG_TOOLS_DIR:~0,-1%
if not exist %MSCONFIG_TOOLS_DIR%\license.rtf (
   echo MSCONFIG_TOOLS_DIR is not valid!
)

:: set CMAKE_BIN_DIR if it is not already set, look first in the path then
:: in the registry and finally both of those fail just set it to C:\tools\cmake
::
if "~%CMAKE_BIN_DIR%"=="~" for %%I in (cmake.exe) DO Set CMAKE_BIN_DIR=%%~sdp$PATH:I
if "~%CMAKE_BIN_DIR%"=="~" (
   @echo Searching for CMake.exe...
   for /F "tokens=1,2*" %%I in ('reg query "HKLM\SOFTWARE" /k /f "CMake*" /ve /s') do (
      if "%%I"=="(Default)" (
         if "%%J"=="REG_SZ" (
            set CMAKE_BIN_DIR=%%K\bin
            @echo found CMake in the registry at %%K
         )
      )
   )
)
if "~%CMAKE_BIN_DIR%"=="~" set CMAKE_BIN_DIR=c:\Tools\CMake\bin

:: we don't want CMAKE_BIN_DIR to have a trailing slash.
::
if "~%CMAKE_BIN_DIR:~-1%"=="~\" Set CMAKE_BIN_DIR=%CMAKE_BIN_DIR:~0,-1%
echo CMAKE_BIN_DIR=%CMAKE_BIN_DIR%
if not exist %CMAKE_BIN_DIR%\cmake.exe (
  echo can't find CMake.exe, please set CMAKE_BIN_DIR to the path to it.
)

:: find ActivePerl bin dir
::
:: set PERL_BIN_DIR=%SystemDrive%\Perl\bin
if "~%PERL_BIN_DIR%"=="~" for %%I in (perl.exe) DO Set PERL_BIN_DIR=%%~sdp$PATH:I
if "~%PERL_BIN_DIR%"=="~" (
   @echo Searching for Perl.exe...
   for /F "tokens=1,2*" %%I in ('reg query "HKLM\Software" /f "Perl.exe"') do (
      if "%%I"=="BinDir" (
         set PERL_BIN_DIR=%%~sfK
      )
   )
)
if "~%PERL_BIN_DIR:~-1%"=="~\" Set PERL_BIN_DIR=%PERL_BIN_DIR:~0,-1%
echo PERL_BIN_DIR=%PERL_BIN_DIR%
if not exist %PERL_BIN_DIR%\perl.exe echo could not find ActiveState Perl.exe, this is needed to build Condor

:: WiX should be in the path or WIX_BIN_DIR must be set
::
if "~%WIX_BIN_DIR%"=="~" for %%I in (wix.dll) DO Set WIX_BIN_DIR=%%~sdp$PATH:I
if "~%WIX_BIN_DIR%"=="~" set WIX_BIN_DIR=c:\Tools\WiX\bin
if "~%WIX_BIN_DIR:~-1%"=="~\" Set WIX_BIN_DIR=%WIX_BIN_DIR:~0,-1%
echo WIX_BIN_DIR=%WIX_BIN_DIR%
if not exist %WIX_BIN_DIR%\wix.dll echo could not find WiX binaries which are needed to create the Installer

:: need the 7zip path also
::
if "~%ZIP_BIN_DIR%"=="~" for %%I in (7z.exe) do set ZIP_BIN_DIR=%%~sdp$PATH:I
if "~%ZIP_BIN_DIR%"=="~" set ZIP_BIN_DIR=c:\Tools\7-zip
if "~%ZIP_BIN_DIR:~-1%"=="~\" Set ZIP_BIN_DIR=%ZIP_BIN_DIR:~0,-1%
echo ZIP_BIN_DIR=%ZIP_BIN_DIR%
if not exist %ZIP_BIN_DIR%\7z.exe echo could not find 7z.exe, this is needed to PACKAGE condor

:: setup GIT_BIN_DIR if we can find git. this isn't needed to build condor
:: but it is needed to do condor development.
::
if "~%GIT_BIN_DIR%"=="~" for %%I in (git.exe) Do Set GIT_BIN_DIR=%%~sdp$PATH:I
if "~%GIT_BIN_DIR%"=="~" set GIT_BIN_DIR=c:\Tools\Git\bin
if "~%GIT_BIN_DIR:~-1%"=="~\" Set GIT_BIN_DIR=%GIT_BIN_DIR:~0,-1%
echo GIT_BIN_DIR=%GIT_BIN_DIR%
if not exist %GIT_BIN_DIR%\git.exe echo could not find Git.exe, (but it is not needed to build condor)

:: set USER_TOOLS_DIR if it isn't already set.  we point it at c:\tools if
:: that directory exists.
::
if "~%USER_TOOLS_DIR%"=="~" (
REM if exist c:\Tools\NUL set USER_TOOLS_DIR=C:\Tools
)
echo USER_TOOLS_DIR=%USER_TOOLS_DIR%

REM 64-bit environments have a slightly different directory layout here
REM we take this in to account so that we can prefix paths later with the
REM the correct program files path. (Note, this assumes a clean install.
REM I'll harden it further if there is a requirement for it.)
set PROGRAMS_DIR=%ProgramFiles%
if not "~%ProgramFiles(x86)%"=="~" set PROGRAMS_DIR=%SystemDrive%\PROGRA~2

:: If Visual Studio 2008 is installed, then VS90COMNTOOLS should be defined
:: we can use that to setup the compiler environment. if it's not set
:: then all we can do is choose default values for environment variables.
::
if "~%VS90COMNTOOLS%"=="~" goto use_default_paths

:: derive from VS90COMNTOOLS
::
for /D %%I in ("%VS90COMNTOOLS%..") do set VS90ROOT=%%~sdpI
set VS_DIR=%VS90ROOT:~0,-1%
set VC_DIR=%VS_DIR%\VC
set VC_BIN=%VC_DIR%\bin
set DBG_TOOLS_DIR=%ProgramFiles%\Debugging Tools for Windows (x86);%ProgramFiles%\Debugging Tools for Windows (x64)
set DOTNET_DIRS=%SystemRoot%\Microsoft.NET\Framework\v3.5;%SystemRoot%\Microsoft.NET\Framework\v2.0.50727

:: find the latest windows SDK dir
::
::set SDK_DIR=%SystemDrive%\PROGRA~1\MICROS~3\Windows\v7.0
if "~%SDK_DIR%"=="~" (
   for /F "tokens=1,2*" %%I in ('reg query "HKLM\Software\Microsoft\Microsoft SDKs\Windows" /v "CurrentInstallFolder"') do (
      if "%%I"=="CurrentInstallFolder" (
         set SDK_DIR=%%~sfK
      )
   )
)
if "~%SDK_DIR:~-1%"=="~\" Set SDK_DIR=%SDK_DIR:~0,-1%

goto got_paths

:: don't have VS90COMNTOOLS defined, so we will have to assume default
:: installation paths for compiler
::
:use_default_paths
:: Set default paths for Visual C++, the Platform SDKs, and Perl
set VS_DIR=%PROGRAMS_DIR%\Microsoft Visual Studio 9.0
set VC_DIR=%VS_DIR%\VC
set VC_BIN=%VC_DIR%\bin
set PERL_BIN_DIR=%SystemDrive%\Perl\bin
set SDK_DIR=%ProgramFiles%\Microsoft SDKs\Windows\v7.0
set DBG_TOOLS_DIR=%ProgramFiles%\Debugging Tools for Windows (x86);%ProgramFiles%\Debugging Tools for Windows (x64)
set DOTNET_DIRS=%SystemRoot%\Microsoft.NET\Framework\v3.5;%SystemRoot%\Microsoft.NET\Framework\v2.0.50727

:got_paths

REM Setup the path to point to Windows, the C compiler, msconfig for stuff
REM like awk, gunzip, tar, bison, yacc...
REM
set PATH=%SystemRoot%;%SystemRoot%\system32;%CMAKE_BIN_DIR%;%MSCONFIG_TOOLS_DIR%
set PATH=%PATH%;%VS_DIR%\Common7\IDE;%VC_DIR%;%VC_BIN%
if NOT "~%SDK_DIR%"=="~" set PATH=%PATH%;%SDK_DIR%\bin
if NOT "~%PERL_BIN_DIR%"=="~" set PATH=%PATH%;%PERL_BIN_DIR%
if NOT "~%DOTNET_DIRS%"=="~" set PATH=%PATH%;%DOTNET_DIRS%
REM if NOT "~%DBG_TOOLS_DIR%"=="~" set PATH=%PATH%;%DBG_TOOLS_DIR%
if NOT "~%WIX_BIN_DIR%"=="~" set PATH=%PATH%;%WIX_BIN_DIR%
if NOT "~%GIT_BIN_DIR%"=="~" set PATH=%PATH%;%GIT_BIN_DIR%
if NOT "~%ZIP_BIN_DIR%"=="~" set PATH=%PATH%;%ZIP_BIN_DIR%
if NOT "~%USER_TOOLS_DIR%"=="~" set PATH=%USER_TOOLS_DIR%;%PATH%
if NOT "~%USER_TOOLS_DIR2%"=="~" set PATH=%PATH%;%USER_TOOLS_DIR2%

REM setup include path
REM
set INCLUDE=%VC_DIR%\include
set INCLUDE=%INCLUDE%;%VC_DIR%\atlmfc\include
if NOT "~%SDK_DIR%"=="~" set INCLUDE=%INCLUDE%;%SDK_DIR%\include
if NOT "~%DOTNET_DIRS%"=="~" set INCLUDE=%INCLUDE%;%DOTNET_DIRS%

REM setup lib path
REM
set LIB=%VC_DIR%\lib
set LIB=%LIB%;%VC_DIR%\atlmfc\lib
if NOT "~%SDK_DIR%"=="~" set LIB=%LIB%;%SDK_DIR%\lib

REM Dump the Windows build environment at this point
REM echo ----------------------- BUILD ENV ----------------------
setlocal
@echo PATH is
set _remain_=%PATH%
call :listenv
@echo INCLUDE is
set _remain_=%INCLUDE%
call :listenv
@echo LIB is
set _remain_=%LIB%
call :listenv
REM echo --------------------------------------------------------

exit /B 0

:listenv
if "~%_remain_%"=="~" goto :EOF
for /F "delims=; tokens=1,*" %%I in ("%_remain_%") do (
   set _remain_=%%J
   echo.   %%I
)
goto listenv

@echo off
REM --------------------------------------------------------------
REM Set PATH, INCLUDE, and LIB environment variables so
REM that CMAKE can be invoked and Condor can be built from
REM the command line.
REM
REM Note that the existing PATH is not preserved, although the new
REM path will still have Windows, PERL, and CMAKE in it.
REM
REM if USER_TOOLS_DIR and/or USER_TOOLS_DIR2 are set, they will be
REM added to the path, USER_TOOLS_DIR will be a the beginning
REM and USER_TOOLS_DIR2 will be at the end of the path.
REM
REM This batch file will setup the following environment variables
REM if they do not already exist.
REM  CMAKE_BIN_DIR - short path to cmake\bin
REM  WIX_BIN_DIR   - short path to Wix\bin
REM  ZIP_BIN_DIR   - short path to 7-Zip
REM  PERL_BIN_DIR  - short path to Perl (c:\Perl\bin)
REM  GIT_BIN_DIR   - short path to git\bin
REM  VS_DIR        - the short path to the Visual Studio 2008 directory tree
REM  VC_DIR        - the short path to %VS_DIR%\VC (used to set include and lib)
REM  VC_BIN        - the short path to %VS_DIR%\VC\bin (where the compiler is)
REM  SDK_DIR       - the short path to the Windows SDK (v7.0)
REM  DOTNET_DIRS   - paths to .NET 3.5 and 2.0
REM
REM  PATH, LIB, and INCLUDE are then constructed from these
REM
REM Requirements:
REM
REM   before executing this batch script, CMAKE.EXE must
REM   be in the PATH, or CMAKE_BIN_DIR must be set to its location
REM   or CMAKE must be installed in c:\tools\cmake
REM
REM   MSCONFIG_TOOLS_DIR must be set to the condor sources msconfig dir
REM   or this batch file must be run from that directory
REM
REM   the location of the MS C compiler is derived from the
REM   VS110COMNTOOLS environment variable. (which is set in all
REM   user's environments by the default compiler install.)
REM
REM

:: check to see if MSCONFIG_TOOLS_DIR is set, if it is not set assume that it
:: is where this file is. also strip off an trailing \ from the path.
::
if "~%MSCONFIG_TOOLS_DIR%"=="~" set MSCONFIG_TOOLS_DIR=%~sdp0
if "~%MSCONFIG_TOOLS_DIR:~-1%"=="~\" Set MSCONFIG_TOOLS_DIR=%MSCONFIG_TOOLS_DIR:~0,-1%
if not exist %MSCONFIG_TOOLS_DIR%\license.rtf (
   echo MSCONFIG_TOOLS_DIR is not valid!
)

:: set CMAKE_BIN_DIR if it is not already set, look first in the path then
:: in the registry and finally both of those fail just set it to C:\tools\cmake
::
if "~%CMAKE_BIN_DIR%"=="~" for %%I in (cmake.exe) DO Set CMAKE_BIN_DIR=%%~sdp$PATH:I
if "~%CMAKE_BIN_DIR%"=="~" (
   @echo Searching for CMake.exe...
   for /F "tokens=1,2*" %%I in ('reg query "HKLM\SOFTWARE" /k /f "CMake*" /ve /s') do (
      if "%%I"=="(Default)" (
         if "%%J"=="REG_SZ" (
            set CMAKE_BIN_DIR=%%K\bin
            @echo found CMake in the registry at %%K
         )
      )
   )
)
if "~%CMAKE_BIN_DIR%"=="~" set CMAKE_BIN_DIR=c:\Tools\CMake\bin

:: we don't want CMAKE_BIN_DIR to have a trailing slash.
::
if "~%CMAKE_BIN_DIR:~-1%"=="~\" Set CMAKE_BIN_DIR=%CMAKE_BIN_DIR:~0,-1%
echo CMAKE_BIN_DIR=%CMAKE_BIN_DIR%
if not exist %CMAKE_BIN_DIR%\cmake.exe (
  echo can't find CMake.exe, please set CMAKE_BIN_DIR to the path to it.
)

:: find ActivePerl bin dir
::
:: set PERL_BIN_DIR=%SystemDrive%\Perl\bin
if "~%PERL_BIN_DIR%"=="~" for %%I in (perl.exe) DO Set PERL_BIN_DIR=%%~sdp$PATH:I
if "~%PERL_BIN_DIR%"=="~" (
   @echo Searching for Perl.exe...
   for /F "tokens=1,2*" %%I in ('reg query "HKLM\Software" /f "Perl.exe"') do (
      if "%%I"=="BinDir" (
         set PERL_BIN_DIR=%%~sfK
      )
   )
)
if "~%PERL_BIN_DIR:~-1%"=="~\" Set PERL_BIN_DIR=%PERL_BIN_DIR:~0,-1%
echo PERL_BIN_DIR=%PERL_BIN_DIR%
if not exist %PERL_BIN_DIR%\perl.exe echo could not find ActiveState Perl.exe, this is needed to build Condor

:: WiX should be in the path or WIX_BIN_DIR must be set
::
if "~%WIX_BIN_DIR%"=="~" for %%I in (wix.dll) DO Set WIX_BIN_DIR=%%~sdp$PATH:I
if "~%WIX_BIN_DIR%"=="~" set WIX_BIN_DIR=c:\Tools\WiX\bin
if "~%WIX_BIN_DIR:~-1%"=="~\" Set WIX_BIN_DIR=%WIX_BIN_DIR:~0,-1%
echo WIX_BIN_DIR=%WIX_BIN_DIR%
if not exist %WIX_BIN_DIR%\wix.dll echo could not find WiX binaries which are needed to create the Installer

:: need the 7zip path also
::
if "~%ZIP_BIN_DIR%"=="~" for %%I in (7z.exe) do set ZIP_BIN_DIR=%%~sdp$PATH:I
if "~%ZIP_BIN_DIR%"=="~" set ZIP_BIN_DIR=c:\Tools\7-zip
if "~%ZIP_BIN_DIR:~-1%"=="~\" Set ZIP_BIN_DIR=%ZIP_BIN_DIR:~0,-1%
echo ZIP_BIN_DIR=%ZIP_BIN_DIR%
if not exist %ZIP_BIN_DIR%\7z.exe echo could not find 7z.exe, this is needed to PACKAGE condor

:: setup GIT_BIN_DIR if we can find git. this isn't needed to build condor
:: but it is needed to do condor development.
::
if "~%GIT_BIN_DIR%"=="~" for %%I in (git.exe) Do Set GIT_BIN_DIR=%%~sdp$PATH:I
if "~%GIT_BIN_DIR%"=="~" set GIT_BIN_DIR=c:\Tools\Git\bin
if "~%GIT_BIN_DIR:~-1%"=="~\" Set GIT_BIN_DIR=%GIT_BIN_DIR:~0,-1%
echo GIT_BIN_DIR=%GIT_BIN_DIR%
if not exist %GIT_BIN_DIR%\git.exe echo could not find Git.exe, (but it is not needed to build condor)

:: set USER_TOOLS_DIR if it isn't already set.  we point it at c:\tools if
:: that directory exists.
::
if "~%USER_TOOLS_DIR%"=="~" (
REM if exist c:\Tools\NUL set USER_TOOLS_DIR=C:\Tools
)
echo USER_TOOLS_DIR=%USER_TOOLS_DIR%

REM 64-bit environments have a slightly different directory layout here
REM we take this in to account so that we can prefix paths later with the
REM the correct program files path. (Note, this assumes a clean install.
REM I'll harden it further if there is a requirement for it.)
set PROGRAMS_DIR=%ProgramFiles%
if not "~%ProgramFiles(x86)%"=="~" set PROGRAMS_DIR=%SystemDrive%\PROGRA~2

:: If Visual Studio 2012 is installed, then VS110COMNTOOLS should be defined
:: we can use that to setup the compiler environment. if it's not set
:: then all we can do is choose default values for environment variables.
::
if "~%VS110COMNTOOLS%"=="~" goto use_default_paths

:: derive from VS110COMNTOOLS
::
for /D %%I in ("%VS110COMNTOOLS%..") do set VS110ROOT=%%~sdpI
set VS_DIR=%VS110ROOT:~0,-1%
set VC_DIR=%VS_DIR%\VC
set VC_BIN=%VC_DIR%\bin
set DBG_TOOLS_DIR=%ProgramFiles%\Debugging Tools for Windows (x86);%ProgramFiles%\Debugging Tools for Windows (x64)
set DOTNET_DIRS=%SystemRoot%\Microsoft.NET\Framework\v3.5;%SystemRoot%\Microsoft.NET\Framework\v2.0.50727

:: find the latest windows SDK dir
::
::set SDK_DIR=%SystemDrive%\PROGRA~1\MICROS~3\Windows\v7.0
if "~%SDK_DIR%"=="~" (
   for /F "tokens=1,2*" %%I in ('reg query "HKLM\Software\Microsoft\Microsoft SDKs\Windows" /v "CurrentInstallFolder"') do (
      if "%%I"=="CurrentInstallFolder" (
         set SDK_DIR=%%~sfK
      )
   )
)
if "~%SDK_DIR:~-1%"=="~\" Set SDK_DIR=%SDK_DIR:~0,-1%

goto got_paths

:: don't have VS110COMNTOOLS defined, so we will have to assume default
:: installation paths for compiler
::
:use_default_paths
:: Set default paths for Visual C++, the Platform SDKs, and Perl
set VS_DIR=%PROGRAMS_DIR%\Microsoft Visual Studio 11.0
set VC_DIR=%VS_DIR%\VC
set VC_BIN=%VC_DIR%\bin
set PERL_BIN_DIR=%SystemDrive%\Perl\bin
set SDK_DIR=%ProgramFiles%\Microsoft SDKs\Windows\v7.0
set DBG_TOOLS_DIR=%ProgramFiles%\Debugging Tools for Windows (x86);%ProgramFiles%\Debugging Tools for Windows (x64)
set DOTNET_DIRS=%SystemRoot%\Microsoft.NET\Framework\v3.5;%SystemRoot%\Microsoft.NET\Framework\v2.0.50727

:got_paths

REM Setup the path to point to Windows, the C compiler, msconfig for stuff
REM like awk, gunzip, tar, bison, yacc...
REM
set PATH=%SystemRoot%;%SystemRoot%\system32;%CMAKE_BIN_DIR%;%MSCONFIG_TOOLS_DIR%
set PATH=%PATH%;%VS_DIR%\Common7\IDE;%VC_DIR%;%VC_BIN%
if NOT "~%SDK_DIR%"=="~" set PATH=%PATH%;%SDK_DIR%\bin
if NOT "~%PERL_BIN_DIR%"=="~" set PATH=%PATH%;%PERL_BIN_DIR%
if NOT "~%DOTNET_DIRS%"=="~" set PATH=%PATH%;%DOTNET_DIRS%
REM if NOT "~%DBG_TOOLS_DIR%"=="~" set PATH=%PATH%;%DBG_TOOLS_DIR%
if NOT "~%WIX_BIN_DIR%"=="~" set PATH=%PATH%;%WIX_BIN_DIR%
if NOT "~%GIT_BIN_DIR%"=="~" set PATH=%PATH%;%GIT_BIN_DIR%
if NOT "~%ZIP_BIN_DIR%"=="~" set PATH=%PATH%;%ZIP_BIN_DIR%
if NOT "~%USER_TOOLS_DIR%"=="~" set PATH=%USER_TOOLS_DIR%;%PATH%
if NOT "~%USER_TOOLS_DIR2%"=="~" set PATH=%PATH%;%USER_TOOLS_DIR2%

REM setup include path
REM
set INCLUDE=%VC_DIR%\include
set INCLUDE=%INCLUDE%;%VC_DIR%\atlmfc\include
if NOT "~%SDK_DIR%"=="~" set INCLUDE=%INCLUDE%;%SDK_DIR%\include
if NOT "~%DOTNET_DIRS%"=="~" set INCLUDE=%INCLUDE%;%DOTNET_DIRS%

REM setup lib path
REM
set LIB=%VC_DIR%\lib
set LIB=%LIB%;%VC_DIR%\atlmfc\lib
if NOT "~%SDK_DIR%"=="~" set LIB=%LIB%;%SDK_DIR%\lib

REM Dump the Windows build environment at this point
REM echo ----------------------- BUILD ENV ----------------------
setlocal
@echo PATH is
set _remain_=%PATH%
call :listenv
@echo INCLUDE is
set _remain_=%INCLUDE%
call :listenv
@echo LIB is
set _remain_=%LIB%
call :listenv
REM echo --------------------------------------------------------

exit /B 0

:listenv
if "~%_remain_%"=="~" goto :EOF
for /F "delims=; tokens=1,*" %%I in ("%_remain_%") do (
   set _remain_=%%J
   echo.   %%I
)
goto listenv

change windows set_build_env.bat script to assume Visual Studio 2012 rather than Visual Studio 2008


@echo off

goto entry

:usage
  echo usage: bolt build [-c^|--config CONFIG_JS] [-o^|--output OUTPUT_DIR] [-s^|--src-dir SRC_DIR]
  echo                   [-i^|--inline] [-n^|--invoke-main MAIN_MODULE] [-r^|--register]
  echo                   [-m^|--modules] [-e^|--entry-points FILE ...] [-g^|--entry-group NAME FILE ...]
  echo.
  echo options:
  echo   -c^|--config CONFIG_JS         override bolt configuration file
  echo                                    default: config/bolt/prod.js
  echo   -o^|--output OUTPUT_DIR         override output directory, note this is different
  echo                                  to the jsc compile directory, the compiled output,
  echo                                  will be located at $OUTPUT_DIR/compile
  echo                                    default: scratch/main/js
  echo   -s^|--src-dir SRC_DIR           override source directory
  echo                                    default: src/main/js
  echo   -i^|--inline                    enable generation of inline scripts (only produces output
  echo                                  in conjunction with -e or -g).
  echo   -n^|--invoke-main MAIN_MODULE   specify main module of inline scripts.
  echo   -r^|--register                  register modules in global namespace for inline scripts,
  echo                                  this will default to true unless -n is specified.
  echo   -m^|--modules                   enable generation of flat module files.
  echo   -e^|--entry-points FILE ...     specify a set of entry points, a compiled output
  echo                                  will be generated for each entry point. Multiple
  echo                                  -e flags may be specified.
  echo   -g^|--entry-group NAME FILE ... specify an entry group, a single compiled output
  echo                                  will be generated with NAME for each entry-group.
  echo                                  Multiple -g flags may be specified.
  echo.
  echo example:
  echo   Produce a bolt build for a top level application. A compiled file will be
  echo   generated for each Main module in this example.
  echo.
  echo     bolt build -e src/main/js/**/*Main.js
  echo.
  echo.
  echo   Produce a bolt build for a top level library. A self contained script registering
  echo   all modules in their namespace will be produced.
  echo.
  echo     bolt build -i -g example src/main/js/**/api/*.js
  echo.
  echo.
  echo   Produce a bolt build for a general purpose library, in this build we only want
  echo   modules to be produced, no compiled output.
  echo.
  echo     bolt build -m src/main/js

  exit /b 0

:fail_usage
  echo.
  call :usage
  exit /b 1

:fail
  exit /b 1

:is_dir
  setlocal
  set olddir=%CD%
  cd "%~1" 2>NUL
  set err=%errorlevel%
  cd "%olddir%"
  exit /b %err%

:entry

set base=%~dp0

if "%help_mode%"=="true" call :usage && exit /b 0

echo Windows support for bolt build is currently not implemented.
exit /b 1

@echo off

goto entry

:usage
  echo usage: bolt build [-c^|--config CONFIG_JS] [-o^|--output OUTPUT_DIR] [-s^|--src-dir SRC_DIR]
  echo                   [-i^|--inline] [-n^|--invoke-main MAIN_MODULE] [-r^|--register]
  echo                   [-m^|--modules] [-e^|--entry-points FILE ...] [-g^|--entry-group NAME FILE ...]
  echo.
  echo options:
  echo   -c^|--config CONFIG_JS         override bolt configuration file
  echo                                    default: config/bolt/prod.js
  echo   -o^|--output OUTPUT_DIR         override output directory, note this is different
  echo                                  to the jsc compile directory, the compiled output,
  echo                                  will be located at $OUTPUT_DIR/compile
  echo                                    default: scratch/main/js
  echo   -s^|--src-dir SRC_DIR           override source directory
  echo                                    default: src/main/js
  echo   -i^|--inline                    enable generation of inline scripts (only produces output
  echo                                  in conjunction with -e or -g).
  echo   -n^|--invoke-main MAIN_MODULE   specify main module of inline scripts.
  echo   -r^|--register                  register modules in global namespace for inline scripts,
  echo                                  this will default to true unless -n is specified.
  echo   -m^|--modules                   enable generation of flat module files.
  echo   -e^|--entry-points FILE ...     specify a set of entry points, a compiled output
  echo                                  will be generated for each entry point. Multiple
  echo                                  -e flags may be specified.
  echo   -g^|--entry-group NAME FILE ... specify an entry group, a single compiled output
  echo                                  will be generated with NAME for each entry-group.
  echo                                  Multiple -g flags may be specified.
  echo.
  echo example:
  echo   Produce a bolt build for a top level application. A compiled file will be
  echo   generated for each Main module in this example.
  echo.
  echo     bolt build -e src/main/js/**/*Main.js
  echo.
  echo.
  echo   Produce a bolt build for a top level library. A self contained script registering
  echo   all modules in their namespace will be produced.
  echo.
  echo     bolt build -i -g example src/main/js/**/api/*.js
  echo.
  echo.
  echo   Produce a bolt build for a general purpose library, in this build we only want
  echo   modules to be produced, no compiled output.
  echo.
  echo     bolt build -m src/main/js

  exit /b 0

:fail_usage
  echo.
  call :usage
  exit /b 1

:fail
  exit /b 1

:is_dir
  setlocal
  set olddir=%CD%
  cd "%~1" 2>NUL
  set err=%errorlevel%
  cd "%olddir%"
  exit /b %err%

:entry

set base=%~dp0

if "%help_mode%"=="true" call :usage && exit /b 0

set count_targets=0
set count_entry_point=0
set count_entry_group_name=0

:parse_flags
  set flag=%~1
  if not "%flag:~0,1%"=="-" goto done_parse_flags
  shift

  if "%flag%"=="-c" goto parse_config
  if "%flag%"=="--config" goto parse_config
  if "%flag%"=="-o" goto parse_output
  if "%flag%"=="--output" goto parse_output
  if "%flag%"=="-s" goto parse_src
  if "%flag%"=="--src-dir" goto parse_src
  if "%flag%"=="-n" goto parse_invoke
  if "%flag%"=="--invoke-main" goto parse_invoke
  if "%flag%"=="-r" goto parse_register
  if "%flag%"=="--register" goto parse_register
  if "%flag%"=="-i" goto parse_inline
  if "%flag%"=="--inline" goto parse_inline
  if "%flag%"=="-m" goto parse_modules
  if "%flag%"=="--modules" goto parse_modules
  if "%flag%"=="-e" goto parse_points
  if "%flag%"=="--entry-points" goto parse_points
  if "%flag%"=="-g" goto parse_group
  if "%flag%"=="--entry-group" goto parse_group
  if "%flag%"=="--" goto done_parse_flags
  echo invalid flag [%flag%] && goto fail_usage

  goto parse_flags

  :parse_config
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set config_js=%~1
    shift
  goto parse_flags

  :parse_output
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set output_dir=%~1
    shift
  goto parse_flags

  :parse_src
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set src_dir=%~1
    shift
  goto parse_flags

  :parse_invoke
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set invoke_main_flag=-n "%~1"
    shift
  goto parse_flags

  :parse_register
    set register_modules_flag=-r
  goto parse_flags

  :parse_inline
    set generate_inline=true
  goto parse_flags

  :parse_modules
    set generate_modules=true
  goto parse_modules

  :parse_points
    :point_loop
      set entry=%~1
      if "%entry%"=="" goto end_point_loop
      if "%entry:~0,1%"=="-" goto end_point_loop
      shift

      if not exist "%entry%" echo specified file for entry point not found [%entry%] && goto fail
      call :is_dir "%entry%"
      if %errorlevel%==0 echo specified file for entry point not found [%entry%] && goto fail

      set entry_point_%count_entry_point%="%entry%"
      set /a count_entry_point=%count_entry_point% + 1
    goto point_loop
    :end_point_loop
  goto parse_modules

  :parse_group
    echo --entry-group parsing not implemented.
    exit /b 1
  goto parse_modules

:done_parse_flags

if "%config_js%"=="" set config_js=config/bolt/prod.js
if "%output_dir%"=="" set output_dir=scratch/main/js
if "%src_dir%"=="" set src_dir=src/main/js
if "%generate_inline%"=="" set generate_inline=false
if "%generate_modules%"=="" set generate_modules=false

echo Windows support for bolt build is currently not implemented.
exit /b 1

Implement bulk of flag parsing for bolt build


@echo off

goto entry

:usage
  echo usage: bolt test [-v^|--verbose] CONFIG TEST ...
  echo.
  echo arguments:
  echo   CONFIG                   The bolt configuration file to be used for tests
  echo   TEST                     A test file. The test file may contain one or more
  echo                            test methods. Test files have an `assert` library
  echo                            exposed to them automatically.
  echo.
  echo example:
  echo   Run all atomic tests.
  echo.
  echo     bolt test config/bolt/atomic.js src/test/js/atomic/**/*.js
  echo.
  echo.
  echo   Run all browser tests.
  echo.
  echo     bolt test config/bolt/browser.js src/test/js/browser/**/*.js

  exit /b 0

:fail_usage
  echo.
  call :usage
  exit /b 1

:fail
  exit /b 1

:is_dir
  setlocal
  set olddir=%CD%
  cd "%~1" 2>NUL
  set err=%errorlevel%
  cd "%olddir%"
  exit /b %err%

:entry

if "%help_mode%"=="true" call :usage && exit /b 0

set verbose=false

if "%~1"=="-v" (set verbose=true
  shift && goto done_flags)
if "%~1"=="--verbose" (set verbose=true
  shift && goto done_flags)

if "%~1"=="" goto done_flags

set flag=%~1
if "%flag:~0,1%"=="-" echo Unknown flag [%flag%] && goto fail_usage

:done_flags

if "%~2"=="" echo Not enough arguments, must specify configuration and at least one test file. && goto fail_usage

set config=%~1
shift

if not exist "%config%" echo Could not find config file [%config%] && exit /b 10
call :is_dir "%config%"
if %errorlevel%==0 echo Could not find config file [%config%] && exit /b 10

for %%i in (node.exe) do set node=%%~$PATH:i
if "%node%"=="" echo error: node.js is not on the system path && goto fail

set remaining=
:remaining
if "%~1"=="" goto end_remaining
set remaining=%remaining% "%~1"
shift
goto remaining
:end_remaining

setlocal enabledelayedexpansion
for %%i in (%remaining%) do (
  if not exist %%i echo Could not find test file [%%i] && exit /b 20
  call :is_dir %%i
  if !errorlevel!==0 echo Could not find test file [%%i] && exit /b 20)
endlocal

"%node%" "%base%bolt-test.js" "%verbose%" "%config%" %remaining%

Change to windows line endings

Change to windows line endings


@echo off
REM Update source for glslang, spirv-tools

REM Determine the appropriate CMake strings for the current version of Visual Studio
echo Determining VS version
python .\scripts\determine_vs_version.py > vsversion.tmp
set /p VS_VERSION=< vsversion.tmp
echo Detected Visual Studio Version as %VS_VERSION%

REM Cleanup the file we used to collect the VS version output since it's no longer needed.
del /Q /F vsversion.tmp

setlocal EnableDelayedExpansion
set errorCode=0
set BUILD_DIR=%~dp0
set BASE_DIR="%BUILD_DIR%external"
set REVISION_DIR="%BUILD_DIR%external_revisions"
set GLSLANG_DIR=%BASE_DIR%\glslang
set SPIRV_TOOLS_DIR=%BASE_DIR%\spirv-tools

REM // ======== Parameter parsing ======== //

   if "%1" == "" (
      echo usage: update_external_sources.bat [options]
      echo.
      echo Available options:
      echo   --sync-glslang      just pull glslang_revision
      echo   --sync-spirv-tools  just pull spirv-tools_revision
      echo   --build-glslang     pulls glslang_revision, configures CMake, builds Release and Debug
      echo   --build-spirv-tools pulls spirv-tools_revision, configures CMake, builds Release and Debug
      echo   --all               sync and build glslang, LunarGLASS, spirv-tools
      goto:finish
   )

   set sync-glslang=0
   set sync-spirv-tools=0
   set build-glslang=0
   set build-spirv-tools=0
   set check-glslang-build-dependencies=0

   :parameterLoop

      if "%1"=="" goto:parameterContinue

      if "%1" == "--sync-glslang" (
         set sync-glslang=1
         shift
         goto:parameterLoop
      )

      if "%1" == "--sync-spirv-tools" (
         set sync-spirv-tools=1
         shift
         goto:parameterLoop
      )

      if "%1" == "--build-glslang" (
         set sync-glslang=1
         set check-glslang-build-dependencies=1
         set build-glslang=1
         shift
         goto:parameterLoop
      )

      if "%1" == "--build-spirv-tools" (
         set sync-spirv-tools=1
         REM glslang has the same needs as spirv-tools
         set check-glslang-build-dependencies=1
         set build-spirv-tools=1
         shift
         goto:parameterLoop
      )

      if "%1" == "--all" (
         set sync-glslang=1
         set sync-spirv-tools=1
         set build-glslang=1
         set build-spirv-tools=1
         set check-glslang-build-dependencies=1
         shift
         goto:parameterLoop
      )

      echo Unrecognized options "%1"
      goto:error

   :parameterContinue

REM // ======== end Parameter parsing ======== //

REM // ======== Dependency checking ======== //
   REM git is required for all paths
   for %%X in (git.exe) do (set FOUND=%%~$PATH:X)
   if not defined FOUND (
      echo Dependency check failed:
      echo   git.exe not found
      echo   Git for Windows can be downloaded here:  https://git-scm.com/download/win
      echo   Install and ensure git.exe makes it into your PATH
      set errorCode=1
   )

   if %check-glslang-build-dependencies% equ 1 (
      for %%X in (cmake.exe) do (set FOUND=%%~$PATH:X)
      if not defined FOUND (
         echo Dependency check failed:
         echo   cmake.exe not found
         echo   Get CNake 2.8 for Windows here:  http://www.cmake.org/cmake/resources/software.html
         echo   Install and ensure each makes it into your PATH, default is "C:\Program Files (x86)\CMake\bin"
         set errorCode=1
      )
   )

   REM goto:main

REM // ======== end Dependency checking ======== //

:main

if %errorCode% neq 0 (goto:error)

REM Read the target versions from external file, which is shared with Linux script

if not exist %REVISION_DIR%\glslang_revision (
   echo.
   echo Missing glslang_revision file!  Place it in %REVSION_DIR% with target version in it.
   set errorCode=1
   goto:error
)

if not exist %REVISION_DIR%\spirv-tools_revision (
   echo.
   echo Missing spirv-tools_revision file!  Place it in %REVISION_DIR% with target version in it.
   set errorCode=1
   goto:error
)

set /p GLSLANG_REVISION= < %REVISION_DIR%\glslang_revision
set /p SPIRV_TOOLS_REVISION= < %REVISION_DIR%\spirv-tools_revision
set /p SPIRV_HEADERS_REVISION= < %REVISION_DIR%\spirv-headers_revision
echo GLSLANG_REVISION=%GLSLANG_REVISION%
echo SPIRV_TOOLS_REVISION=%SPIRV_TOOLS_REVISION%
echo SPIRV_HEADERS_REVISION=%SPIRV_HEADERS_REVISION%

echo Creating and/or updating glslang, spirv-tools in %BASE_DIR%

if %sync-glslang% equ 1 (
   if exist %GLSLANG_DIR% (
      rd /S /Q %GLSLANG_DIR%
   )
   if not exist %GLSLANG_DIR% (
      call:create_glslang
   )
   if %errorCode% neq 0 (goto:error)
   call:update_glslang
   if %errorCode% neq 0 (goto:error)
)

if %sync-spirv-tools% equ 1 (
   if exist %SPIRV_TOOLS_DIR% (
      rd /S /Q %SPIRV_TOOLS_DIR%
   )
   if %errorlevel% neq 0 (goto:error)
   if not exist %SPIRV_TOOLS_DIR% (
      call:create_spirv-tools
   )
   if %errorCode% neq 0 (goto:error)
   call:update_spirv-tools
   if %errorCode% neq 0 (goto:error)
)

if %build-glslang% equ 1 (
   call:build_glslang
   if %errorCode% neq 0 (goto:error)
)

if %build-spirv-tools% equ 1 (
   call:build_spirv-tools
   if %errorCode% neq 0 (goto:error)
)

echo.
echo Exiting
goto:finish

:error
echo.
echo Halting due to error
goto:finish

:finish
if not "%cd%\" == "%BUILD_DIR%" ( cd %BUILD_DIR% )
endlocal
goto:eof

REM // ======== Functions ======== //

:create_glslang
   echo.
   echo Creating local glslang repository %GLSLANG_DIR%)
   mkdir %GLSLANG_DIR%
   cd %GLSLANG_DIR%
   git clone https://github.com/KhronosGroup/glslang.git .
   git checkout %GLSLANG_REVISION%
   if not exist %GLSLANG_DIR%\SPIRV (
      echo glslang source download failed!
      set errorCode=1
   )
goto:eof

:update_glslang
   echo.
   echo Updating %GLSLANG_DIR%
   cd %GLSLANG_DIR%
   git fetch --all
   git checkout %GLSLANG_REVISION%
goto:eof

:create_spirv-tools
   echo.
   echo Creating local spirv-tools repository %SPIRV_TOOLS_DIR%)
   mkdir %SPIRV_TOOLS_DIR%
   cd %SPIRV_TOOLS_DIR%
   git clone https://github.com/KhronosGroup/SPIRV-Tools.git .
   git checkout %SPIRV_TOOLS_REVISION%
   if not exist %SPIRV_TOOLS_DIR%\source (
      echo spirv-tools source download failed!
      set errorCode=1
   )
   mkdir %SPIRV_TOOLS_DIR%\external
   mkdir %SPIRV_TOOLS_DIR%\external\spirv-headers
   cd %SPIRV_TOOLS_DIR%\external\spirv-headers
   git clone https://github.com/KhronosGroup/SPIRV-HEADERS.git .
   git checkout %SPIRV_HEADERS_REVISION%
   if not exist %SPIRV_TOOLS_DIR%\external\spirv-headers\README.md (
      echo spirv-headers download failed!
      set errorCode=1
   )
goto:eof

:update_spirv-tools
   echo.
   echo Updating %SPIRV_TOOLS_DIR%
   cd %SPIRV_TOOLS_DIR%
   git fetch --all
   git checkout %SPIRV_TOOLS_REVISION%
   cd %SPIRV_TOOLS_DIR%\external\spirv-headers
   git fetch --all
   git checkout %SPIRV_HEADERS_REVISION%
goto:eof

:build_glslang
   echo.
   echo Building %GLSLANG_DIR%
   cd  %GLSLANG_DIR%

   REM Cleanup any old directories lying around.
   if exist build32 (
      rmdir /s /q build32
   )
   if exist build (
      rmdir /s /q build
   )

   echo Making 32-bit glslang
   echo *************************
   mkdir build32
   set GLSLANG_BUILD_DIR=%GLSLANG_DIR%\build32
   cd %GLSLANG_BUILD_DIR%

   echo Generating 32-bit Glslang CMake files for Visual Studio %VS_VERSION% -DCMAKE_INSTALL_PREFIX=install ..
   cmake -G "Visual Studio %VS_VERSION%" -DCMAKE_INSTALL_PREFIX=install ..

   echo Building 32-bit Glslang: MSBuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Debug
   msbuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Debug /verbosity:quiet

   REM Check for existence of one lib, even though we should check for all results
   if not exist %GLSLANG_BUILD_DIR%\glslang\Debug\glslangd.lib (
      echo.
      echo glslang 32-bit Debug build failed!
      set errorCode=1
   )
   echo Building Glslang: MSBuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Release
   msbuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Release /verbosity:quiet

   REM Check for existence of one lib, even though we should check for all results
   if not exist %GLSLANG_BUILD_DIR%\glslang\Release\glslang.lib (
      echo.
      echo glslang 32-bit Release build failed!
      set errorCode=1
   )

   cd ..

   echo Making 64-bit glslang
   echo *************************
   mkdir build
   set GLSLANG_BUILD_DIR=%GLSLANG_DIR%\build
   cd %GLSLANG_BUILD_DIR%

   echo Generating 64-bit Glslang CMake files for Visual Studio %VS_VERSION% -DCMAKE_INSTALL_PREFIX=install ..
   cmake -G "Visual Studio %VS_VERSION% Win64" -DCMAKE_INSTALL_PREFIX=install ..

   echo Building 64-bit Glslang: MSBuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Debug
   msbuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Debug /verbosity:quiet

   REM Check for existence of one lib, even though we should check for all results
   if not exist %GLSLANG_BUILD_DIR%\glslang\Debug\glslangd.lib (
      echo.
      echo glslang 64-bit Debug build failed!
      set errorCode=1
   )
   echo Building Glslang: MSBuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Release
   msbuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Release /verbosity:quiet

   REM Check for existence of one lib, even though we should check for all results
   if not exist %GLSLANG_BUILD_DIR%\glslang\Release\glslang.lib (
      echo.
      echo glslang 64-bit Release build failed!
      set errorCode=1
   )
goto:eof

:build_spirv-tools
   echo.
   echo Building %SPIRV_TOOLS_DIR%
   cd  %SPIRV_TOOLS_DIR%

   REM Cleanup any old directories lying around.
   if exist build32 (
      rmdir /s /q build32
   )
   if exist build (
      rmdir /s /q build
   )

   echo Making 32-bit spirv-tools
   echo *************************
   mkdir build32
   set SPIRV_TOOLS_BUILD_DIR=%SPIRV_TOOLS_DIR%\build32

   cd %SPIRV_TOOLS_BUILD_DIR%

   echo Generating 32-bit spirv-tools CMake files for Visual Studio %VS_VERSION% ..
   cmake -G "Visual Studio %VS_VERSION%" ..

   echo Building 32-bit spirv-tools: MSBuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Debug
   msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Debug /verbosity:quiet

   REM Check for existence of one lib, even though we should check for all results
   if not exist %SPIRV_TOOLS_BUILD_DIR%\source\Debug\SPIRV-Tools.lib (
      echo.
      echo spirv-tools 32-bit Debug build failed!
      set errorCode=1
   )

   echo Building 32-bit spirv-tools: MSBuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Release
   msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Release /verbosity:quiet

   REM Check for existence of one lib, even though we should check for all results
   if not exist %SPIRV_TOOLS_BUILD_DIR%\source\Release\SPIRV-Tools.lib (
      echo.
      echo spirv-tools 32-bit Release build failed!
      set errorCode=1
   )

   cd ..

   echo Making 64-bit spirv-tools
   echo *************************
   mkdir build
   set SPIRV_TOOLS_BUILD_DIR=%SPIRV_TOOLS_DIR%\build
   cd %SPIRV_TOOLS_BUILD_DIR%

   echo Generating 64-bit spirv-tools CMake files for Visual Studio %VS_VERSION% ..
   cmake -G "Visual Studio %VS_VERSION% Win64" ..

   echo Building 64-bit spirv-tools: MSBuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Debug
   msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Debug /verbosity:quiet

   REM Check for existence of one lib, even though we should check for all results
   if not exist %SPIRV_TOOLS_BUILD_DIR%\source\Debug\SPIRV-Tools.lib (
      echo.
      echo spirv-tools 64-bit Debug build failed!
      set errorCode=1
   )

   echo Building 64-bit spirv-tools: MSBuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Release
   msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Release /verbosity:quiet

   REM Check for existence of one lib, even though we should check for all results
   if not exist %SPIRV_TOOLS_BUILD_DIR%\source\Release\SPIRV-Tools.lib (
      echo.
      echo spirv-tools 64-bit Release build failed!
      set errorCode=1
   )
goto:eof

@echo off
REM Update source for glslang, spirv-tools

REM Determine the appropriate CMake strings for the current version of Visual Studio
echo Determining VS version
python .\scripts\determine_vs_version.py > vsversion.tmp
set /p VS_VERSION=< vsversion.tmp
echo Detected Visual Studio Version as %VS_VERSION%

REM Cleanup the file we used to collect the VS version output since it's no longer needed.
del /Q /F vsversion.tmp

setlocal EnableDelayedExpansion
set errorCode=0
set BUILD_DIR=%~dp0
set BASE_DIR="%BUILD_DIR%external"
set REVISION_DIR="%BUILD_DIR%external_revisions"
set GLSLANG_DIR=%BASE_DIR%\glslang
set SPIRV_TOOLS_DIR=%BASE_DIR%\spirv-tools

REM // ======== Parameter parsing ======== //

   if "%1" == "" (
      echo usage: update_external_sources.bat [options]
      echo.
      echo Available options:
      echo   --sync-glslang      just pull glslang_revision
      echo   --sync-spirv-tools  just pull spirv-tools_revision
      echo   --build-glslang     pulls glslang_revision, configures CMake, builds Release and Debug
      echo   --build-spirv-tools pulls spirv-tools_revision, configures CMake, builds Release and Debug
      echo   --all               sync and build glslang, LunarGLASS, spirv-tools
      goto:finish
   )

   set sync-glslang=0
   set sync-spirv-tools=0
   set build-glslang=0
   set build-spirv-tools=0
   set check-glslang-build-dependencies=0

   :parameterLoop

      if "%1"=="" goto:parameterContinue

      if "%1" == "--sync-glslang" (
         set sync-glslang=1
         shift
         goto:parameterLoop
      )

      if "%1" == "--sync-spirv-tools" (
         set sync-spirv-tools=1
         shift
         goto:parameterLoop
      )

      if "%1" == "--build-glslang" (
         set sync-glslang=1
         set check-glslang-build-dependencies=1
         set build-glslang=1
         shift
         goto:parameterLoop
      )

      if "%1" == "--build-spirv-tools" (
         set sync-spirv-tools=1
         REM glslang has the same needs as spirv-tools
         set check-glslang-build-dependencies=1
         set build-spirv-tools=1
         shift
         goto:parameterLoop
      )

      if "%1" == "--all" (
         set sync-glslang=1
         set sync-spirv-tools=1
         set build-glslang=1
         set build-spirv-tools=1
         set check-glslang-build-dependencies=1
         shift
         goto:parameterLoop
      )

      echo Unrecognized options "%1"
      goto:error

   :parameterContinue

REM // ======== end Parameter parsing ======== //

REM // ======== Dependency checking ======== //
   REM git is required for all paths
   for %%X in (git.exe) do (set FOUND=%%~$PATH:X)
   if not defined FOUND (
      echo Dependency check failed:
      echo   git.exe not found
      echo   Git for Windows can be downloaded here:  https://git-scm.com/download/win
      echo   Install and ensure git.exe makes it into your PATH
      set errorCode=1
   )

   if %check-glslang-build-dependencies% equ 1 (
      for %%X in (cmake.exe) do (set FOUND=%%~$PATH:X)
      if not defined FOUND (
         echo Dependency check failed:
         echo   cmake.exe not found
         echo   Get CNake 2.8 for Windows here:  http://www.cmake.org/cmake/resources/software.html
         echo   Install and ensure each makes it into your PATH, default is "C:\Program Files (x86)\CMake\bin"
         set errorCode=1
      )
   )

   REM goto:main

REM // ======== end Dependency checking ======== //

:main

if %errorCode% neq 0 (goto:error)

REM Read the target versions from external file, which is shared with Linux script

if not exist %REVISION_DIR%\glslang_revision (
   echo.
   echo Missing glslang_revision file!  Place it in %REVSION_DIR% with target version in it.
   set errorCode=1
   goto:error
)

if not exist %REVISION_DIR%\spirv-tools_revision (
   echo.
   echo Missing spirv-tools_revision file!  Place it in %REVISION_DIR% with target version in it.
   set errorCode=1
   goto:error
)

if not exist %REVISION_DIR%\spirv-headers_revision (
   echo.
   echo Missing spirv-headers_revision file!  Place it in %REVISION_DIR% with target version in it.
   set errorCode=1
   goto:error
)

set /p GLSLANG_REVISION= < %REVISION_DIR%\glslang_revision
set /p SPIRV_TOOLS_REVISION= < %REVISION_DIR%\spirv-tools_revision
set /p SPIRV_HEADERS_REVISION= < %REVISION_DIR%\spirv-headers_revision
echo GLSLANG_REVISION=%GLSLANG_REVISION%
echo SPIRV_TOOLS_REVISION=%SPIRV_TOOLS_REVISION%
echo SPIRV_HEADERS_REVISION=%SPIRV_HEADERS_REVISION%

echo Creating and/or updating glslang, spirv-tools in %BASE_DIR%

if %sync-glslang% equ 1 (
   if exist %GLSLANG_DIR% (
      rd /S /Q %GLSLANG_DIR%
   )
   if not exist %GLSLANG_DIR% (
      call:create_glslang
   )
   if %errorCode% neq 0 (goto:error)
   call:update_glslang
   if %errorCode% neq 0 (goto:error)
)

if %sync-spirv-tools% equ 1 (
   if exist %SPIRV_TOOLS_DIR% (
      rd /S /Q %SPIRV_TOOLS_DIR%
   )
   if %errorlevel% neq 0 (goto:error)
   if not exist %SPIRV_TOOLS_DIR% (
      call:create_spirv-tools
   )
   if %errorCode% neq 0 (goto:error)
   call:update_spirv-tools
   if %errorCode% neq 0 (goto:error)
)

if %build-glslang% equ 1 (
   call:build_glslang
   if %errorCode% neq 0 (goto:error)
)

if %build-spirv-tools% equ 1 (
   call:build_spirv-tools
   if %errorCode% neq 0 (goto:error)
)

echo.
echo Exiting
goto:finish

:error
echo.
echo Halting due to error
goto:finish

:finish
if not "%cd%\" == "%BUILD_DIR%" ( cd %BUILD_DIR% )
endlocal
goto:eof

REM // ======== Functions ======== //

:create_glslang
   echo.
   echo Creating local glslang repository %GLSLANG_DIR%)
   mkdir %GLSLANG_DIR%
   cd %GLSLANG_DIR%
   git clone https://github.com/KhronosGroup/glslang.git .
   git checkout %GLSLANG_REVISION%
   if not exist %GLSLANG_DIR%\SPIRV (
      echo glslang source download failed!
      set errorCode=1
   )
goto:eof

:update_glslang
   echo.
   echo Updating %GLSLANG_DIR%
   cd %GLSLANG_DIR%
   git fetch --all
   git checkout %GLSLANG_REVISION%
goto:eof

:create_spirv-tools
   echo.
   echo Creating local spirv-tools repository %SPIRV_TOOLS_DIR%)
   mkdir %SPIRV_TOOLS_DIR%
   cd %SPIRV_TOOLS_DIR%
   git clone https://github.com/KhronosGroup/SPIRV-Tools.git .
   git checkout %SPIRV_TOOLS_REVISION%
   if not exist %SPIRV_TOOLS_DIR%\source (
      echo spirv-tools source download failed!
      set errorCode=1
   )
   mkdir %SPIRV_TOOLS_DIR%\external
   mkdir %SPIRV_TOOLS_DIR%\external\spirv-headers
   cd %SPIRV_TOOLS_DIR%\external\spirv-headers
   git clone https://github.com/KhronosGroup/SPIRV-HEADERS.git .
   git checkout %SPIRV_HEADERS_REVISION%
   if not exist %SPIRV_TOOLS_DIR%\external\spirv-headers\README.md (
      echo spirv-headers download failed!
      set errorCode=1
   )
goto:eof

:update_spirv-tools
   echo.
   echo Updating %SPIRV_TOOLS_DIR%
   cd %SPIRV_TOOLS_DIR%
   git fetch --all
   git checkout %SPIRV_TOOLS_REVISION%
   cd %SPIRV_TOOLS_DIR%\external\spirv-headers
   git fetch --all
   git checkout %SPIRV_HEADERS_REVISION%
goto:eof

:build_glslang
   echo.
   echo Building %GLSLANG_DIR%
   cd  %GLSLANG_DIR%

   REM Cleanup any old directories lying around.
   if exist build32 (
      rmdir /s /q build32
   )
   if exist build (
      rmdir /s /q build
   )

   echo Making 32-bit glslang
   echo *************************
   mkdir build32
   set GLSLANG_BUILD_DIR=%GLSLANG_DIR%\build32
   cd %GLSLANG_BUILD_DIR%

   echo Generating 32-bit Glslang CMake files for Visual Studio %VS_VERSION% -DCMAKE_INSTALL_PREFIX=install ..
   cmake -G "Visual Studio %VS_VERSION%" -DCMAKE_INSTALL_PREFIX=install ..

   echo Building 32-bit Glslang: MSBuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Debug
   msbuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Debug /verbosity:quiet

   REM Check for existence of one lib, even though we should check for all results
   if not exist %GLSLANG_BUILD_DIR%\glslang\Debug\glslangd.lib (
      echo.
      echo glslang 32-bit Debug build failed!
      set errorCode=1
   )
   echo Building Glslang: MSBuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Release
   msbuild INSTALL.vcxproj /p:Platform=x86 /p:Configuration=Release /verbosity:quiet

   REM Check for existence of one lib, even though we should check for all results
   if not exist %GLSLANG_BUILD_DIR%\glslang\Release\glslang.lib (
      echo.
      echo glslang 32-bit Release build failed!
      set errorCode=1
   )

   cd ..

   echo Making 64-bit glslang
   echo *************************
   mkdir build
   set GLSLANG_BUILD_DIR=%GLSLANG_DIR%\build
   cd %GLSLANG_BUILD_DIR%

   echo Generating 64-bit Glslang CMake files for Visual Studio %VS_VERSION% -DCMAKE_INSTALL_PREFIX=install ..
   cmake -G "Visual Studio %VS_VERSION% Win64" -DCMAKE_INSTALL_PREFIX=install ..

   echo Building 64-bit Glslang: MSBuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Debug
   msbuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Debug /verbosity:quiet

   REM Check for existence of one lib, even though we should check for all results
   if not exist %GLSLANG_BUILD_DIR%\glslang\Debug\glslangd.lib (
      echo.
      echo glslang 64-bit Debug build failed!
      set errorCode=1
   )
   echo Building Glslang: MSBuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Release
   msbuild INSTALL.vcxproj /p:Platform=x64 /p:Configuration=Release /verbosity:quiet

   REM Check for existence of one lib, even though we should check for all results
   if not exist %GLSLANG_BUILD_DIR%\glslang\Release\glslang.lib (
      echo.
      echo glslang 64-bit Release build failed!
      set errorCode=1
   )
goto:eof

:build_spirv-tools
   echo.
   echo Building %SPIRV_TOOLS_DIR%
   cd  %SPIRV_TOOLS_DIR%

   REM Cleanup any old directories lying around.
   if exist build32 (
      rmdir /s /q build32
   )
   if exist build (
      rmdir /s /q build
   )

   echo Making 32-bit spirv-tools
   echo *************************
   mkdir build32
   set SPIRV_TOOLS_BUILD_DIR=%SPIRV_TOOLS_DIR%\build32

   cd %SPIRV_TOOLS_BUILD_DIR%

   echo Generating 32-bit spirv-tools CMake files for Visual Studio %VS_VERSION% ..
   cmake -G "Visual Studio %VS_VERSION%" ..

   echo Building 32-bit spirv-tools: MSBuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Debug
   msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Debug /verbosity:quiet

   REM Check for existence of one lib, even though we should check for all results
   if not exist %SPIRV_TOOLS_BUILD_DIR%\source\Debug\SPIRV-Tools.lib (
      echo.
      echo spirv-tools 32-bit Debug build failed!
      set errorCode=1
   )

   echo Building 32-bit spirv-tools: MSBuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Release
   msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Release /verbosity:quiet

   REM Check for existence of one lib, even though we should check for all results
   if not exist %SPIRV_TOOLS_BUILD_DIR%\source\Release\SPIRV-Tools.lib (
      echo.
      echo spirv-tools 32-bit Release build failed!
      set errorCode=1
   )

   cd ..

   echo Making 64-bit spirv-tools
   echo *************************
   mkdir build
   set SPIRV_TOOLS_BUILD_DIR=%SPIRV_TOOLS_DIR%\build
   cd %SPIRV_TOOLS_BUILD_DIR%

   echo Generating 64-bit spirv-tools CMake files for Visual Studio %VS_VERSION% ..
   cmake -G "Visual Studio %VS_VERSION% Win64" ..

   echo Building 64-bit spirv-tools: MSBuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Debug
   msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Debug /verbosity:quiet

   REM Check for existence of one lib, even though we should check for all results
   if not exist %SPIRV_TOOLS_BUILD_DIR%\source\Debug\SPIRV-Tools.lib (
      echo.
      echo spirv-tools 64-bit Debug build failed!
      set errorCode=1
   )

   echo Building 64-bit spirv-tools: MSBuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Release
   msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Release /verbosity:quiet

   REM Check for existence of one lib, even though we should check for all results
   if not exist %SPIRV_TOOLS_BUILD_DIR%\source\Release\SPIRV-Tools.lib (
      echo.
      echo spirv-tools 64-bit Release build failed!
      set errorCode=1
   )
goto:eof

build: Add check for spirv-headers revision file

Change-Id: I9bc225275c4d890f44c7ab4dd2076b981778ac20


@echo off

set fdir=%WINDIR%\Microsoft.NET\Framework64

if not exist %fdir% (
	set fdir=%WINDIR%\Microsoft.NET\Framework
)

set msbuild=%fdir%\v4.0.30319\msbuild.exe

%msbuild% SuperWebSocket\SuperWebSocket.csproj /p:Configuration=Release /t:Rebuild /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=..\superwebsocket.snk /p:OutputPath=..\bin\Net40

FOR /F "tokens=*" %%G IN ('DIR /B /AD /S obj') DO RMDIR /S /Q "%%G"

%msbuild% SuperWebSocket\SuperWebSocket.NET35.csproj  /p:Configuration=Release /t:Rebuild /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=..\superwebsocket.snk /p:OutputPath=..\bin\Net35

FOR /F "tokens=*" %%G IN ('DIR /B /AD /S obj') DO RMDIR /S /Q "%%G"

pause

create future branch which bases on SuperSocket 1.5


rem @echo off

rem Script to stitch panoramic videos produced by Samsung Gear360.
rem Could be adopted to use with other cameras after creating pto file
rem (Huging template)

rem For help see:
rem https://github.com/ultramango/gear360pano

rem Names:
rem dec, DEC, decoding - means video to images
rem enc, ENC, encoding - means stitched images to video

set SCRIPTNAME=%0
set SCRIPTPATH=%~dp0
set FRAMESTEMPDIR=frames
set STITCHEDTEMPDIR=frames_stitched
set OUTDIR="%SCRIPTPATH%\html\data"
set FFMPEGPATH=c:\Program Files\ffmpeg\bin
set FFMPEGQUALITYDEC="-q:v 2"
set FFMPEGQUALITYENC="-c:v libx265 -crf 18"
rem %% is an escape character (note: this will fail on wine's cmd.exe)
set IMAGETMPLDEC=image%%05d.jpg
set IMAGETMPLENC=image%%05d_pano.jpg
set PTOTMPL4096=gear360video4096.pto
set PTOTMPL3840=gear360video3840.pto
set PTOTMPL2560=gear360video2560.pto
set PTOTMPL=%SCRIPTPATH%\%PTOTMPL3840%
set TMPAUDIO=tmpaudio.aac
set TMPVIDEO=tmpvideo.mp4
set DEBUG=""

rem Process arguments
set PARAMCOUNT=0
rem We need this due to stupid parameter substitution
setlocal enabledelayedexpansion
:PARAMLOOP
rem Small hack as substring doesn't work on %1 (need to use delayed sub.?)
set _TMP=%1
set FIRSTCHAR=%_TMP:~0,1%
rem No arguments?
rem call :PRINT_DEBUG Current arg: %_TMP%
if "%_TMP%" == "" goto PARAMDONE
rem Process arguments
if "%FIRSTCHAR%" == "/" (
  set SWITCH=!_TMP:~1,2!
  rem call :PRINT_DEBUG Current switch: !SWITCH!
  rem Switch processing
  if /i "!SWITCH!" == "h" (
    rem call :PRINT_DEBUG Printing help
    goto NOARGS
  )
  if /i "!SWITCH!" == "o" (
    shift
    rem call :PRINT_DEBUG Setting output directory to: %2
    set OUTDIR=%2
  )
  if /i "!SWITCH!" == "t" (
    shift
    rem call :PRINT_DEBUG Setting temporary dir: %2
    if not exist "%2" (
      echo Directory "%2" does not exist, using system default
    ) else (
      set MYTEMPDIR=%2
    )
  )
) else (
  if %PARAMCOUNT% EQU 0 (
    rem call :PRINT_DEBUG Input file: %_TMP%
    set INNAME=%_TMP%
  )
  if %PARAMCOUNT% EQU 1 (
    rem call :PRINT_DEBUG Setting PTO: %_TMP%
    set OUTNAME=%_TMP%
  )
  set /a PARAMCOUNT+=1
)
shift & goto PARAMLOOP
:PARAMDONE

rem Start timer
set start=%time%

rem Check arguments
IF "%INNAME%" == "" goto NOARGS

rem Check if second argument present, if not, set some default for output filename
rem This is here, because for whatever reason OUTNAME gets overriden by
rem the last iterated filename if this is at the beginning (for loop is buggy?)
if "%OUTNAME%" neq "" goto SETNAMEOK
set OUTNAME="%~n1_pano.mp4"

:SETNAMEOK
rem Check ffmpeg...
if exist "%FFMPEGPATH%/ffmpeg.exe" goto FFMPEGOK
goto NOFFMPEG

:FFMPEGOK

rem Temporary directory set?
if "%MYTEMPDIR%" == "" set MYTEMPDIR=%TEMP%

rem Create temporary directories
set FRAMESTEMP=%MYTEMPDIR%\%FRAMESTEMPDIR%
set STITCHEDTEMP=%MYTEMPDIR%\%STITCHEDTEMPDIR%
mkdir %FRAMESTEMP%
mkdir %STITCHEDTEMP%

rem Execute commands (as simple as it is)
echo "Converting video to images..."
"%FFMPEGPATH%\ffmpeg.exe" -y -i %INNAME% %FRAMESTEMP%\%IMAGETMPLDEC%
if %ERRORLEVEL% EQU 1 GOTO FFMPEGERROR

rem Detect video size and match Hugin template file
set TMPVIDSIZE=%MYTEMPDIR%\vidsize.tmp
"%FFMPEGPATH%\ffprobe.exe" -v error ^
                           -of csv ^
                           -select_streams v:0 ^
                           -show_entries stream=height,width ^
                           %INNAME% > %TMPVIDSIZE%

for /f "tokens=1-18* delims=," %%A in (%TMPVIDSIZE%) do (
  set VIDSIZE=%%~B:%%~C
)
del %TMPVIDSIZE%

if "%VIDSIZE%"=="4096:2048" set PTOTMPL=%SCRIPTPATH%\%PTOTMPL4096%
if "%VIDSIZE%"=="3840:1920" set PTOTMPL=%SCRIPTPATH%\%PTOTMPL3840%
if "%VIDSIZE%"=="2560:1280" set PTOTMPL=%SCRIPTPATH%\%PTOTMPL2560%

rem Detect framerate
set TMPFPS=%MYTEMPDIR%\vidfps.tmp
"%FFMPEGPATH%\ffprobe.exe" -v error ^
                           -of csv ^
                           -select_streams v:0 ^
                           -show_entries stream=r_frame_rate ^
                           %INNAME% > %TMPFPS%

for /f "tokens=1-18* delims=," %%A in (%TMPFPS%) do (
  set VIDFPS=%%~B
)
del %TMPFPS%

rem Stitching
echo "Stitching frames..."
for %%f in (%FRAMESTEMP%\*.jpg) do (
rem For whatever reason (this has to be at the beginning of the line!)
  echo "Processing frame %%f"
rem TODO: There should be some error checking
  "%SCRIPTPATH%\gear360pano.cmd" /m /o "%STITCHEDTEMP%" "%%f" "%PTOTMPL%"
)

echo "Reencoding video..."
"%FFMPEGPATH%/ffmpeg.exe" -y -f image2 -i %STITCHEDTEMP%/%IMAGETMPLENC% -r %VIDFPS% -s %VIDSIZE% %FFMPEGQUALITYENC% %STITCHEDTEMP%/%TMPVIDEO%
if %ERRORLEVEL% EQU 1 GOTO FFMPEGERROR

rem Check if there's audio
set TMPHASAUDIO=%MYTEMPDIR%\hasaudio.tmp
"%FFMPEGPATH%\ffprobe.exe" -v error ^
                          -of default=nw=1:nk=1 ^
                          -select_streams a ^
                          -show_entries stream=codec_type ^
                          %INNAME% > %TMPHASAUDIO%

set HASAUDIO=<%TMPHASAUDIO%
del %TMPHASAUDIO%

if %HASAUDIO% neq "" (
  echo "Extracting audio..."
  "%FFMPEGPATH%\ffmpeg.exe" -y -i %1 -vn -acodec copy %STITCHEDTEMP%/%TMPAUDIO%
  if %ERRORLEVEL% EQU 1 GOTO FFMPEGERROR

  echo "Merging audio..."
  "%FFMPEGPATH%\ffmpeg.exe" -y -i %STITCHEDTEMP%/%TMPVIDEO% -i %STITCHEDTEMP%/%TMPAUDIO% -c:v copy -c:a aac -strict experimental %OUTNAME%
  if %ERRORLEVEL% EQU 1 GOTO FFMPEGERROR
)

rem Clean-up (f - force, read-only & dirs, q - quiet)
del /f /q %FRAMESTEMPDIR%
del /f /q %OUTTEMPDIR%

echo Video written to %OUTNAME%
goto eof

:NOARGS
echo Script to stitch raw panoramic videos.
echo Raw meaning two fisheye images side by side.
echo.
echo Script originally writen for Samsung Gear 360.
echo.
echo Usage:
echo %0 [options] infile [outfile]
echo.
echo Where inputfile is a panoramic video, outfile
echo is optional. Video file will be written
echo to a file with appended _pano, ex.: dummy.mp4 will
echo be stitched to dummy_pano.mp4.
echo.
echo /o will set the output directory of panoramas
echo    default: html/data
echo /s optimise for speed (lower quality)
echo /t set temporary directory (default: system's
echo    temporary directory)
echo /h prints this help
goto eof

:NOFFMPEG
echo ffmpeg was not found in %FFMPEGPATH%, download from: https://ffmpeg.zeranoe.com/builds/
echo and unpack to program files directory (name it ffmpeg)
goto eof

:FFMPEGERROR
echo ffmpeg failed, video not created
goto eof

:PRINT_DEBUG
if %DEBUG% == "yes" (
  echo DEBUG: %1 %2 %3 %4 %5 %6 %7 %8 %9
)

exit /b 0

:eof

Fix echo on

Fix echo on


@echo off

SET config=release
REM SET config=debug

CALL MsBuild .\uSync8.sln -t:Rebuild -p:Configuration=%config% -clp:Verbosity=minimal;Summary

@Echo Packaging for %config%
nuget pack .\uSync8.Core\uSync.Core.nuspec -build  -OutputDirectory .\dist\%1 -version %1 -properties "depends=%1;Configuration=%config%"
nuget pack .\uSync8.BackOffice\uSync.nuspec -build  -OutputDirectory .\dist\%1 -version %1 -properties "depends=%1;Configuration=%config%"
nuget pack .\uSync8.BackOffice\uSync.BackOffice.Core.nuspec -build  -OutputDirectory .\dist\%1 -version %1 -properties "depends=%1;Configuration=%config%"
nuget pack .\uSync8.Community.Contrib\uSync.Community.Contrib.nuspec  -OutputDirectory .\dist\%1 -build -version %1 -properties "depends=%1;Configuration=%config%"
nuget pack .\uSync8.ContentEdition\uSync.ContentEdition.nuspec  -OutputDirectory .\dist\%1 -build -version %1 -properties "depends=%1;Configuration=%config%"
nuget pack .\uSync8.ContentEdition\uSync.ContentEdition.Core.nuspec  -OutputDirectory .\dist\%1 -build -version %1 -properties "depends=%1;Configuration=%config%"

nuget pack .\uSync8.Community.DataTypeSerializers\uSync.Community.DataTypeSerializers.nuspec  -OutputDirectory .\dist\%1 -build -version %1 -properties "depends=%1;Configuration=%config%"

nuget pack .\uSync.Console\uSync.Console.nuspec  -OutputDirectory .\dist\%1 -build -version %1 -properties "depends=%1;Configuration=%config%"
nuget pack .\uSync8.HistoryView\uSync.History.nuspec  -OutputDirectory .\dist\%1 -build -version %1 -properties "depends=%1;Configuration=%config%"

call .\dist\CreatePackages %1

@ECHO Copying to LocalGit Folder
XCOPY .\dist\%1\*.nupkg c:\source\localgit /y

ECHO Packaging Complete (%config% build)

@echo off

SET config=release
REM SET config=debug

CALL MsBuild .\uSync8.sln -t:Rebuild -p:Configuration=%config% -clp:Verbosity=minimal;Summary

@Echo Packaging for %config%
nuget pack .\uSync8.Core\uSync.Core.nuspec -build  -OutputDirectory .\dist\%1 -version %1 -properties "depends=%1;Configuration=%config%"
nuget pack .\uSync8.BackOffice\uSync.nuspec -build  -OutputDirectory .\dist\%1 -version %1 -properties "depends=%1;Configuration=%config%"
nuget pack .\uSync8.BackOffice\uSync.BackOffice.Core.nuspec -build  -OutputDirectory .\dist\%1 -version %1 -properties "depends=%1;Configuration=%config%"
nuget pack .\uSync8.Community.Contrib\uSync.Community.Contrib.nuspec  -OutputDirectory .\dist\%1 -build -version %1 -properties "depends=%1;Configuration=%config%"
nuget pack .\uSync8.ContentEdition\uSync.ContentEdition.nuspec  -OutputDirectory .\dist\%1 -build -version %1 -properties "depends=%1;Configuration=%config%"
nuget pack .\uSync8.ContentEdition\uSync.ContentEdition.Core.nuspec  -OutputDirectory .\dist\%1 -build -version %1 -properties "depends=%1;Configuration=%config%"

REM nuget pack .\uSync8.Community.DataTypeSerializers\uSync.Community.DataTypeSerializers.nuspec  -OutputDirectory .\dist\%1 -build -version %1 -properties "depends=%1;Configuration=%config%"
REM nuget pack .\uSync.Console\uSync.Console.nuspec  -OutputDirectory .\dist\%1 -build -version %1 -properties "depends=%1;Configuration=%config%"

nuget pack .\uSync8.HistoryView\uSync.History.nuspec  -OutputDirectory .\dist\%1 -build -version %1 -properties "depends=%1;Configuration=%config%"

call .\dist\CreatePackages %1

@ECHO Copying to LocalGit Folder
XCOPY .\dist\%1\*.nupkg c:\source\localgit /y

ECHO Packaging Complete (%config% build)

Remove data and console packages from the build script


echo %PATH%

REM Changing working folder back to current directory for Vista & 7 compatibility
%~d0
CD %~dp0
cd lib/Mingw
REM Folder changed

REM This script upzip's files...

> j_unzip.vbs ECHO '
>> j_unzip.vbs ECHO ' UnZip a file script
>> j_unzip.vbs ECHO '
>> j_unzip.vbs ECHO ' By Justin Godden 2010
>> j_unzip.vbs ECHO '
>> j_unzip.vbs ECHO ' It's a mess, I know!!!
>> j_unzip.vbs ECHO '
>> j_unzip.vbs ECHO.
>> j_unzip.vbs ECHO ' Dim ArgObj, var1, var2
>> j_unzip.vbs ECHO Set ArgObj = WScript.Arguments
>> j_unzip.vbs ECHO.
>> j_unzip.vbs ECHO If (Wscript.Arguments.Count ^> 0) Then
>> j_unzip.vbs ECHO. var1 = ArgObj(0)
>> j_unzip.vbs ECHO Else
>> j_unzip.vbs ECHO. var1 = ""
>> j_unzip.vbs ECHO End if
>> j_unzip.vbs ECHO.
>> j_unzip.vbs ECHO If var1 = "" then
>> j_unzip.vbs ECHO. strFileZIP = "example.zip"
>> j_unzip.vbs ECHO Else
>> j_unzip.vbs ECHO. strFileZIP = var1
>> j_unzip.vbs ECHO End if
>> j_unzip.vbs ECHO.
>> j_unzip.vbs ECHO 'The location of the zip file.
>> j_unzip.vbs ECHO REM Set WshShell = CreateObject("Wscript.Shell")
>> j_unzip.vbs ECHO REM CurDir = WshShell.ExpandEnvironmentStrings("%%cd%%")
>> j_unzip.vbs ECHO Dim sCurPath
>> j_unzip.vbs ECHO sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
>> j_unzip.vbs ECHO strZipFile = sCurPath ^& "\" ^& strFileZIP
>> j_unzip.vbs ECHO 'The folder the contents should be extracted to.
>> j_unzip.vbs ECHO outFolder = sCurPath ^& "\"
>> j_unzip.vbs ECHO.
>> j_unzip.vbs ECHO. WScript.Echo ( "Extracting file " ^& strFileZIP)
>> j_unzip.vbs ECHO.
>> j_unzip.vbs ECHO Set objShell = CreateObject( "Shell.Application" )
>> j_unzip.vbs ECHO Set objSource = objShell.NameSpace(strZipFile).Items()
>> j_unzip.vbs ECHO Set objTarget = objShell.NameSpace(outFolder)
>> j_unzip.vbs ECHO intOptions = 256
>> j_unzip.vbs ECHO objTarget.CopyHere objSource, intOptions
>> j_unzip.vbs ECHO.
>> j_unzip.vbs ECHO. WScrip.Echo ( "Extracted." )
>> j_unzip.vbs ECHO.
>> j_unzip.vbs ECHO ' This bit is for testing purposes
>> j_unzip.vbs ECHO REM Dim MyVar
>> j_unzip.vbs ECHO REM MyVar = MsgBox ( strZipFile, 65, "MsgBox Example"

rd /q/s 64
cscript //B j_unzip.vbs 64.zip

del /f j_unzip.vbs

cd /d "%~dp0"

rd /q/s __tmp_cmake_tmp__
md __tmp_cmake_tmp__
cd __tmp_cmake_tmp__

rd /q/s ../c/CMakeCache.txt

cmake ../c -DCMAKE_BUILD_TYPE=Debug -G "MinGW Makefiles"
make clean
make
make clean
cmake ../c -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles"
make
make install

cd ..
rd /q/s __tmp_cmake_tmp__

echo off
pause
echo The batch file is complete.

echo %PATH%

REM Changing working folder back to current directory for Vista & 7 compatibility
%~d0
CD %~dp0
cd lib/Mingw
REM Folder changed

REM This script upzip's files...

> j_unzip.vbs ECHO '
>> j_unzip.vbs ECHO ' UnZip a file script
>> j_unzip.vbs ECHO '
>> j_unzip.vbs ECHO ' By Justin Godden 2010
>> j_unzip.vbs ECHO '
>> j_unzip.vbs ECHO ' It's a mess, I know!!!
>> j_unzip.vbs ECHO '
>> j_unzip.vbs ECHO.
>> j_unzip.vbs ECHO ' Dim ArgObj, var1, var2
>> j_unzip.vbs ECHO Set ArgObj = WScript.Arguments
>> j_unzip.vbs ECHO.
>> j_unzip.vbs ECHO If (Wscript.Arguments.Count ^> 0) Then
>> j_unzip.vbs ECHO. var1 = ArgObj(0)
>> j_unzip.vbs ECHO Else
>> j_unzip.vbs ECHO. var1 = ""
>> j_unzip.vbs ECHO End if
>> j_unzip.vbs ECHO.
>> j_unzip.vbs ECHO If var1 = "" then
>> j_unzip.vbs ECHO. strFileZIP = "example.zip"
>> j_unzip.vbs ECHO Else
>> j_unzip.vbs ECHO. strFileZIP = var1
>> j_unzip.vbs ECHO End if
>> j_unzip.vbs ECHO.
>> j_unzip.vbs ECHO 'The location of the zip file.
>> j_unzip.vbs ECHO REM Set WshShell = CreateObject("Wscript.Shell")
>> j_unzip.vbs ECHO REM CurDir = WshShell.ExpandEnvironmentStrings("%%cd%%")
>> j_unzip.vbs ECHO Dim sCurPath
>> j_unzip.vbs ECHO sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
>> j_unzip.vbs ECHO strZipFile = sCurPath ^& "\" ^& strFileZIP
>> j_unzip.vbs ECHO 'The folder the contents should be extracted to.
>> j_unzip.vbs ECHO outFolder = sCurPath ^& "\"
>> j_unzip.vbs ECHO.
>> j_unzip.vbs ECHO. WScript.Echo ( "Extracting file " ^& strFileZIP)
>> j_unzip.vbs ECHO.
>> j_unzip.vbs ECHO Set objShell = CreateObject( "Shell.Application" )
>> j_unzip.vbs ECHO Set objSource = objShell.NameSpace(strZipFile).Items()
>> j_unzip.vbs ECHO Set objTarget = objShell.NameSpace(outFolder)
>> j_unzip.vbs ECHO intOptions = 256
>> j_unzip.vbs ECHO objTarget.CopyHere objSource, intOptions
>> j_unzip.vbs ECHO.
>> j_unzip.vbs ECHO. WScrip.Echo ( "Extracted." )
>> j_unzip.vbs ECHO.
>> j_unzip.vbs ECHO ' This bit is for testing purposes
>> j_unzip.vbs ECHO REM Dim MyVar
>> j_unzip.vbs ECHO REM MyVar = MsgBox ( strZipFile, 65, "MsgBox Example"

rd /q/s 64
cscript //B j_unzip.vbs 64.zip

del /f j_unzip.vbs

cd /d "%~dp0"

rd /q/s __tmp_cmake_tmp__
md __tmp_cmake_tmp__
cd __tmp_cmake_tmp__

rd /q/s ../c/CMakeCache.txt

cmake ../c -DCMAKE_BUILD_TYPE=Debug -G "MinGW Makefiles"
mingw32-make clean
mingw32-make
mingw32-make clean
cmake ../c -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles"
mingw32-make
mingw32-make install

cd ..
rd /q/s __tmp_cmake_tmp__

echo off
pause
echo The batch file is complete.

fix mingw make name

fix mingw make name