@echo off

echo Building Dep...

echo Compiling libevent
"..\\Tool\\7z.exe" x libevent-2.0.22-stable.tar.gz -Y
"..\\Tool\\7z.exe" x libevent-2.0.22-stable.tar -Y
del libevent-2.0.22-stable.tar

if exist libevent rd /S /Q libevent
rename libevent-2.0.22-stable libevent
rd /S /Q libevent-2.0.22-stable

echo extract libevent libs
"..\\Tool\\7z.exe" x libevent_libs.zip -Y
copy lib\\Release\\libevent.a lib\\Debug\\ /Y
copy lib\\Release\\libevent.lib lib\\Debug\\ /Y
copy lib\\Release\\libevent_core.a lib\\Debug\\ /Y
copy lib\\Release\\libevent_core.lib lib\\Debug\\ /Y

@echo off

echo Building Dep...

echo Compiling libevent
"..\\Tool\\7z.exe" x libevent-release-2.1.8-stable.zip -Y

rd libevent  /q /s
rename libevent-release-2.1.8-stable libevent

echo Compiling evpp
"..\\Tool\\7z.exe" x evpp.zip -Y -o./evpp

echo Compiling glog
"..\\Tool\\7z.exe" x glog-0.3.5.zip -Y

rd glog  /q /s
rename glog-0.3.5 glog

fix build script

fix build script

Former-commit-id: 460f1915f26270fce47fa6efb139329a82132a70
Former-commit-id: 7bc40e7b6a451639e111eb4241aab2dd9f7ea970 [formerly 6f237cdb0beefca95d085cafd1515ea7e9c2bae6] [formerly c7394c6ca62910a9b9382a2a892926eafb055b22 [formerly 73248d2310378762bd99f9710c2a651f1f1560aa]]
Former-commit-id: a2118c009ce8bb22837f129bc0c3bd1125e77586 [formerly 60c4d121491feecdb13e1977aad127935d32cc7b]
Former-commit-id: 0dc3b4318f07a15c95fa61e59a6eb47e0e735fe0
Former-commit-id: 954c5437439a635c58f10ec156aa264908fdf49e


@echo off
setlocal

set CURRENT_SCRIPT_DIR=%~dp0
set DIRNAME=%CURRENT_SCRIPT_DIR%..
cd %DIRNAME%

:: if "/q" is given, hide the error dialogs (hence make the script non-interactive)
if /i not -%1-==-/q- (
  goto :skip_hide_error
)
echo Hide error dialogs
call :getDontShowUI
if %DONTSHOWUI_VALUE% equ 0 call :setDontShowUI 1
:skip_hide_error

:: Get current PID
type NUL > pid.log
wmic PROCESS where "Name='WMIC.exe'" get ParentProcessId >pid.log 2>&1
for /F "TOKENS=1" %%b in ('type pid.log ^| findstr [0-9]') do set CURRENT_PID=%%b

:: setup the otbenv
call otbenv.cmd

del selftest_report.log
type NUL > selftest_report.log
call :nb_report_lines
set REF_SIZE=%nb_report_lines_out%
:: -----------------------------------------------------------------------------------
rem Check 1 : check binaries
for /R %%i in (*.dll) do (
  call :check_binary %%i
)
for %%i in (bin\mapla.exe,bin\monteverdi.exe,bin\otbApplicationLauncherCommandLine.exe,bin\otbApplicationLauncherQt.exe) do (
  call :check_binary %%i
)
call :check_binary lib\python\_otbApplication.pyd

call :nb_report_lines
if %nb_report_lines_out% gtr %REF_SIZE% (
  echo Check 1/3 : FAIL
) else (
  echo Check 1/3 : PASS
)
set REF_SIZE=%nb_report_lines_out%
:: -----------------------------------------------------------------------------------
rem Check 2 : check applications and Python wrapping
set /a app_count=0
for /R %%i in (lib\otb\applications\otbapp_*.dll) do (
  call :check_application %%i
)
if %app_count% leq 90 (
  echo WARNING: only %app_count% applications found ! Expected at least 90
)
call :check_python_wrapping

call :nb_report_lines
if %nb_report_lines_out% gtr %REF_SIZE% (
  echo Check 2/3 : FAIL
) else (
  echo Check 2/3 : PASS
)
set REF_SIZE=%nb_report_lines_out%
:: -----------------------------------------------------------------------------------
rem Check 3 : check monteverdi & mapla
call :check_desktop_app monteverdi
call :check_desktop_app mapla 20

call :nb_report_lines
if %nb_report_lines_out% gtr %REF_SIZE% (
  echo Check 3/3 : FAIL
) else (
  echo Check 3/3 : PASS
)

if /i not -%1-==-/q- (
  goto :skip_restore_error
)
if %DONTSHOWUI_VALUE% equ 0 call :setDontShowUI 0
:skip_restore_error
del pid.log
del tmp.log
endlocal
goto :eof

::########################[ FUNCTIONS ]##################################
:check_binary
setlocal
type NUL > tmp.log
bin\otb_loader.exe %1 > tmp.log 2>&1
call :nb_tmp_lines
if %nb_tmp_lines_out% gtr 0 (
  echo ERROR : otb_loader.exe %1
  echo otb_loader.exe %1 >> selftest_report.log
  type tmp.log >> selftest_report.log
)
endlocal
goto :eof
::-----------------------------------------------------------------------
:check_application
setlocal
set dll_path=%~n1
set app=%dll_path:~7%
if not exist bin\otbcli_%app%.bat (
  echo ERROR : missing cli launcher for application %app%
  echo ERROR : missing cli launcher for application %app% >> selftest_report.log
  goto :check_gui
)
type NUL > tmp.log
cmd /C bin\otbcli_%app%.bat "-help" ^> tmp.log ^2^>^&^1
call :parse_cli_output
if %parse_cli_result% equ 0 (
  echo ERROR : error launching application otbcli_%app%
  echo ERROR : error launching application otbcli_%app% >> selftest_report.log
  type tmp.log >> selftest_report.log
)
:check_gui
if not exist bin\otbgui_%app%.bat (
  echo ERROR : missing gui launcher for application %app%
  echo ERROR : missing gui launcher for application %app% >> selftest_report.log
  goto :check_application_end
)
if %app_count% geq 2 goto :check_application_end
type NUL > tmp.log
start /b bin\otbgui_%app%.bat ^> tmp.log ^2^>^&^1
timeout 5 >nul
call :get_child_pid %CURRENT_PID% cmd.exe
set first_child=0
if %child_pid% gtr 1 (
  set first_child=%child_pid%
) else (
  echo ERROR : could not launch otbgui_%app%
  echo ERROR : could not launch otbgui_%app% >> selftest_report.log
  type tmp.log >> selftest_report.log
  goto :check_application_clean
)
call :get_child_pid %first_child% otbApplicationLauncherQt.exe
if not %child_pid% gtr 1 (
  echo ERROR : could not launch otbApplicationLauncherQt %app%
  echo ERROR : could not launch otbApplicationLauncherQt %app% >> selftest_report.log
  type tmp.log >> selftest_report.log
)
:check_application_clean
if not %first_child% == 0 (
  taskkill /PID %first_child% /F /T > NUL 2>&1
)
:check_application_end
endlocal & set /a app_count=app_count+1
goto :eof
::-----------------------------------------------------------------------
:check_desktop_app
setlocal
set appName=%1
set delay=5
if not -%2-==-- set delay=%2
type NUL > tmp.log
start /b bin\%appName%.exe > tmp.log 2>&1
timeout %delay% >nul
call :get_child_pid %CURRENT_PID% %appName%.exe
if %child_pid% gtr 1 (
  taskkill /PID %child_pid% /F /T > NUL 2>&1
) else (
  echo ERROR : could not launch %appName%.exe
  echo ERROR : could not launch %appName%.exe >> selftest_report.log
  type tmp.log >> selftest_report.log
)
endlocal
goto :eof
::-----------------------------------------------------------------------
:check_python_wrapping
setlocal
type NUL > tmp.log
python -c "import otbApplication" > tmp.log 2>&1
call :nb_tmp_lines
if %nb_tmp_lines_out% gtr 0 (
  echo ERROR : failed to run python wrapping
  echo ERROR : failed to run python wrapping >> selftest_report.log
  type tmp.log >> selftest_report.log
)
endlocal
goto :eof
::-----------------------------------------------------------------------
:parse_cli_output
setlocal
set /a ret=1
for /F %%a in ('findstr /n /r /c:"^This is the %app% application, version " tmp.log') do set output=%%a
if not "%output%" gtr "1:" (
  set /a ret=0
  goto :parse_cli_output_end
)
set output=
for /F %%a in ('findstr /n /r /c:"^Parameters:" tmp.log') do set output=%%a
if not "%output%" gtr "3:" (
  set /a ret=0
  goto :parse_cli_output_end
)
set output=
for /F %%a in ('findstr /n /r /c:"^Examples:" tmp.log') do set output=%%a
if not "%output%" gtr "1" (
  set /a ret=0
  goto :parse_cli_output_end
)
set output=
for /F %%a in ('findstr /n /r /c:"FATAL" tmp.log') do set output=%%a
if "%output%" gtr "1" (
  set /a ret=0
  goto :parse_cli_output_end
)
:parse_cli_output_end
endlocal & set /a parse_cli_result=%ret%
goto :eof
::-----------------------------------------------------------------------
:nb_report_lines
setlocal
for /F "delims=" %%i in ('find /C /V "" ^< selftest_report.log') do set output=%%i
endlocal & set nb_report_lines_out=%output%
goto :eof
::-----------------------------------------------------------------------
:nb_tmp_lines
setlocal
for /F "delims=" %%i in ('find /C /V "" ^< tmp.log') do set output=%%i
endlocal & set nb_tmp_lines_out=%output%
goto :eof
::-----------------------------------------------------------------------
:get_child_pid
setlocal
set parent_pid=%1
set process_name=%2
set output=0
type NUL > pid.log
wmic PROCESS where (ParentProcessId=%parent_pid% AND Name="%process_name%") get ProcessId >pid.log 2>&1
for /F "TOKENS=1" %%a in ('type pid.log ^| findstr [0-9]') do set output=%%a
endlocal & set child_pid=%output%
goto :eof
::-----------------------------------------------------------------------
:getDontShowUI
setlocal
set output=0
for /F "TOKENS=3" %%a in ('reg query "HKCU\Software\Microsoft\Windows\Windows Error Reporting" /v DontShowUI ^| findstr DontShowUI') do set output=%%a
endlocal & set DONTSHOWUI_VALUE=%output:~2%
goto :eof
::-----------------------------------------------------------------------
:setDontShowUI
setlocal
reg add "HKCU\Software\Microsoft\Windows\Windows Error Reporting" /v DontShowUI /t REG_DWORD /d %1 /f
endlocal
goto :eof

@echo off
setlocal

set CURRENT_SCRIPT_DIR=%~dp0
set DIRNAME=%CURRENT_SCRIPT_DIR%..
cd %DIRNAME%

:: if "/q" is given, hide the error dialogs (hence make the script non-interactive)
if /i not -%1-==-/q- (
  goto :skip_hide_error
)
echo Hide error dialogs
call :getDontShowUI
if %DONTSHOWUI_VALUE% equ 0 call :setDontShowUI 1
:skip_hide_error

:: Get current PID
type NUL > pid.log
wmic PROCESS where "Name='WMIC.exe'" get ParentProcessId >pid.log 2>&1
for /F "TOKENS=1" %%b in ('type pid.log ^| findstr [0-9]') do set CURRENT_PID=%%b

:: setup the otbenv
call otbenv.cmd

del selftest_report.log
type NUL > selftest_report.log
call :nb_report_lines
set REF_SIZE=%nb_report_lines_out%
:: -----------------------------------------------------------------------------------
rem Check 1 : check binaries
for /R %%i in (*.dll) do (
  call :check_binary %%i
)
for %%i in (bin\mapla.exe,bin\monteverdi.exe,bin\otbApplicationLauncherCommandLine.exe,bin\otbApplicationLauncherQt.exe) do (
  call :check_binary %%i
)
call :check_binary lib\python\_otbApplication.pyd

call :nb_report_lines
if %nb_report_lines_out% gtr %REF_SIZE% (
  echo Check 1/3 : FAIL
) else (
  echo Check 1/3 : PASS
)
set REF_SIZE=%nb_report_lines_out%
:: -----------------------------------------------------------------------------------
rem Check 2 : check applications and Python wrapping
set /a app_count=0
for /R %%i in (lib\otb\applications\otbapp_*.dll) do (
  call :check_application %%i
)
if %app_count% leq 90 (
  echo WARNING: only %app_count% applications found ! Expected at least 90
)
call :check_python_wrapping

call :nb_report_lines
if %nb_report_lines_out% gtr %REF_SIZE% (
  echo Check 2/3 : FAIL
) else (
  echo Check 2/3 : PASS
)
set REF_SIZE=%nb_report_lines_out%
:: -----------------------------------------------------------------------------------
rem Check 3 : check monteverdi & mapla
call :check_desktop_app monteverdi
call :check_desktop_app mapla 20

call :nb_report_lines
if %nb_report_lines_out% gtr %REF_SIZE% (
  echo Check 3/3 : FAIL
) else (
  echo Check 3/3 : PASS
)

if /i not -%1-==-/q- (
  goto :skip_restore_error
)
if %DONTSHOWUI_VALUE% equ 0 call :setDontShowUI 0
:skip_restore_error
del pid.log
del tmp.log
endlocal
goto :eof

::########################[ FUNCTIONS ]##################################
:check_binary
setlocal
type NUL > tmp.log
bin\otb_loader.exe %1 > tmp.log 2>&1
call :nb_tmp_lines
if %nb_tmp_lines_out% gtr 0 (
  echo ERROR : otb_loader.exe %1
  echo otb_loader.exe %1 >> selftest_report.log
  type tmp.log >> selftest_report.log
)
endlocal
goto :eof
::-----------------------------------------------------------------------
:check_application
setlocal
set dll_path=%~n1
set app=%dll_path:~7%
if not exist bin\otbcli_%app%.bat (
  echo ERROR : missing cli launcher for application %app%
  echo ERROR : missing cli launcher for application %app% >> selftest_report.log
  goto :check_gui
)
type NUL > tmp.log
cmd /C bin\otbcli_%app%.bat "-help" ^> tmp.log ^2^>^&^1
call :parse_cli_output
if %parse_cli_result% equ 0 (
  echo ERROR : error launching application otbcli_%app%
  echo ERROR : error launching application otbcli_%app% >> selftest_report.log
  type tmp.log >> selftest_report.log
)
:check_gui
if not exist bin\otbgui_%app%.bat (
  echo ERROR : missing gui launcher for application %app%
  echo ERROR : missing gui launcher for application %app% >> selftest_report.log
  goto :check_application_end
)
if %app_count% geq 2 goto :check_application_end
type NUL > tmp.log
start "otbgui application" /b bin\otbgui_%app%.bat ^> tmp.log ^2^>^&^1
timeout 5 >nul
call :get_child_pid %CURRENT_PID% cmd.exe
set first_child=0
if %child_pid% gtr 1 (
  set first_child=%child_pid%
) else (
  echo ERROR : could not launch otbgui_%app%
  echo ERROR : could not launch otbgui_%app% >> selftest_report.log
  type tmp.log >> selftest_report.log
  goto :check_application_clean
)
call :get_child_pid %first_child% otbApplicationLauncherQt.exe
if not %child_pid% gtr 1 (
  echo ERROR : could not launch otbApplicationLauncherQt %app%
  echo ERROR : could not launch otbApplicationLauncherQt %app% >> selftest_report.log
  type tmp.log >> selftest_report.log
)
:check_application_clean
if not %first_child% == 0 (
  taskkill /PID %first_child% /F /T > NUL 2>&1
)
:check_application_end
endlocal & set /a app_count=app_count+1
goto :eof
::-----------------------------------------------------------------------
:check_desktop_app
setlocal
set appName=%1
set delay=5
if not -%2-==-- set delay=%2
type NUL > tmp.log
start "Desktop app" /b bin\%appName%.exe > tmp.log 2>&1
timeout %delay% >nul
call :get_child_pid %CURRENT_PID% %appName%.exe
if %child_pid% gtr 1 (
  taskkill /PID %child_pid% /F /T > NUL 2>&1
) else (
  echo ERROR : could not launch %appName%.exe
  echo ERROR : could not launch %appName%.exe >> selftest_report.log
  type tmp.log >> selftest_report.log
)
endlocal
goto :eof
::-----------------------------------------------------------------------
:check_python_wrapping
setlocal
type NUL > tmp.log
python -c "import otbApplication" > tmp.log 2>&1
call :nb_tmp_lines
if %nb_tmp_lines_out% gtr 0 (
  echo ERROR : failed to run python wrapping
  echo ERROR : failed to run python wrapping >> selftest_report.log
  type tmp.log >> selftest_report.log
)
endlocal
goto :eof
::-----------------------------------------------------------------------
:parse_cli_output
setlocal
set /a ret=1
for /F %%a in ('findstr /n /r /c:"^This is the %app% application, version " tmp.log') do set output=%%a
if not "%output%" gtr "1:" (
  set /a ret=0
  goto :parse_cli_output_end
)
set output=
for /F %%a in ('findstr /n /r /c:"^Parameters:" tmp.log') do set output=%%a
if not "%output%" gtr "3:" (
  set /a ret=0
  goto :parse_cli_output_end
)
set output=
for /F %%a in ('findstr /n /r /c:"^Examples:" tmp.log') do set output=%%a
if not "%output%" gtr "1" (
  set /a ret=0
  goto :parse_cli_output_end
)
set output=
for /F %%a in ('findstr /n /r /c:"FATAL" tmp.log') do set output=%%a
if "%output%" gtr "1" (
  set /a ret=0
  goto :parse_cli_output_end
)
:parse_cli_output_end
endlocal & set /a parse_cli_result=%ret%
goto :eof
::-----------------------------------------------------------------------
:nb_report_lines
setlocal
for /F "delims=" %%i in ('find /C /V "" ^< selftest_report.log') do set output=%%i
endlocal & set nb_report_lines_out=%output%
goto :eof
::-----------------------------------------------------------------------
:nb_tmp_lines
setlocal
for /F "delims=" %%i in ('find /C /V "" ^< tmp.log') do set output=%%i
endlocal & set nb_tmp_lines_out=%output%
goto :eof
::-----------------------------------------------------------------------
:get_child_pid
setlocal
set parent_pid=%1
set process_name=%2
set output=0
type NUL > pid.log
wmic PROCESS where (ParentProcessId=%parent_pid% AND Name="%process_name%") get ProcessId >pid.log 2>&1
for /F "TOKENS=1" %%a in ('type pid.log ^| findstr [0-9]') do set output=%%a
endlocal & set child_pid=%output%
goto :eof
::-----------------------------------------------------------------------
:getDontShowUI
setlocal
set output=0
for /F "TOKENS=3" %%a in ('reg query "HKCU\Software\Microsoft\Windows\Windows Error Reporting" /v DontShowUI ^| findstr DontShowUI') do set output=%%a
endlocal & set DONTSHOWUI_VALUE=%output:~2%
goto :eof
::-----------------------------------------------------------------------
:setDontShowUI
setlocal
reg add "HKCU\Software\Microsoft\Windows\Windows Error Reporting" /v DontShowUI /t REG_DWORD /d %1 /f
endlocal
goto :eof

ENH: add a title to applications launched by start


echo off
REM
REM This Windows batch file builds this repository for the following targets:
REM 64/32-bit Release/Debug
REM It uses CMake to genererate the project files and then invokes msbuild
REM to build them.
REM The update_external_sources.bat batch file must be executed before running
REM this batch file
REM
REM Arguments:
REM None: Runs CMake and builds all 4 combinations
REM Argument contains:
REM     cmake (case insensitive): Deletes build and build32 and runs just CMake on both
REM     32: Deletes build32, runs CMake and builds 32-bit versions
REM     64: Deletes build, runs CMake and builds 64-bit versions
REM Example:
REM build_windows_targets.bat 64
REM deletes build, creates build, runs CMake and compiles 64-bit Debug and Release.

set do_cmake=0
set do_32=1
set do_64=1
if "%1"=="" goto no_args
set do_cmake=0
set do_32=0
set do_64=0
for %%a in (%*) do (
    echo.%%a | %WINDIR%\system32\find.exe /I "cmake">Nul && (set do_cmake=1)
    echo.%%a | %WINDIR%\system32\find.exe "32">Nul && (set do_32=1)
    echo.%%a | %WINDIR%\system32\find.exe "64">Nul && (set do_64=1)
)
:no_args
if %do_cmake%==0 (
    if %do_32%==0 (
        if %do_64%==0 (
            echo No valid parameters specified.
            exit /B 1
        )
    )
)

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

if %do_cmake%==1 (
    rmdir /Q /S build
    rmdir /Q /S build32
    mkdir build
    pushd build
    echo Generating 64-bit CMake files for Visual Studio %VS_VERSION%
    cmake -G "Visual Studio %VS_VERSION% Win64" ..
    popd
    mkdir build32
    pushd build32
    echo Generating 32-bit CMake files for Visual Studio %VS_VERSION%
    cmake -G "Visual Studio %VS_VERSION%" ..
    popd
)

REM *******************************************
REM 64-bit build
REM *******************************************
if %do_64%==1 (
    rmdir /Q /S build
    mkdir build
    pushd build
    echo Generating 64-bit CMake files for Visual Studio %VS_VERSION%
    cmake -G "Visual Studio %VS_VERSION% Win64" ..
    echo Building 64-bit Debug
    msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Debug /verbosity:quiet
    if errorlevel 1 (
       echo.
       echo 64-bit Debug build failed!
       popd
       exit /B 1
    )

echo Building 64-bit Debug
REM msbuild doesn't seem to see the dependency between the Overlay sample and layer_utils
cd layers
msbuild generate_vk_layer_helpers.vcxproj /p:Platform=x64 /p:Configuration=Debug /verbosity:quiet
msbuild layer_utils_static.vcxproj /p:Platform=x64 /p:Configuration=Debug /verbosity:quiet
cd ..
msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Debug /verbosity:quiet
if errorlevel 1 (
   echo.
   echo 64-bit Debug build failed!
   popd
   exit /B 1
)

echo Building 64-bit Release
REM msbuild doesn't seem to see the dependency between the Overlay sample and layer_utils
cd layers
msbuild generate_vk_layer_helpers.vcxproj /p:Platform=x64 /p:Configuration=Release /verbosity:quiet
msbuild layer_utils_static.vcxproj /p:Platform=x64 /p:Configuration=Release /verbosity:quiet
cd ..
msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Release /verbosity:quiet
if errorlevel 1 (
   echo.
   echo 64-bit Release build failed!
   popd
   exit /B 1
)
popd

REM *******************************************
REM 32-bit build
REM *******************************************

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

echo Building 32-bit Debug
REM msbuild doesn't seem to see the dependency between the Overlay sample and layer_utils
cd layers
msbuild generate_vk_layer_helpers.vcxproj /p:Platform=x86 /p:Configuration=Debug /verbosity:quiet
msbuild layer_utils_static.vcxproj /p:Platform=x86 /p:Configuration=Debug /verbosity:quiet
cd ..
msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Debug /verbosity:quiet
if errorlevel 1 (
   echo.
   echo 32-bit Debug build failed!
   popd
   exit /B 1
)

echo Building 32-bit Release
REM msbuild doesn't seem to see the dependency between the Overlay sample and layer_utils
cd layers
msbuild generate_vk_layer_helpers.vcxproj /p:Platform=x86 /p:Configuration=Release /verbosity:quiet
msbuild layer_utils_static.vcxproj /p:Platform=x86 /p:Configuration=Release /verbosity:quiet
cd ..

echo Building 32-bit Release
msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Release /verbosity:quiet
if errorlevel 1 (
   echo.
   echo 32-bit Release build failed!
   popd
   exit /B 1
)

popd
exit /b 0

echo off
REM
REM This Windows batch file builds this repository for the following targets:
REM 64/32-bit Release/Debug
REM It uses CMake to genererate the project files and then invokes msbuild
REM to build them.
REM The update_external_sources.bat batch file must be executed before running
REM this batch file
REM
REM Arguments:
REM None: Runs CMake and builds all 4 combinations
REM Argument contains:
REM     cmake (case insensitive): Deletes build and build32 and runs just CMake on both
REM     32: Deletes build32, runs CMake and builds 32-bit versions
REM     64: Deletes build, runs CMake and builds 64-bit versions
REM Example:
REM build_windows_targets.bat 64
REM deletes build, creates build, runs CMake and compiles 64-bit Debug and Release.

set do_cmake=0
set do_32=1
set do_64=1
if "%1"=="" goto no_args
set do_cmake=0
set do_32=0
set do_64=0
for %%a in (%*) do (
    echo.%%a | %WINDIR%\system32\find.exe /I "cmake">Nul && (set do_cmake=1)
    echo.%%a | %WINDIR%\system32\find.exe "32">Nul && (set do_32=1)
    echo.%%a | %WINDIR%\system32\find.exe "64">Nul && (set do_64=1)
)
:no_args
if %do_cmake%==0 (
    if %do_32%==0 (
        if %do_64%==0 (
            echo No valid parameters specified.
            exit /B 1
        )
    )
)

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

if %do_cmake%==1 (
    if %do_64%==1 (
        rmdir /Q /S build
        mkdir build
        pushd build
        echo Generating 64-bit CMake files for Visual Studio %VS_VERSION%
        cmake -G "Visual Studio %VS_VERSION% Win64" ..
        popd
    )
    if %do_32%==1 (
        rmdir /Q /S build32
        mkdir build32
        pushd build32
        echo Generating 32-bit CMake files for Visual Studio %VS_VERSION%
        cmake -G "Visual Studio %VS_VERSION%" ..
        popd
    )
)

REM *******************************************
REM 64-bit build
REM *******************************************
if %do_64%==1 (
    pushd build

    echo Building 64-bit Debug
    REM msbuild doesn't seem to see the dependency between the Overlay sample and layer_utils
    pushd layers
    msbuild generate_vk_layer_helpers.vcxproj /p:Platform=x64 /p:Configuration=Debug /verbosity:quiet
    msbuild VkLayer_utils.vcxproj /p:Platform=x64 /p:Configuration=Debug /verbosity:quiet
    popd
    msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Debug /verbosity:quiet
    if errorlevel 1 (
       echo.
       echo 64-bit Debug build failed!
       popd
       exit /B 1
    )

    echo Building 64-bit Release
    REM msbuild doesn't seem to see the dependency between the Overlay sample and layer_utils
    pushd layers
    msbuild generate_vk_layer_helpers.vcxproj /p:Platform=x64 /p:Configuration=Release /verbosity:quiet
    msbuild VkLayer_utils.vcxproj /p:Platform=x64 /p:Configuration=Release /verbosity:quiet
    popd
    msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Release /verbosity:quiet
    if errorlevel 1 (
       echo.
       echo 64-bit Release build failed!
       popd
       exit /B 1
    )

    popd
)

REM *******************************************
REM 32-bit build
REM *******************************************
if %do_32%==1 (
    pushd build32

    echo Building 32-bit Debug
    REM msbuild doesn't seem to see the dependency between the Overlay sample and layer_utils
    pushd layers
    msbuild generate_vk_layer_helpers.vcxproj /p:Platform=x86 /p:Configuration=Debug /verbosity:quiet
    msbuild VkLayer_utils.vcxproj /p:Platform=x86 /p:Configuration=Debug /verbosity:quiet
    popd
    msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Debug /verbosity:quiet
    if errorlevel 1 (
       echo.
       echo 32-bit Debug build failed!
       popd
       exit /B 1
    )

    echo Building 32-bit Release
    REM msbuild doesn't seem to see the dependency between the Overlay sample and layer_utils
    pushd layers
    msbuild generate_vk_layer_helpers.vcxproj /p:Platform=x86 /p:Configuration=Release /verbosity:quiet
    msbuild VkLayer_utils.vcxproj /p:Platform=x86 /p:Configuration=Release /verbosity:quiet
    popd
    msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Release /verbosity:quiet
    if errorlevel 1 (
       echo.
       echo 32-bit Release build failed!
       popd
       exit /B 1
    )

    popd
)

exit /b 0

Fix build_windows_target batch file

samples: Fix build_windows_target batch file

Change-Id: I066d75a12ebf6e690af6e4e1625a78799079b2d0


REM
REM Copyright (C) 2011-13, DyND Developers
REM BSD 2-Clause License, see LICENSE.txt
REM
REM This is the master windows build + test script for building
REM the dynd python bindings on jenkins.
REM
REM Jenkins Requirements:
REM   - Anaconda should be installed and in the path
REM   - Use a jenkins build matrix for multiple
REM     platforms/python versions
REM   - Use the XShell plugin to launch this script
REM   - Call the script from the root workspace
REM     directory as ./jenkins/jenkins-build
REM   - Use a user-defined axis to select python versions with PYTHON_VERSION
REM

REM If no MSVC version is selected, choose 2010
if "%MSVC_VERSION%" == "" set MSVC_VERSION=10.0
REM Require a version of Python to be selected
if "%PYTHON_VERSION%" == "" exit /b 1

REM Jenkins has '/' in its workspace. Fix it to '\' to simplify the DOS commands.
set WORKSPACE=%WORKSPACE:/=\%

if "%PROCESSOR_ARCHITECTURE%" == "AMD64" goto :amd64
 set MSVC_VCVARS_PLATFORM=x86
 set MSVC_BUILD_PLATFORM=Win32
 if "%MSVC_VERSION%" == "9.0" set CMAKE_BUILD_TARGET="Visual Studio 9 2008"
 if "%MSVC_VERSION%" == "10.0" set CMAKE_BUILD_TARGET="Visual Studio 10"
 if "%MSVC_VERSION%" == "11.0" set CMAKE_BUILD_TARGET="Visual Studio 11"
goto :notamd64
:amd64
 set MSVC_VERSION=10.0
 set MSVC_VCVARS_PLATFORM=amd64
 set MSVC_BUILD_PLATFORM=x64
 set CMAKE_BUILD_TARGET="Visual Studio 10 Win64"
 if "%MSVC_VERSION%" == "9.0" set CMAKE_BUILD_TARGET="Visual Studio 9 2008 Win64"
 if "%MSVC_VERSION%" == "10.0" set CMAKE_BUILD_TARGET="Visual Studio 10 Win64"
 if "%MSVC_VERSION%" == "11.0" set CMAKE_BUILD_TARGET="Visual Studio 11 Win64"
:notamd64

REM Configure the appropriate visual studio command line environment
if "%PROGRAMFILES(X86)%" == "" set VCDIR=%PROGRAMFILES%\Microsoft Visual Studio %MSVC_VERSION%\VC
if NOT "%PROGRAMFILES(X86)%" == "" set VCDIR=%PROGRAMFILES(X86)%\Microsoft Visual Studio %MSVC_VERSION%\VC
call "%VCDIR%\vcvarsall.bat" %MSVC_VCVARS_PLATFORM%
IF %ERRORLEVEL% NEQ 0 exit /b 1
echo on

REM Remove the build subdirectory from last time
rd /q /s build

REM Get libdynd into the libraries subdirectory
REM TODO: Build libdynd in a separate jenkins project,
REM       and use its build artifact here.
call .\jenkins\checkout_libdynd.bat
IF %ERRORLEVEL% NEQ 0 exit /b 1

REM Use conda to create a conda environment of the required
REM python version and containing the dependencies.
SET PYENV_PREFIX=%WORKSPACE%\build\pyenv
call .\jenkins\create_conda_pyenv.bat %PYTHON_VERSION% %PYENV_PREFIX%
IF %ERRORLEVEL% NEQ 0 exit /b 1
echo on

REM Create a fresh visual studio solution with cmake, and do the build/install
cd build
cmake -DCMAKE_INSTALL_PREFIX=install -G %CMAKE_BUILD_TARGET% -DPYTHON_EXECUTABLE=%PYENV_PREFIX%\Python.exe ..
IF %ERRORLEVEL% NEQ 0 exit /b 1
devenv dynd-python.sln /Build "RelWithDebInfo|%MSVC_BUILD_PLATFORM%"
IF %ERRORLEVEL% NEQ 0 exit /b 1
devenv dynd-python.sln /Build "RelWithDebInfo|%MSVC_BUILD_PLATFORM%" /Project INSTALL
IF %ERRORLEVEL% NEQ 0 exit /b 1

REM Run the tests and generate xml results
python -c "import dynd;dynd.test(xunitfile='../test_results.xml', exit=1)"
IF %ERRORLEVEL% NEQ 0 exit /b 1

REM Get the version number and process it into a suitable form
FOR /F "delims=" %%i IN ('python -c "import dynd;print(dynd.__version_string__)"') DO set PYDYND_VERSION=%%i
set PYDYND_VERSION=%PYDYND_VERSION:-=_%
set PYDYND_VERSION=%PYDYND_VERSION:~1%

REM Put the conda package by itself in the directory pkgs/<anaconda-arch>
cd ..
rd /q /s pkgs
mkdir pkgs
cd pkgs
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" mkdir win-64
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" cd win-64
if NOT "%PROCESSOR_ARCHITECTURE%" == "AMD64" mkdir win-32
if NOT "%PROCESSOR_ARCHITECTURE%" == "AMD64" cd win-32

REM Create a conda package from the build
call conda package -p %PYENV_PREFIX% --pkg-name=dynd --pkg-version=%PYDYND_VERSION%
IF %ERRORLEVEL% NEQ 0 exit /b 1
echo on

cd ..

exit /b 0

REM
REM Copyright (C) 2011-13, DyND Developers
REM BSD 2-Clause License, see LICENSE.txt
REM
REM This is the master windows build + test script for building
REM the dynd python bindings on jenkins.
REM
REM Jenkins Requirements:
REM   - Anaconda should be installed and in the path
REM   - Use a jenkins build matrix for multiple
REM     platforms/python versions
REM   - Use the XShell plugin to launch this script
REM   - Call the script from the root workspace
REM     directory as ./jenkins/jenkins-build
REM   - Use a user-defined axis to select python versions with PYTHON_VERSION
REM

REM If no MSVC version is selected, choose 2010
if "%MSVC_VERSION%" == "" set MSVC_VERSION=10.0
REM Require a version of Python to be selected
if "%PYTHON_VERSION%" == "" exit /b 1

REM Jenkins has '/' in its workspace. Fix it to '\' to simplify the DOS commands.
set WORKSPACE=%WORKSPACE:/=\%

if "%PROCESSOR_ARCHITECTURE%" == "AMD64" goto :amd64
 set MSVC_VCVARS_PLATFORM=x86
 set MSVC_BUILD_PLATFORM=Win32
 if "%MSVC_VERSION%" == "9.0" set CMAKE_BUILD_TARGET="Visual Studio 9 2008"
 if "%MSVC_VERSION%" == "10.0" set CMAKE_BUILD_TARGET="Visual Studio 10"
 if "%MSVC_VERSION%" == "11.0" set CMAKE_BUILD_TARGET="Visual Studio 11"
goto :notamd64
:amd64
 set MSVC_VCVARS_PLATFORM=amd64
 set MSVC_BUILD_PLATFORM=x64
 if "%MSVC_VERSION%" == "9.0" set CMAKE_BUILD_TARGET="Visual Studio 9 2008 Win64"
 if "%MSVC_VERSION%" == "10.0" set CMAKE_BUILD_TARGET="Visual Studio 10 Win64"
 if "%MSVC_VERSION%" == "11.0" set CMAKE_BUILD_TARGET="Visual Studio 11 Win64"
:notamd64

REM Configure the appropriate visual studio command line environment
if "%PROGRAMFILES(X86)%" == "" set VCDIR=%PROGRAMFILES%\Microsoft Visual Studio %MSVC_VERSION%\VC
if NOT "%PROGRAMFILES(X86)%" == "" set VCDIR=%PROGRAMFILES(X86)%\Microsoft Visual Studio %MSVC_VERSION%\VC
call "%VCDIR%\vcvarsall.bat" %MSVC_VCVARS_PLATFORM%
IF %ERRORLEVEL% NEQ 0 exit /b 1
echo on

REM Remove the build subdirectory from last time
rd /q /s build

REM Get libdynd into the libraries subdirectory
REM TODO: Build libdynd in a separate jenkins project,
REM       and use its build artifact here.
call .\jenkins\checkout_libdynd.bat
IF %ERRORLEVEL% NEQ 0 exit /b 1

REM Use conda to create a conda environment of the required
REM python version and containing the dependencies.
SET PYENV_PREFIX=%WORKSPACE%\build\pyenv
call .\jenkins\create_conda_pyenv.bat %PYTHON_VERSION% %PYENV_PREFIX%
IF %ERRORLEVEL% NEQ 0 exit /b 1
echo on

REM Create a fresh visual studio solution with cmake, and do the build/install
cd build
cmake -DCMAKE_INSTALL_PREFIX=install -G %CMAKE_BUILD_TARGET% -DPYTHON_EXECUTABLE=%PYENV_PREFIX%\Python.exe ..
IF %ERRORLEVEL% NEQ 0 exit /b 1
devenv dynd-python.sln /Build "RelWithDebInfo|%MSVC_BUILD_PLATFORM%"
IF %ERRORLEVEL% NEQ 0 exit /b 1
devenv dynd-python.sln /Build "RelWithDebInfo|%MSVC_BUILD_PLATFORM%" /Project INSTALL
IF %ERRORLEVEL% NEQ 0 exit /b 1

REM Run the tests and generate xml results
python -c "import dynd;dynd.test(xunitfile='../test_results.xml', exit=1)"
IF %ERRORLEVEL% NEQ 0 exit /b 1

REM Get the version number and process it into a suitable form
FOR /F "delims=" %%i IN ('python -c "import dynd;print(dynd.__version_string__)"') DO set PYDYND_VERSION=%%i
set PYDYND_VERSION=%PYDYND_VERSION:-=_%
set PYDYND_VERSION=%PYDYND_VERSION:~1%

REM Put the conda package by itself in the directory pkgs/<anaconda-arch>
cd ..
rd /q /s pkgs
mkdir pkgs
cd pkgs
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" mkdir win-64
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" cd win-64
if NOT "%PROCESSOR_ARCHITECTURE%" == "AMD64" mkdir win-32
if NOT "%PROCESSOR_ARCHITECTURE%" == "AMD64" cd win-32

REM Create a conda package from the build
call conda package -p %PYENV_PREFIX% --pkg-name=dynd-python --pkg-version=%PYDYND_VERSION%
IF %ERRORLEVEL% NEQ 0 exit /b 1
echo on

cd ..

exit /b 0

Fix the conda package name on windows

Fix the conda package name on windows


@rem Licensed to the Apache Software Foundation (ASF) under one
@rem or more contributor license agreements.  See the NOTICE file
@rem distributed with this work for additional information
@rem regarding copyright ownership.  The ASF licenses this file
@rem to you under the Apache License, Version 2.0 (the
@rem "License"); you may not use this file except in compliance
@rem with the License.  You may obtain a copy of the License at
@rem
@rem   http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing,
@rem software distributed under the License is distributed on an
@rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@rem KIND, either express or implied.  See the License for the
@rem specific language governing permissions and limitations
@rem under the License.

@rem To run the script:
@rem verify-release-candidate.bat VERSION RC_NUM

@echo on

if not exist "C:\tmp\" mkdir C:\tmp
if exist "C:\tmp\arrow-verify-release" rd C:\tmp\arrow-verify-release /s /q
if not exist "C:\tmp\arrow-verify-release" mkdir C:\tmp\arrow-verify-release

set _VERIFICATION_DIR=C:\tmp\arrow-verify-release
set _VERIFICATION_DIR_UNIX=C:/tmp/arrow-verify-release
set _VERIFICATION_CONDA_ENV=%_VERIFICATION_DIR%\conda-env
set _DIST_URL=https://dist.apache.org/repos/dist/dev/arrow
set _TARBALL=apache-arrow-%1.tar.gz
set ARROW_SOURCE=%_VERIFICATION_DIR%\apache-arrow-%1
set INSTALL_DIR=%_VERIFICATION_DIR%\install

@rem Requires GNU Wget for Windows
wget --no-check-certificate -O %_TARBALL% %_DIST_URL%/apache-arrow-%1-rc%2/%_TARBALL% || exit /B 1

tar xf %_TARBALL% -C %_VERIFICATION_DIR_UNIX%

set PYTHON=3.6

@rem Using call with conda.bat seems necessary to avoid terminating the batch
@rem script execution
call conda create -p %_VERIFICATION_CONDA_ENV% ^
    --no-shortcuts -f -q -y python=%PYTHON% ^
    || exit /B 1

call activate %_VERIFICATION_CONDA_ENV% || exit /B 1

call conda install -y ^
     --no-shortcuts ^
     python=3.7 ^
     git ^
     --file=ci\conda_env_cpp.yml ^
     --file=ci\conda_env_python.yml ^
     -c conda-forge || exit /B 1

set GENERATOR=Visual Studio 15 2017 Win64
set CONFIGURATION=release

pushd %ARROW_SOURCE%

set ARROW_HOME=%INSTALL_DIR%
set PARQUET_HOME=%INSTALL_DIR%
set PATH=%INSTALL_DIR%\bin;%PATH%

@rem Build and test Arrow C++ libraries
mkdir %ARROW_SOURCE%\cpp\build
pushd %ARROW_SOURCE%\cpp\build

@rem This is the path for Visual Studio Community 2017
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64

@rem NOTE(wesm): not using Ninja for now to be able to more easily control the
@rem generator used

cmake -G "%GENERATOR%" ^
      -DCMAKE_INSTALL_PREFIX=%ARROW_HOME% ^
      -DARROW_BUILD_STATIC=OFF ^
      -DARROW_BOOST_USE_SHARED=ON ^
      -DARROW_BUILD_TESTS=ON ^
      -DGTest_SOURCE=BUNDLED ^
      -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
      -DCMAKE_UNITY_BUILD=ON ^
      -DARROW_CXXFLAGS="/MP" ^
      -DARROW_WITH_BZ2=ON ^
      -DARROW_WITH_ZLIB=ON ^
      -DARROW_WITH_ZSTD=ON ^
      -DARROW_WITH_LZ4=ON ^
      -DARROW_WITH_SNAPPY=ON ^
      -DARROW_WITH_BROTLI=ON ^
      -DARROW_FLIGHT=ON ^
      -DARROW_PYTHON=ON ^
      -DARROW_DATASET=ON ^
      -DARROW_PARQUET=ON ^
      ..  || exit /B

cmake --build . --target INSTALL --config Release || exit /B 1

@rem NOTE(wesm): Building googletest is flaky for me with ninja. Building it
@rem first fixes the problem

@rem ninja googletest_ep || exit /B 1
@rem ninja install || exit /B 1

@rem Get testing datasets for Parquet unit tests
git clone https://github.com/apache/parquet-testing.git %_VERIFICATION_DIR%\parquet-testing
set PARQUET_TEST_DATA=%_VERIFICATION_DIR%\parquet-testing\data

git clone https://github.com/apache/arrow-testing.git %_VERIFICATION_DIR%\arrow-testing
set ARROW_TEST_DATA=%_VERIFICATION_DIR%\arrow-testing\data

@rem Needed so python-test.exe works
set PYTHONPATH=%CONDA_PREFIX%\Lib;%CONDA_PREFIX%\Lib\site-packages;%CONDA_PREFIX%\python35.zip;%CONDA_PREFIX%\DLLs;%CONDA_PREFIX%;%PYTHONPATH%

ctest -VV  || exit /B 1
popd

@rem Build and import pyarrow
pushd %ARROW_SOURCE%\python

set PYARROW_CMAKE_GENERATOR=%GENERATOR%
set PYARROW_WITH_FLIGHT=1
set PYARROW_WITH_PARQUET=1
set PYARROW_WITH_DATASET=1
python setup.py build_ext --inplace --bundle-arrow-cpp bdist_wheel  || exit /B 1
py.test pyarrow -v -s --parquet || exit /B 1

popd

call deactivate

@rem Licensed to the Apache Software Foundation (ASF) under one
@rem or more contributor license agreements.  See the NOTICE file
@rem distributed with this work for additional information
@rem regarding copyright ownership.  The ASF licenses this file
@rem to you under the Apache License, Version 2.0 (the
@rem "License"); you may not use this file except in compliance
@rem with the License.  You may obtain a copy of the License at
@rem
@rem   http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing,
@rem software distributed under the License is distributed on an
@rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@rem KIND, either express or implied.  See the License for the
@rem specific language governing permissions and limitations
@rem under the License.

@rem To run the script:
@rem verify-release-candidate.bat VERSION RC_NUM

@echo on

if not exist "C:\tmp\" mkdir C:\tmp
if exist "C:\tmp\arrow-verify-release" rd C:\tmp\arrow-verify-release /s /q
if not exist "C:\tmp\arrow-verify-release" mkdir C:\tmp\arrow-verify-release

set _VERIFICATION_DIR=C:\tmp\arrow-verify-release
set _VERIFICATION_DIR_UNIX=C:/tmp/arrow-verify-release
set _VERIFICATION_CONDA_ENV=%_VERIFICATION_DIR%\conda-env
set _DIST_URL=https://dist.apache.org/repos/dist/dev/arrow
set _TARBALL=apache-arrow-%1.tar.gz
set ARROW_SOURCE=%_VERIFICATION_DIR%\apache-arrow-%1
set INSTALL_DIR=%_VERIFICATION_DIR%\install

@rem Requires GNU Wget for Windows
wget --no-check-certificate -O %_TARBALL% %_DIST_URL%/apache-arrow-%1-rc%2/%_TARBALL% || exit /B 1

tar xf %_TARBALL% -C %_VERIFICATION_DIR_UNIX%

set PYTHON=3.6

@rem Using call with conda.bat seems necessary to avoid terminating the batch
@rem script execution
call conda create -p %_VERIFICATION_CONDA_ENV% ^
    --no-shortcuts -f -q -y python=%PYTHON% ^
    || exit /B 1

call activate %_VERIFICATION_CONDA_ENV% || exit /B 1

call conda install -y ^
     --no-shortcuts ^
     python=3.7 ^
     git ^
     --file=ci\conda_env_cpp.yml ^
     --file=ci\conda_env_python.yml ^
     -c conda-forge || exit /B 1

set GENERATOR=Visual Studio 15 2017 Win64
set CONFIGURATION=release

pushd %ARROW_SOURCE%

set ARROW_HOME=%INSTALL_DIR%
set PARQUET_HOME=%INSTALL_DIR%
set PATH=%INSTALL_DIR%\bin;%PATH%

@rem Build and test Arrow C++ libraries
mkdir %ARROW_SOURCE%\cpp\build
pushd %ARROW_SOURCE%\cpp\build

@rem This is the path for Visual Studio Community 2017
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64

@rem NOTE(wesm): not using Ninja for now to be able to more easily control the
@rem generator used

cmake -G "%GENERATOR%" ^
      -DCMAKE_INSTALL_PREFIX=%ARROW_HOME% ^
      -DARROW_BUILD_STATIC=OFF ^
      -DARROW_BOOST_USE_SHARED=ON ^
      -DARROW_BUILD_TESTS=ON ^
      -DGTest_SOURCE=BUNDLED ^
      -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
      -DCMAKE_UNITY_BUILD=ON ^
      -DARROW_CXXFLAGS="/MP" ^
      -DARROW_WITH_BZ2=ON ^
      -DARROW_WITH_ZLIB=ON ^
      -DARROW_WITH_ZSTD=ON ^
      -DARROW_WITH_LZ4=ON ^
      -DARROW_WITH_SNAPPY=ON ^
      -DARROW_WITH_BROTLI=ON ^
      -DARROW_FLIGHT=ON ^
      -DARROW_PYTHON=ON ^
      -DARROW_DATASET=ON ^
      -DARROW_PARQUET=ON ^
      ..  || exit /B

cmake --build . --target INSTALL --config Release || exit /B 1

@rem NOTE(wesm): Building googletest is flaky for me with ninja. Building it
@rem first fixes the problem

@rem ninja googletest_ep || exit /B 1
@rem ninja install || exit /B 1

@rem Get testing datasets for Parquet unit tests
git clone https://github.com/apache/parquet-testing.git %_VERIFICATION_DIR%\parquet-testing
set PARQUET_TEST_DATA=%_VERIFICATION_DIR%\parquet-testing\data

git clone https://github.com/apache/arrow-testing.git %_VERIFICATION_DIR%\arrow-testing
set ARROW_TEST_DATA=%_VERIFICATION_DIR%\arrow-testing\data

@rem Needed so python-test.exe works
set PYTHONPATH=%CONDA_PREFIX%\Lib;%CONDA_PREFIX%\Lib\site-packages;%CONDA_PREFIX%\python35.zip;%CONDA_PREFIX%\DLLs;%CONDA_PREFIX%;%PYTHONPATH%

ctest -VV  || exit /B 1
popd

@rem Build and import pyarrow
pushd %ARROW_SOURCE%\python

set PYARROW_CMAKE_GENERATOR=%GENERATOR%
set PYARROW_WITH_FLIGHT=1
set PYARROW_WITH_PARQUET=1
set PYARROW_WITH_DATASET=1
python setup.py build_ext --inplace --bundle-arrow-cpp bdist_wheel  || exit /B 1
py.test pyarrow -v -s --enable-parquet || exit /B 1

popd

call deactivate

[MINOR][Release] Use --enable-parquet instead of --parquet in Windows RC verification script (#7250)


@echo off

echo Building dependencies...

if exist lib (rd lib /q /s)
md lib
cd lib
md Debug
md Release
cd ../
REM ######################################################################################################
echo Building protobuf...

if exist protobuf (rd protobuf /q /s)
git clone -b 2.7.0 https://github.com/google/protobuf.git

cd protobuf/cmake
md build
cd build
cmake -G "Visual Studio 14 Win64" -Dprotobuf_BUILD_SHARED_LIBS=ON -Dprotobuf_BUILD_TESTS=OFF ..
"%VS140COMNTOOLS%..\IDE\Devenv" protobuf.sln /build "Debug|x64"
"%VS140COMNTOOLS%..\IDE\Devenv" protobuf.sln /build "Release|x64"
copy Debug\*.dll ..\..\..\lib\Debug /Y
copy Debug\*.lib ..\..\..\lib\Debug /Y
copy Release\*.dll ..\..\..\lib\Release /Y
copy Release\*.lib ..\..\..\lib\Release /Y
cd ..\..\..\
REM ######################################################################################################
echo Building libevent...

if exist libevent (rd libevent /q /s)
git clone -b master https://github.com/libevent/libevent.git

cd libevent
md build
cd build
cmake -G "Visual Studio 14 Win64" -DEVENT__DISABLE_OPENSSL=ON ..
"%VS140COMNTOOLS%..\IDE\Devenv" libevent.sln /build "Debug|x64" /project event_core_static.vcxproj
"%VS140COMNTOOLS%..\IDE\Devenv" libevent.sln /build "Release|x64" /project event_core_static.vcxproj
"%VS140COMNTOOLS%..\IDE\Devenv" libevent.sln /build "Debug|x64" /project event_static.vcxproj
"%VS140COMNTOOLS%..\IDE\Devenv" libevent.sln /build "Release|x64" /project event_static.vcxproj
"%VS140COMNTOOLS%..\IDE\Devenv" libevent.sln /build "Debug|x64" /project event_extra_static.vcxproj
"%VS140COMNTOOLS%..\IDE\Devenv" libevent.sln /build "Release|x64" /project event_extra_static.vcxproj
copy lib\Debug\*.lib ..\..\lib\Debug /Y
copy lib\Release\*.lib ..\..\lib\Release /Y
cd ..\..\
REM ######################################################################################################
echo Building glog...
if exist glog (rd glog /q /s)
git clone -b v035 https://github.com/google/glog.git

cd glog
md build
cd build
cmake -G "Visual Studio 14 Win64" ..
"%VS140COMNTOOLS%..\IDE\Devenv" google-glog.sln /build "Debug|x64"
"%VS140COMNTOOLS%..\IDE\Devenv" google-glog.sln /build "Release|x64"
copy Debug\*.lib ..\..\lib\Debug /Y
copy Release\*.lib ..\..\lib\Release /Y
cd ..\..\
REM ######################################################################################################
echo Building evpp...

if exist evpp (rd evpp /q /s)
git clone -b master https://github.com/ArkGame/evpp.git

cd evpp
cd vsprojects
"%VS140COMNTOOLS%..\IDE\Devenv" libevpp.sln /build "Debug|x64" /project evpp_static.vcxproj
"%VS140COMNTOOLS%..\IDE\Devenv" libevpp.sln /build "Release|x64" /project evpp_static.vcxproj
cd ..\..\
REM ####################################################################################################
REM back to root dir
cd ../

@echo off

echo Building dependencies...

echo Building evpp...

cd evpp
cd vsprojects
"%VS140COMNTOOLS%..\IDE\Devenv" libevpp.sln /build "Debug|x64" /project libevpp.vcxproj
"%VS140COMNTOOLS%..\IDE\Devenv" libevpp.sln /build "Release|x64" /project libevpp.vcxproj
cd ..\..\
REM ####################################################################################################
REM back to root dir
cd ../

modify evpp build bat

modify evpp build bat

Former-commit-id: 9ec454225ae5023c63697a7ec92c85b128b8c8dd
Former-commit-id: c7f78811efc4cb8355da04864170e579e975b16c
Former-commit-id: 65d7d3bf078d96dcba516528460182db56373722


@echo off
::
:: autobuild.bat
::
:: run with params:
::    -u [optional]  - to force a CVS update of Spring source
::    -k [optional]  - to keepalive the server(s) after tests have run
::    application    - the sample app to build and test
::    server         - the target server to deploy upon
::
:: $Id: autobuild.bat,v 1.4 2004-01-19 20:19:17 davison Exp $
::
:: ---------------------------------------------------------------------------

set USAGE="Usage: %0 [-u] sample-app target-server"

:: ---------------------------------------------------------------------------

:chkprops
    if not exist build.properties echo "*** NO build.properties FILE!  DEFAULT VALUES WILL BE USED ***"
    goto getopts

:getopts
    if "%1" == "" goto begin
    set NEWARG=
    if %1 == -u set NEWARG=-Dcvs.update=yes
    if %1 == -k set NEWARG=-Dautobuilds.keepalive=yes

    if (%NEWARG%) == () goto getparams
    if not (%NEWARG%) == () set ALLPROPS=%ALLPROPS% %NEWARG%
    shift
    goto getopts

:getparams
    if (%APP%) == () set APP=%1
    if (%SERVER%) == () set SERVER=%1
    if %SERVER% == %APP% set SERVER=%1
    shift
    goto getopts

:begin
    if (%SERVER%) == () goto usage
    if (%APP%) == () goto usage
    if not exist %SERVER%-build.xml goto noserver
    if not exist ..\apps\%APP% goto noapp

::  ensure environment exists for 1st use
    ant -q setup
    echo Please see the file %BUILDLOG% for build logging and unit test results
    ant %ALLPROPS% main
    goto end

:noserver
    echo Don't know about server %SERVER%
    goto end

:noapp
    echo Can't find application %APP% or application is not configured for autobuilds
    goto end

:usage
    echo %USAGE%
    goto end

:end
    set USAGE=
    set NEWARG=
    set APP=
    set SERVER=
    set ALLPROPS=
    exit

@echo off
::
:: autobuild.bat
::
:: run with params:
::    -u [optional]  - to force a CVS update of Spring source
::    -k [optional]  - to keepalive the server(s) after tests have run
::    application    - the sample app to build and test
::    server         - the target server to deploy upon
::
:: $Id: autobuild.bat,v 1.5 2004-04-16 20:35:37 colins Exp $
::
:: ---------------------------------------------------------------------------

set USAGE="Usage: %0 [-u] sample-app target-server"

:: ---------------------------------------------------------------------------

:chkprops
    if not exist build.properties echo "*** NO build.properties FILE!  DEFAULT VALUES WILL BE USED ***"
    goto getopts

:getopts
    if "%1" == "" goto begin
    set NEWARG=
    if %1 == -u set NEWARG=-Dcvs.update=yes
    if %1 == -k set NEWARG=-Dautobuilds.keepalive=yes

    if (%NEWARG%) == () goto getparams
    if not (%NEWARG%) == () set ALLPROPS=%ALLPROPS% %NEWARG%
    shift
    goto getopts

:getparams
    if (%APP%) == () set APP=%1
    if (%SERVER%) == () set SERVER=%1
    if %SERVER% == %APP% set SERVER=%1
    shift
    goto getopts

:begin
    if (%SERVER%) == () goto usage
    if (%APP%) == () goto usage
    if not exist %SERVER%-build.xml goto noserver
    if not exist ..\apps\%APP% goto noapp

::  ensure environment exists for 1st use
    call ant -q setup
    echo Please see the file %BUILDLOG% for build logging and unit test results
    call ant -Dtarget.app=%APP% -Dtarget.server=%SERVER% main
    goto end

:noserver
    echo Don't know about server %SERVER%
    goto end

:noapp
    echo Can't find application %APP% or application is not configured for autobuilds
    goto end

:usage
    echo %USAGE%
    goto end

:end
    set USAGE=
    set NEWARG=
    set APP=
    set SERVER=
    set ALLPROPS=

make this actually work on windows

make this actually work on windows

git-svn-id: b619a0c99665f88f1afe72824344cefe9a1c8c90@2260 fd5a2b45-1f63-4059-99e9-3c7cb7fd75c8


@echo off

if not exist "genie.exe" (
	echo Downloading genie...
	rem bitsadmin /transfer "genie" "https://github.com/bkaradzic/bx/raw/master/tools/bin/windows/genie.exe" "%~dp0\genie.exe"
	powershell Invoke-WebRequest -Uri "https://github.com/bkaradzic/bx/raw/master/tools/bin/windows/genie.exe" -OutFile '%~dp0\genie.exe'
)

IF "%1"=="" (
	echo No argument set
	echo Exemple : build.bat vs2015
	exit 1
)

genie.exe %*

@echo off

if not exist "genie.exe" (
	echo Downloading genie...
	rem bitsadmin /transfer "genie" "https://github.com/bkaradzic/bx/raw/master/tools/bin/windows/genie.exe" "%~dp0\genie.exe"
	powershell $AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'; [System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols; Invoke-WebRequest -Uri "https://github.com/bkaradzic/bx/raw/master/tools/bin/windows/genie.exe" -OutFile '%~dp0\genie.exe'
)

IF "%1"=="" (
	echo No argument set
	echo Exemple : build.bat vs2015
	exit 1
)

genie.exe %*

Fix SSL error for downloading genie in build.bat


@rem Copyright 2018 Google LLC. All rights reserved.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem     http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.

@echo "Starting Windows build"

cd /d %~dp0
cd ..

@rem The image we're currently running has a broken version of Node.js enabled
@rem by nvm (v10.15.3), which has no npm bin. This hack uses the functional
@rem Node v8.9.1 to install npm@latest, it then uses this version of npm to
@rem install npm for v10.15.3.
call nvm use v8.9.1 || goto :error
call node C:\Users\kbuilder\AppData\Roaming\nvm-ps\versions\v8.9.1\node_modules\npm-bootstrap\bin\npm-cli.js i npm -g || goto :error
call nvm use v10.15.3 || goto :error
call node C:\Users\kbuilder\AppData\Roaming\nvm-ps\versions\v8.9.1\node_modules\npm\bin\npm-cli.js i npm -g || goto :error

call npm install || goto :error
call npm run test || goto :error

goto :EOF

:error
exit /b 1

@rem Copyright 2018 Google LLC. All rights reserved.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem     http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.

@echo "Starting Windows build"

cd /d %~dp0
cd ..

@rem npm path is not currently set in our image, we should fix this next time
@rem we upgrade Node.js in the image:
SET PATH=%PATH%;/cygdrive/c/Program Files/nodejs/npm

call nvm use v12.14.1
call which node

call npm install || goto :error
call npm run test || goto :error

goto :EOF

:error
exit /b 1

build: update windows configuration to match new vm


REM    Copyright 2014 Steve Francia
REM
REM    Licensed under the Apache License, Version 2.0 (the "License");
REM    you may not use this file except in compliance with the License.
REM    You may obtain a copy of the License at
REM
REM        http://www.apache.org/licenses/LICENSE-2.0
REM
REM    Unless required by applicable law or agreed to in writing, software
REM    distributed under the License is distributed on an "AS IS" BASIS,
REM    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM    See the License for the specific language governing permissions and
REM    limitations under the License.

@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
@if not exist "%HOME%" @set HOME=%USERPROFILE%

@set APP_PATH=%HOME%\.spf13-vim-3
IF NOT EXIST "%APP_PATH%" (
    call git clone -b 3.0 https://github.com/spf13/spf13-vim.git "%APP_PATH%"
) ELSE (
    @set ORIGINAL_DIR=%CD%
    echo updating spf13-vim
    chdir /d "%APP_PATH%"
    call git pull
    chdir /d "%ORIGINAL_DIR%"
    call cd "%APP_PATH%"
)

call mklink "%HOME%\.vimrc" "%APP_PATH%\.vimrc"
call mklink "%HOME%\_vimrc" "%APP_PATH%\.vimrc"
call mklink "%HOME%\.vimrc.fork" "%APP_PATH%\.vimrc.fork"
call mklink "%HOME%\.vimrc.bundles" "%APP_PATH%\.vimrc.bundles"
call mklink "%HOME%\.vimrc.bundles.fork" "%APP_PATH%\.vimrc.bundles.fork"
call mklink "%HOME%\.vimrc.before" "%APP_PATH%\.vimrc.before"
call mklink "%HOME%\.vimrc.before.fork" "%APP_PATH%\.vimrc.before.fork"
call mklink /J "%HOME%\.vim" "%APP_PATH%\.vim"

IF NOT EXIST "%APP_PATH%\.vim\bundle" (
    call mkdir "%APP_PATH%\.vim\bundle"
)

IF NOT EXIST "%HOME%/.vim/bundle/vundle" (
    call git clone https://github.com/gmarik/vundle.git "%HOME%/.vim/bundle/vundle"
) ELSE (
  call cd "%HOME%/.vim/bundle/vundle"
  call git pull
  call cd %HOME%
)

call vim -u "%APP_PATH%/.vimrc.bundles" +BundleInstall! +BundleClean +qall

REM    Copyright 2014 Steve Francia
REM
REM    Licensed under the Apache License, Version 2.0 (the "License");
REM    you may not use this file except in compliance with the License.
REM    You may obtain a copy of the License at
REM
REM        http://www.apache.org/licenses/LICENSE-2.0
REM
REM    Unless required by applicable law or agreed to in writing, software
REM    distributed under the License is distributed on an "AS IS" BASIS,
REM    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM    See the License for the specific language governing permissions and
REM    limitations under the License.

@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
@if not exist "%HOME%" @set HOME=%USERPROFILE%

@set APP_PATH=%HOME%\.breaker-vim
IF NOT EXIST "%APP_PATH%" (
    call git clone -b 3.0 https://github.com/ibreaker/vimrc.git "%APP_PATH%"
) ELSE (
    @set ORIGINAL_DIR=%CD%
    echo updating breaker-vim
    chdir /d "%APP_PATH%"
    call git pull
    chdir /d "%ORIGINAL_DIR%"
    call cd "%APP_PATH%"
)

call mklink "%HOME%\.vimrc" "%APP_PATH%\.vimrc"
call mklink "%HOME%\_vimrc" "%APP_PATH%\.vimrc"
call mklink "%HOME%\.vimrc.fork" "%APP_PATH%\.vimrc.fork"
call mklink "%HOME%\.vimrc.bundles" "%APP_PATH%\.vimrc.bundles"
call mklink "%HOME%\.vimrc.bundles.fork" "%APP_PATH%\.vimrc.bundles.fork"
call mklink "%HOME%\.vimrc.before" "%APP_PATH%\.vimrc.before"
call mklink "%HOME%\.vimrc.before.fork" "%APP_PATH%\.vimrc.before.fork"
call mklink /J "%HOME%\.vim" "%APP_PATH%\.vim"

IF NOT EXIST "%APP_PATH%\.vim\bundle" (
    call mkdir "%APP_PATH%\.vim\bundle"
)

IF NOT EXIST "%HOME%/.vim/bundle/vundle" (
    call git clone https://github.com/gmarik/vundle.git "%HOME%/.vim/bundle/vundle"
) ELSE (
  call cd "%HOME%/.vim/bundle/vundle"
  call git pull
  call cd %HOME%
)

call vim -u "%APP_PATH%/.vimrc.bundles" +BundleInstall! +BundleClean +qall

update windows installer

update windows installer


@rem Reset PATH and current folder after LLVM build.
@set PATH=%oldpath%
@cd %mesa%

@rem Check environment
@IF %flexstate%==0 (
@echo winflexbison is required to build Mesa3D.
GOTO skipmesa
)
@if NOT EXIST mesa if %gitstate%==0 (
@echo Fatal: Both Mesa3D code and Git are missing. At least one is required. Execution halted.
@GOTO skipmesa
)

@rem Hide Meson support behind a parametter as it doesn't work yet.
@IF %enablemeson%==0 if %pythonver% GEQ 3 echo Mesa3D build: Unimplemented code path.
@IF %enablemeson%==0 if %pythonver% GEQ 3 GOTO skipmesa

@IF %pythonver% GEQ 3 IF %pkgconfigstate%==0 echo pkg-config is required to build Mesa3D with Meson. You can either use mingw-w64 or pkgconfiglite distribution, but mingw-w64 is the only up-to-date distribution.
@IF %pythonver% GEQ 3 IF %pkgconfigstate%==0 GOTO skipmesa

@REM Aquire Mesa3D source code if missing and enable S3TC texture cache automatically if possible.
@set buildmesa=n
@if %gitstate%==0 echo Error: Git not found. Auto-patching disabled. If you try to build with GLES support and use quick configuration or try to build osmesa expect a build failure per https://bugs.freedesktop.org/show_bug.cgi?id=106843
@if %gitstate%==0 echo.
@if NOT EXIST mesa echo Warning: Mesa3D source code not found.
@if NOT EXIST mesa echo.
@if NOT EXIST mesa set /p buildmesa=Download mesa code and build (y/n):
@if NOT EXIST mesa if /i "%buildmesa%"=="y" echo.
@if NOT EXIST mesa if /i NOT "%buildmesa%"=="y" GOTO skipmesa
@if NOT EXIST mesa set branch=master
@if NOT EXIST mesa IF %pythonver%==2 set /p branch=Enter Mesa source code branch name - defaults to master:
@if NOT EXIST mesa IF %pythonver%==2 echo.
@if NOT EXIST mesa IF %pythonver%==2 set mesarepo=https://gitlab.freedesktop.org/mesa/mesa.git
@if NOT EXIST mesa IF %pythonver% GEQ 3 set mesarepo=https://gitlab.freedesktop.org/dbaker/mesa.git
@if NOT EXIST mesa IF %pythonver% GEQ 3 set branch=meson-windows
@if NOT EXIST mesa git clone --recurse-submodules --depth=1 --branch=%branch% %mesarepo% mesa
@if NOT EXIST mesa echo.

@REM Collect information about Mesa3D code. Apply patches
@if EXIST mesa if /i NOT "%buildmesa%"=="y" set /p buildmesa=Begin mesa build. Proceed (y/n):
@if EXIST mesa if /i "%buildmesa%"=="y" echo.
@if /i NOT "%buildmesa%"=="y" GOTO skipmesa
@cd mesa
@set LLVM=%mesa%\llvm\%abi%-%llvmlink%
@set /p mesaver=<VERSION
@if "%mesaver:~-7%"=="0-devel" set /a intmesaver=%mesaver:~0,2%%mesaver:~3,1%00
@if "%mesaver:~5,4%"=="0-rc" set /a intmesaver=%mesaver:~0,2%%mesaver:~3,1%00+%mesaver:~9%
@if NOT "%mesaver:~5,2%"=="0-" set /a intmesaver=%mesaver:~0,2%%mesaver:~3,1%50+%mesaver:~5%
@if EXIST mesapatched.ini GOTO configmesabuild
@if %gitstate%==0 GOTO configmesabuild
@git apply -v ..\mesa-dist-win\patches\s3tc.patch
@echo 1 > mesapatched.ini
@echo.

@rem Apply a patch that disables osmesa when building GLES or swr driver when using Scons.
@rem GLES linking with osmesa is disabled due to build failure - https://bugs.freedesktop.org/show_bug.cgi?id=106843
@rem Now do the same for swr as it fails to link with osmesa when using LLVM 7.0.
@rem We'll do a 2-pass build in either case. Build everything requested without GLES and swr, then build everything again
@rem with GLES or swr or both.
@IF %pythonver%==2 git apply -v ..\mesa-dist-win\patches\osmesa.patch
@IF %pythonver%==2 echo.

@rem Apply a patch that fixes swr build with LLVM 7.0 - https://bugs.freedesktop.org/attachment.cgi?id=141969
@git apply -v ..\mesa-dist-win\patches\swr-llvm7.patch
@echo.

:configmesabuild
@rem Configure Mesa build.

@if %pythonver%==2 set buildcmd=%pythonloc% %pythonloc:~0,-10%Scripts\scons.py -j%throttle% build=release platform=windows machine=%longabi%
@if %pythonver%==2 if %intmesaver% LSS 18201 set buildcmd=%buildcmd% texture_float=1
@if %pythonver% GEQ 3 set buildconf=%mesonloc% %abi% --backend=vs2017 --buildtype=plain
@if %pythonver% GEQ 3 if %llvmlink%==MT set buildconf=%buildconf% -Dc_args="/MT /O2" -Dcpp_args="/MT /O2"
@IF %pythonver% GEQ 3 set platformabi=Win32
@IF %pythonver% GEQ 3 IF %abi%==x64 set platformabi=%abi%
@if %pythonver% GEQ 3 set buildcmd=msbuild /p^:Configuration=plain,Platform=%platformabi% mesa.sln /m^:%throttle% /v^:m

@set ninja=n
@if %pythonver% GEQ 3 if NOT %ninjastate%==0 set /p ninja=Use Ninja build system instead of MsBuild (y/n); less storage device strain and maybe faster build:
@if %pythonver% GEQ 3 if NOT %ninjastate%==0 echo.
@if /I "%ninja%"=="y" if %ninjastate%==1 set PATH=%mesa%\ninja\;%PATH%
@if /I "%ninja%"=="y" set buildconf=%buildconf:vs2017=ninja%
@if %pythonver% GEQ 3 if /I "%ninja%"=="y" set buildcmd=ninja -j %throttle%

@set llvmless=n
@if EXIST %LLVM% set /p llvmless=Build Mesa without LLVM (y/n). llvmpipe and swr drivers and high performance JIT won't be available for other drivers and libraries:
@if EXIST %LLVM% echo.
@if NOT EXIST %LLVM% set /p llvmless=Build Mesa without LLVM (y=yes/q=quit). llvmpipe and swr drivers and high performance JIT won't be available for other drivers and libraries:
@if NOT EXIST %LLVM% echo.
@if /I NOT "%llvmless%"=="y" if NOT EXIST %LLVM% echo User refused to build Mesa without LLVM.
@if /I NOT "%llvmless%"=="y" if NOT EXIST %LLVM% GOTO skipmesa
@if %pythonver%==2 if /I "%llvmless%"=="y" set buildcmd=%buildcmd% llvm=no
@if %pythonver% GEQ 3 if /I NOT "%llvmless%"=="y" set buildconf=%buildconf% -Dllvm-wrap=llvm
@if %pythonver% GEQ 3 if /I NOT "%llvmless%"=="y" call %mesa%\mesa-dist-win\buildscript\modules\llvmwrapgen.cmd

@if %pythonver%==2 set /p openmp=Build Mesa3D with OpenMP. Faster build and smaller binaries (y/n):
@if %pythonver%==2 echo.
@if %pythonver%==2 if /I "%openmp%"=="y" set buildcmd=%buildcmd% openmp=1

@set swrdrv=0
@if /I NOT "%llvmless%"=="y" if %abi%==x64 if EXIST %LLVM% set /p swrdrv=Do you want to build swr drivers? (y/1=yes):
@if /I NOT "%llvmless%"=="y" if %abi%==x64 if EXIST %LLVM% echo.
@if %pythonver%==2 if /I "%swrdrv%"=="y" set buildcmd=%buildcmd% swr=1
@if %pythonver% GEQ 3 if /I "%swrdrv%"=="y" set buildconf=%buildconf% -Dgallium-drivers=swrast,swr

@set disableosmesa=0
@set /p gles=Do you want to build GLAPI shared library and GLES support (y/n):
@echo.
@if %pythonver%==2 if /I "%gles%"=="y" set gles=y
@if %pythonver%==2 if /I "%gles%"=="y" set disableosmesa=1
@if %pythonver%==2 if /I NOT "%gles%"=="y" set gles=0
@if %pythonver% GEQ 3 if /I NOT "%gles%"=="y" set buildconf=%buildconf% -Dgles1=false -Dgles2=false

@set expressmesabuild=n
@if %pythonver%==2 set /p expressmesabuild=Do you want to build Mesa with quick configuration - includes libgl-gdi, graw-gdi, graw-null, tests, osmesa and GLAPI + OpenGL ES if GLES enabled:
@if %pythonver%==2 echo.
@if %pythonver%==2 IF /I "%expressmesabuild%"=="y" set mesatargets=.
@if %pythonver%==2 IF /I NOT "%expressmesabuild%"=="y" set mesatargets=libgl-gdi

@set osmesa=n
@IF /I NOT "%expressmesabuild%"=="y" set /p osmesa=Do you want to build off-screen rendering drivers (y/n):
@IF /I NOT "%expressmesabuild%"=="y" echo.
@if %pythonver%==2 IF /I NOT "%expressmesabuild%"=="y" IF /I "%osmesa%"=="y" set mesatargets=%mesatargets% osmesa
@if %pythonver% GEQ 3 IF /I "%osmesa%"=="y" set buildconf=%buildconf% -Dosmesa=gallium
@IF /I "%expressmesabuild%"=="y" set osmesa=y

@set graw=n
@IF /I NOT "%expressmesabuild%"=="y" set /p graw=Do you want to build graw library (y/n):
@IF /I NOT "%expressmesabuild%"=="y" echo.
@if %pythonver%==2 if /I "%graw%"=="y" IF /I NOT "%expressmesabuild%"=="y" set mesatargets=%mesatargets% graw-gdi
@IF /I "%expressmesabuild%"=="y" set graw=y
@if %pythonver% GEQ 3 if /I "%graw%"=="y" set buildconf=%buildconf% -Dbuild-tests=true

@set cleanbuild=n
@IF %pythonver%==2 if EXIST build\windows-%longabi% set /p cleanbuild=Do you want to clean build (y/n):
@IF %pythonver%==2 if EXIST build\windows-%longabi% echo.
@IF %pythonver% GEQ 3 if EXIST %abi% set /p cleanbuild=Do you want to clean build (y/n):
@IF %pythonver% GEQ 3 if EXIST %abi% echo.
@IF %pythonver%==2 if /I "%cleanbuild%"=="y" RD /S /Q build\windows-%longabi%
@IF %pythonver% GEQ 3 if /I "%cleanbuild%"=="y" RD /S /Q %abi%
@IF %pythonver% GEQ 3 if /I "%cleanbuild%"=="y" for /d %%q in ("%mesa%\mesa\subprojects\zlib-*") do @RD /s /q "%%~q"
@IF %pythonver% GEQ 3 if /I "%cleanbuild%"=="y" for /d %%r in ("%mesa%\mesa\subprojects\expat-*") do @RD /s /q "%%~r"

@IF %flexstate%==1 set PATH=%mesa%\flexbison\;%PATH%
@if %pythonver%==2 GOTO build_mesa
@if %pythonver% GEQ 3 IF %pkgconfigstate%==2 GOTO build_mesa
@set PATH=%PKG_CONFIG_PATH%\;%PATH%

:build_mesa
@IF %pythonver%==2 if NOT EXIST build md build
@IF %pythonver%==2 if NOT EXIST build\windows-%longabi% md build\windows-%longabi%
@IF %pythonver% GEQ 3 if NOT EXIST %abi% md %abi%
@IF %pythonver%==2 if NOT EXIST build\windows-%longabi%\git_sha1.h echo 0 > build\windows-%longabi%\git_sha1.h
@IF %pythonver% GEQ 3 if NOT EXIST %abi%\src md %abi%\src
@IF %pythonver% GEQ 3 if NOT EXIST %abi%\src\git_sha1.h echo 0 > %abi%\src\git_sha1.h
@echo.
@if %pythonver% GEQ 3 call %vsenv%
@if %pythonver% GEQ 3 echo.
@if %pythonver% GEQ 3 echo Build configuration command stored in buildconf variable.
@if %pythonver% GEQ 3 echo.
@if %pythonver% GEQ 3 cmd
@if %pythonver%==2 IF /I "%osmesa%"=="y" IF %disableosmesa%==1 (
@echo Build command: %buildcmd% gles=0 %mesatargets%
@echo.
@%buildcmd% gles=0 %mesatargets%
@echo.
@pause
@echo Beginning 2nd build pass
@echo.
)
@if %pythonver%==2 (
@echo Build command: %buildcmd% gles=%gles% %mesatargets%
@echo.
@%buildcmd% gles=%gles% %mesatargets%
@echo.
)

:skipmesa
@echo.

@rem Reset PATH and current folder after LLVM build.
@set PATH=%oldpath%
@cd %mesa%

@rem Check environment
@IF %flexstate%==0 (
@echo winflexbison is required to build Mesa3D.
GOTO skipmesa
)
@if NOT EXIST mesa if %gitstate%==0 (
@echo Fatal: Both Mesa3D code and Git are missing. At least one is required. Execution halted.
@GOTO skipmesa
)

@rem Hide Meson support behind a parametter as it doesn't work yet.
@IF %enablemeson%==0 if %pythonver% GEQ 3 echo Mesa3D build: Unimplemented code path.
@IF %enablemeson%==0 if %pythonver% GEQ 3 GOTO skipmesa

@IF %pythonver% GEQ 3 IF %pkgconfigstate%==0 echo pkg-config is required to build Mesa3D with Meson. You can either use mingw-w64 or pkgconfiglite distribution, but mingw-w64 is the only up-to-date distribution.
@IF %pythonver% GEQ 3 IF %pkgconfigstate%==0 GOTO skipmesa

@REM Aquire Mesa3D source code if missing and enable S3TC texture cache automatically if possible.
@set buildmesa=n
@if %gitstate%==0 echo Error: Git not found. Auto-patching disabled. If you try to build with GLES support and use quick configuration or try to build osmesa expect a build failure per https://bugs.freedesktop.org/show_bug.cgi?id=106843
@if %gitstate%==0 echo.
@if NOT EXIST mesa echo Warning: Mesa3D source code not found.
@if NOT EXIST mesa echo.
@if NOT EXIST mesa set /p buildmesa=Download mesa code and build (y/n):
@if NOT EXIST mesa if /i "%buildmesa%"=="y" echo.
@if NOT EXIST mesa if /i NOT "%buildmesa%"=="y" GOTO skipmesa
@if NOT EXIST mesa set branch=master
@if NOT EXIST mesa IF %pythonver%==2 set /p branch=Enter Mesa source code branch name - defaults to master:
@if NOT EXIST mesa IF %pythonver%==2 echo.
@if NOT EXIST mesa IF %pythonver%==2 set mesarepo=https://gitlab.freedesktop.org/mesa/mesa.git
@if NOT EXIST mesa IF %pythonver% GEQ 3 set mesarepo=https://gitlab.freedesktop.org/dbaker/mesa.git
@if NOT EXIST mesa IF %pythonver% GEQ 3 set branch=meson-windows
@if NOT EXIST mesa git clone --recurse-submodules --depth=1 --branch=%branch% %mesarepo% mesa
@if NOT EXIST mesa echo.

@REM Collect information about Mesa3D code. Apply patches
@if EXIST mesa if /i NOT "%buildmesa%"=="y" set /p buildmesa=Begin mesa build. Proceed (y/n):
@if EXIST mesa if /i "%buildmesa%"=="y" echo.
@if /i NOT "%buildmesa%"=="y" GOTO skipmesa
@cd mesa
@set LLVM=%mesa%\llvm\%abi%-%llvmlink%
@set /p mesaver=<VERSION
@if "%mesaver:~-7%"=="0-devel" set /a intmesaver=%mesaver:~0,2%%mesaver:~3,1%00
@if "%mesaver:~5,4%"=="0-rc" set /a intmesaver=%mesaver:~0,2%%mesaver:~3,1%00+%mesaver:~9%
@if NOT "%mesaver:~5,2%"=="0-" set /a intmesaver=%mesaver:~0,2%%mesaver:~3,1%50+%mesaver:~5%
@if EXIST mesapatched.ini GOTO configmesabuild
@if %gitstate%==0 GOTO configmesabuild
@git apply -v ..\mesa-dist-win\patches\s3tc.patch
@echo 1 > mesapatched.ini
@echo.

@rem Apply a patch that disables osmesa when building GLES or swr driver when using Scons.
@rem GLES linking with osmesa is disabled due to build failure - https://bugs.freedesktop.org/show_bug.cgi?id=106843
@rem Now do the same for swr as it fails to link with osmesa when using LLVM 7.0.
@rem We'll do a 2-pass build in either case. Build everything requested without GLES and swr, then build everything again
@rem with GLES or swr or both.
@IF %pythonver%==2 git apply -v ..\mesa-dist-win\patches\osmesa.patch
@IF %pythonver%==2 echo.

@rem Apply a patch that fixes swr build with LLVM 7.0 - https://bugs.freedesktop.org/attachment.cgi?id=141969
@git apply -v ..\mesa-dist-win\patches\swr-llvm7.patch
@echo.

:configmesabuild
@rem Configure Mesa build.

@if %pythonver%==2 set buildcmd=%pythonloc% %pythonloc:~0,-10%Scripts\scons.py -j%throttle% build=release platform=windows machine=%longabi%
@if %pythonver%==2 if %intmesaver% LSS 18201 set buildcmd=%buildcmd% texture_float=1
@if %pythonver% GEQ 3 set buildconf=%mesonloc% %abi% --backend=vs2017 --buildtype=plain
@if %pythonver% GEQ 3 if %llvmlink%==MT set buildconf=%buildconf% -Dc_args="/MT /O2" -Dcpp_args="/MT /O2"
@IF %pythonver% GEQ 3 set platformabi=Win32
@IF %pythonver% GEQ 3 IF %abi%==x64 set platformabi=%abi%
@if %pythonver% GEQ 3 set buildcmd=msbuild /p^:Configuration=plain,Platform=%platformabi% mesa.sln /m^:%throttle% /v^:m

@set ninja=n
@if %pythonver% GEQ 3 if NOT %ninjastate%==0 set /p ninja=Use Ninja build system instead of MsBuild (y/n); less storage device strain and maybe faster build:
@if %pythonver% GEQ 3 if NOT %ninjastate%==0 echo.
@if /I "%ninja%"=="y" if %ninjastate%==1 set PATH=%mesa%\ninja\;%PATH%
@if /I "%ninja%"=="y" set buildconf=%buildconf:vs2017=ninja%
@if %pythonver% GEQ 3 if /I "%ninja%"=="y" set buildcmd=ninja -j %throttle%

@set llvmless=n
@if EXIST %LLVM% set /p llvmless=Build Mesa without LLVM (y/n). llvmpipe and swr drivers and high performance JIT won't be available for other drivers and libraries:
@if EXIST %LLVM% echo.
@if NOT EXIST %LLVM% set /p llvmless=Build Mesa without LLVM (y=yes/q=quit). llvmpipe and swr drivers and high performance JIT won't be available for other drivers and libraries:
@if NOT EXIST %LLVM% echo.
@if /I NOT "%llvmless%"=="y" if NOT EXIST %LLVM% echo User refused to build Mesa without LLVM.
@if /I NOT "%llvmless%"=="y" if NOT EXIST %LLVM% GOTO skipmesa
@if %pythonver%==2 if /I "%llvmless%"=="y" set buildcmd=%buildcmd% llvm=no
@if %pythonver% GEQ 3 if /I NOT "%llvmless%"=="y" set buildconf=%buildconf% -Dllvm-wrap=llvm
@if %pythonver% GEQ 3 if /I NOT "%llvmless%"=="y" call %mesa%\mesa-dist-win\buildscript\modules\llvmwrapgen.cmd

@if %pythonver%==2 set /p openmp=Build Mesa3D with OpenMP. Faster build and smaller binaries (y/n):
@if %pythonver%==2 echo.
@if %pythonver%==2 if /I "%openmp%"=="y" set buildcmd=%buildcmd% openmp=1

@set swrdrv=0
@if /I NOT "%llvmless%"=="y" if %abi%==x64 if EXIST %LLVM% set /p swrdrv=Do you want to build swr drivers? (y=yes):
@if /I NOT "%llvmless%"=="y" if %abi%==x64 if EXIST %LLVM% echo.
@if %pythonver%==2 if /I "%swrdrv%"=="y" set buildcmd=%buildcmd% swr=1
@if %pythonver% GEQ 3 if /I "%swrdrv%"=="y" set buildconf=%buildconf% -Dgallium-drivers=swrast,swr

@set disableosmesa=0
@set /p gles=Do you want to build GLAPI shared library and GLES support (y/n):
@echo.
@if %pythonver%==2 if /I "%gles%"=="y" set gles=y
@if %pythonver%==2 if /I "%gles%"=="y" set disableosmesa=1
@if %pythonver%==2 if /I NOT "%gles%"=="y" set gles=0
@if %pythonver% GEQ 3 if /I NOT "%gles%"=="y" set buildconf=%buildconf% -Dgles1=false -Dgles2=false

@set expressmesabuild=n
@if %pythonver%==2 set /p expressmesabuild=Do you want to build Mesa with quick configuration - includes libgl-gdi, graw-gdi, graw-null, tests, osmesa and GLAPI + OpenGL ES if GLES enabled:
@if %pythonver%==2 echo.
@if %pythonver%==2 IF /I "%expressmesabuild%"=="y" set mesatargets=.
@if %pythonver%==2 IF /I NOT "%expressmesabuild%"=="y" set mesatargets=libgl-gdi

@set osmesa=n
@IF /I NOT "%expressmesabuild%"=="y" set /p osmesa=Do you want to build off-screen rendering drivers (y/n):
@IF /I NOT "%expressmesabuild%"=="y" echo.
@if %pythonver%==2 IF /I NOT "%expressmesabuild%"=="y" IF /I "%osmesa%"=="y" set mesatargets=%mesatargets% osmesa
@if %pythonver% GEQ 3 IF /I "%osmesa%"=="y" set buildconf=%buildconf% -Dosmesa=gallium
@IF /I "%expressmesabuild%"=="y" set osmesa=y

@set graw=n
@IF /I NOT "%expressmesabuild%"=="y" set /p graw=Do you want to build graw library (y/n):
@IF /I NOT "%expressmesabuild%"=="y" echo.
@if %pythonver%==2 if /I "%graw%"=="y" IF /I NOT "%expressmesabuild%"=="y" set mesatargets=%mesatargets% graw-gdi
@IF /I "%expressmesabuild%"=="y" set graw=y
@if %pythonver% GEQ 3 if /I "%graw%"=="y" set buildconf=%buildconf% -Dbuild-tests=true

@set cleanbuild=n
@IF %pythonver%==2 if EXIST build\windows-%longabi% set /p cleanbuild=Do you want to clean build (y/n):
@IF %pythonver%==2 if EXIST build\windows-%longabi% echo.
@IF %pythonver% GEQ 3 if EXIST %abi% set /p cleanbuild=Do you want to clean build (y/n):
@IF %pythonver% GEQ 3 if EXIST %abi% echo.
@IF %pythonver%==2 if /I "%cleanbuild%"=="y" RD /S /Q build\windows-%longabi%
@IF %pythonver% GEQ 3 if /I "%cleanbuild%"=="y" RD /S /Q %abi%
@IF %pythonver% GEQ 3 if /I "%cleanbuild%"=="y" for /d %%q in ("%mesa%\mesa\subprojects\zlib-*") do @RD /s /q "%%~q"
@IF %pythonver% GEQ 3 if /I "%cleanbuild%"=="y" for /d %%r in ("%mesa%\mesa\subprojects\expat-*") do @RD /s /q "%%~r"

@IF %flexstate%==1 set PATH=%mesa%\flexbison\;%PATH%
@if %pythonver%==2 GOTO build_mesa
@if %pythonver% GEQ 3 IF %pkgconfigstate%==2 GOTO build_mesa
@set PATH=%PKG_CONFIG_PATH%\;%PATH%

:build_mesa
@IF %pythonver%==2 if NOT EXIST build md build
@IF %pythonver%==2 if NOT EXIST build\windows-%longabi% md build\windows-%longabi%
@IF %pythonver% GEQ 3 if NOT EXIST %abi% md %abi%
@IF %pythonver%==2 if NOT EXIST build\windows-%longabi%\git_sha1.h echo 0 > build\windows-%longabi%\git_sha1.h
@IF %pythonver% GEQ 3 if NOT EXIST %abi%\src md %abi%\src
@IF %pythonver% GEQ 3 if NOT EXIST %abi%\src\git_sha1.h echo 0 > %abi%\src\git_sha1.h
@echo.
@if %pythonver% GEQ 3 call %vsenv%
@if %pythonver% GEQ 3 echo.
@if %pythonver% GEQ 3 echo Build configuration command stored in buildconf variable.
@if %pythonver% GEQ 3 echo.
@if %pythonver% GEQ 3 cmd
@if %pythonver%==2 IF /I "%osmesa%"=="y" IF %disableosmesa%==1 (
@echo Build command: %buildcmd% gles=0 %mesatargets%
@echo.
@%buildcmd% gles=0 %mesatargets%
@echo.
@pause
@echo Beginning 2nd build pass
@echo.
)
@if %pythonver%==2 (
@echo Build command: %buildcmd% gles=%gles% %mesatargets%
@echo.
@%buildcmd% gles=%gles% %mesatargets%
@echo.
)

:skipmesa
@echo.

Fix a regression from previous commit

Fix a regression from previous commit


set /p versionNumber=

REM clean up
del builds\FsEye-%versionNumber%.zip
rd /q /s builds\FsEye-%versionNumber%
rd /q /s builds\FsEye

REM preparing staging dir
mkdir staging
mkdir staging\plugins

copy LICENSE staging
copy NOTICE staging

copy FsEye\bin\Release\FsEye.fsx staging
copy FsEye\bin\Release\FsEye.dll staging
copy FsEye\bin\Release\FsEye.xml staging

copy "FsEye.PropertyGrid.Plugin\bin\Release\FsEye.PropertyGrid.Plugin.dll" staging\plugins
copy "FsEye.TreeView.Plugin\bin\Release\FsEye.TreeView.Plugin.dll" staging\plugins

REM zip staging files
cd staging
"..\tools\7z\7za.exe" a -tzip "..\builds\FsEye-%versionNumber%.zip" *
cd ..

REM extract build
"tools\7z\7za.exe" x "builds\FsEye-%versionNumber%.zip" -o"builds\FsEye-%versionNumber%"
"tools\7z\7za.exe" x "builds\FsEye-%versionNumber%.zip" -o"builds\FsEye"

REM clean up
rd /q /s staging

pause

set /p versionNumber=

REM clean up
del builds\FsEye-%versionNumber%.zip
rd /q /s builds\FsEye-%versionNumber%
rd /q /s builds\FsEye

REM preparing staging dir
mkdir staging
mkdir staging\plugins

copy LICENSE staging
copy NOTICE staging

copy FsEye\bin\Release\FsEye.fsx staging
copy FsEye\bin\Release\FsEye.dll staging
copy FsEye\bin\Release\FsEye.xml staging

copy "FsEye.PropertyGrid.Plugin\bin\Release\FsEye.PropertyGrid.Plugin.dll" staging\plugins
copy "FsEye.TreeView.Plugin\bin\Release\FsEye.TreeView.Plugin.dll" staging\plugins
copy "FsEye.DataGridView.Plugin\bin\Release\FsEye.DataGridView.Plugin.dll" staging\plugins

REM zip staging files
cd staging
"..\tools\7z\7za.exe" a -tzip "..\builds\FsEye-%versionNumber%.zip" *
cd ..

REM extract build
"tools\7z\7za.exe" x "builds\FsEye-%versionNumber%.zip" -o"builds\FsEye-%versionNumber%"
"tools\7z\7za.exe" x "builds\FsEye-%versionNumber%.zip" -o"builds\FsEye"

REM clean up
rd /q /s staging

pause

update bat to package datagrid plugin

update bat to package datagrid plugin


set BUILD_TARGET=%1
if "%BUILD_TARGET%" == "32bit" (
  set ADDRESS_MODEL=32
  set TARGET_ARCH=x86
) else (
  set ADDRESS_MODEL=64
  set TARGET_ARCH=x64
)

set PWIZ_DIR=%INSTALL_DIR%\proteowizard
if not exist "%PWIZ_DIR%\lib" (
  echo Downloading and installing ProteoWizard
  if not exist "%PWIZ_DIR%" (
    call :downloadfile %PWIZ_URL% %INSTALL_DIR%\pwiz.tar.bz2
    if not exist "%INSTALL_DIR%\pwiz.tar" (
      %ZIP_EXE% x "%INSTALL_DIR%\pwiz.tar.bz2" -o"%INSTALL_DIR%" -aoa > NUL
    )
    %ZIP_EXE% x "%INSTALL_DIR%\pwiz.tar" -o"%PWIZ_DIR%" -aoa > NUL
  )

  cd /D "%PWIZ_DIR%"
  echo Starting Proteowizard and Boost build, this can take a while...
  call quickbuild.bat address-model=%ADDRESS_MODEL% -j4 --toolset=msvc-%MSVC_VER%.0 --i-agree-to-the-vendor-licenses ^
                pwiz/data/common//pwiz_data_common ^
                pwiz/data/identdata//pwiz_data_identdata ^
                pwiz/data/identdata//pwiz_data_identdata_version ^
                pwiz/data/msdata//pwiz_data_msdata_core ^
                pwiz/data/msdata//pwiz_data_msdata ^
                pwiz/data/msdata//pwiz_data_msdata_version ^
                pwiz/data/msdata/mz5//pwiz_data_msdata_mz5 ^
                pwiz/data/proteome//pwiz_data_proteome ^
                pwiz/utility/chemistry//pwiz_utility_chemistry ^
                pwiz/utility/minimxml//pwiz_utility_minimxml ^
                pwiz/utility/misc//SHA1 ^
                pwiz/utility/misc//pwiz_utility_misc ^
                pwiz/data/vendor_readers//pwiz_data_vendor_readers ^
                pwiz/data/vendor_readers/Thermo//pwiz_reader_thermo ^
                pwiz_aux/msrc/utility/vendor_api/thermo//pwiz_vendor_api_thermo ^
                pwiz/data/vendor_readers/Shimadzu//pwiz_reader_shimadzu ^
                pwiz_aux/msrc/utility/vendor_api/Shimadzu//pwiz_vendor_api_shimadzu ^
                pwiz/data/vendor_readers/UIMF//pwiz_reader_uimf ^
                pwiz_aux/msrc/utility/vendor_api/UIMF//pwiz_vendor_api_uimf ^
                pwiz/data/vendor_readers/UNIFI//pwiz_reader_unifi ^
                pwiz_aux/msrc/utility/vendor_api/UNIFI//pwiz_vendor_api_unifi ^
                pwiz/data/vendor_readers/Agilent//pwiz_reader_agilent ^
                pwiz_aux/msrc/utility/vendor_api/Agilent//pwiz_vendor_api_agilent ^
                pwiz/data/vendor_readers/Waters//pwiz_reader_waters ^
                pwiz/data/vendor_readers/Bruker//pwiz_reader_bruker ^
                pwiz_aux/msrc/utility/vendor_api/Bruker//pwiz_vendor_api_bruker ^
                pwiz/data/vendor_readers/ABI/T2D//pwiz_reader_abi_t2d ^
                pwiz_aux/msrc/utility/vendor_api/ABI/T2D//pwiz_vendor_api_abi_t2d ^
                pwiz/data/vendor_readers/ABI//pwiz_reader_abi ^
                pwiz_aux/msrc/utility/vendor_api/ABI//pwiz_vendor_api_abi ^
                /ext/zlib//z ^
                /ext/hdf5//hdf5 ^
                /ext/hdf5//hdf5pp ^
                libraries/SQLite//sqlite3 ^
                libraries/SQLite//sqlite3pp ^
                /ext/boost//system ^
                /ext/boost//thread ^
                /ext/boost//chrono ^
                /ext/boost//regex ^
                /ext/boost//filesystem ^
                /ext/boost//iostreams ^
                /ext/boost//program_options ^
                /ext/boost//nowide ^
                /ext/boost//serialization > pwiz_installation.log 2>&1

  echo Copying ProteoWizard libraries to lib folder
  mkdir lib
  for /r build-nt-x86 %%x in (*.lib) do copy "%%x" lib\ /Y > NUL
  cd lib
  PowerShell "(Dir | Rename-Item -NewName { $_.Name -replace '-vc%MSVC_VER%0-mt','' })"
  PowerShell "(Dir | Rename-Item -NewName { $_.Name -replace 'libpwiz_','pwiz_' })"
  Ren libzlib.lib zlib.lib
  Ren libhdf5pp.lib hdf5pp.lib
  Ren libhdf5.lib hdf5.lib
  Ren libSHA1.lib SHA1.lib
  Ren libsqlite3pp.lib sqlite3pp.lib
  Ren libsqlite3.lib sqlite3.lib

  ::: these DLLs might not work, as they are for VS2013 :::
  echo Copying vendor libraries to lib folder
  COPY ..\pwiz_aux\msrc\utility\vendor_api\Waters\vc12_%TARGET_ARCH%\* . > NUL
  COPY ..\pwiz_aux\msrc\utility\vendor_api\Bruker\%TARGET_ARCH%\baf2sql_c.* . > NUL
  COPY ..\pwiz_aux\msrc\utility\vendor_api\Bruker\%TARGET_ARCH%\timsdata.* . > NUL

  ::: Generate lib from dll for cdt.dll
  echo Generate lib from cdt.dll
  setlocal enableDelayedExpansion
  set DLL_BASE=cdt
  set DEF_FILE=!DLL_BASE!.def
  set write=0
  echo EXPORTS> "!DEF_FILE!"
  for /f "usebackq tokens=4" %%i in (`dumpbin /exports "!DLL_BASE!.dll"`) do if "!write!"=="1" (echo %%i >> "!DEF_FILE!") else (if %%i==name set write=1)
  lib /DEF:"!DEF_FILE!" /MACHINE:%TARGET_ARCH%
  endlocal

  cd ..

  echo Copying ProteoWizard header files to include folder
  mkdir include
  for /r pwiz %%x in (*.hpp, *.h) do copy "%%x" include\ /Y > NUL

  ::: copy the boost::asio library, which is not included by the ProteoWizard boost tar but is needed for maracluster
  call :downloadfile "%BOOST_ASIO_URL%" %INSTALL_DIR%\boost_asio.zip
  %ZIP_EXE% x "%INSTALL_DIR%\boost_asio.zip" -o"%INSTALL_DIR%" -aoa > NUL
  PowerShell "Copy-Item -Path '%INSTALL_DIR%\%BOOST_ASIO_BASE%\boost' -Destination '%PWIZ_DIR%\libraries\boost_1_76_0' -Recurse -Force"
)

:downloadfile
PowerShell "[Net.ServicePointManager]::SecurityProtocol = 'tls12, tls11, tls'; (new-object System.Net.WebClient).DownloadFile('%1','%2')"
EXIT /B

Add downloadfile function to proteowizard installer


call settings.bat

set PATH=C:\Program Files (x86)\Git\bin;%PATH%
bash -c "bash ./build_osrm_create_devpack.sh"
cd osrm_libs

xcopy /y /e ..\..\ruby ruby\

..\7z a ../libs_osrm_%Variant%.7z libs boost_min tbb *.bat -t7z -mx=9
..\7z a ../libs_osrm_%Variant%_test.7z libs boost_min tbb ruby *.bat -t7z -mx=9

add ruby packng to osrm devpack

add ruby packng to osrm devpack