:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
:: All rights reserved.
:: Contact: Nokia Corporation (qt-info@nokia.com)
::
:: This file is part of the Qt Mobility Components.
::
:: $QT_BEGIN_LICENSE:LGPL$
:: No Commercial Usage
:: This file contains pre-release code and may not be distributed.
:: You may use this file in accordance with the terms and conditions
:: contained in the Technology Preview License Agreement accompanying
:: this package.
::
:: GNU Lesser General Public License Usage
:: Alternatively, this file may be used under the terms of the GNU Lesser
:: General Public License version 2.1 as published by the Free Software
:: Foundation and appearing in the file LICENSE.LGPL included in the
:: packaging of this file.  Please review the following information to
:: ensure the GNU Lesser General Public License version 2.1 requirements
:: will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
::
:: In addition, as a special exception, Nokia gives you certain additional
:: rights.  These rights are described in the Nokia Qt LGPL Exception
:: version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
::
:: If you have questions regarding the use of this file, please contact
:: Nokia at qt-info@nokia.com.
::
::
::
::
::
::
::
::
:: $QT_END_LICENSE$
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

@echo off

set QT_MOBILITY_PREFIX= C:\QtMobility
set BUILD_PATH=%CD%
set SOURCE_PATH= %~dp0
cd /D %SOURCE_PATH%
set SOURCE_PATH=%CD%
cd /D %BUILD_PATH%

set PROJECT_CONFIG= %BUILD_PATH%\config.in
set PROJECT_LOG= %BUILD_PATH%\config.log
set RELEASEMODE=release
set QT_MOBILITY_LIB=
set BUILD_UNITTESTS=no
set BUILD_EXAMPLES=no
set CONTACTS_PLUGIN=
set VC_TEMPLATE_OPTION=
set QT_PATH=
set QMAKE_CACHE=%BUILD_PATH%\.qmake.cache

if exist "%QMAKE_CACHE%" del %QMAKE_CACHE%
if exist "%PROJECT_LOG%" del %PROJECT_LOG%
if exist "%PROJECT_CONFIG%" del %PROJECT_CONFIG%

echo QT_MOBILITY_SOURCE_TREE = %SOURCE_PATH% > %QMAKE_CACHE%
echo QT_MOBILITY_BUILD_TREE = %BUILD_PATH% >> %QMAKE_CACHE%

:cmdline_parsing

if "%1" == ""               goto startProcessing
if "%1" == "-debug"         goto debugTag
if "%1" == "-release"       goto releaseTag
if "%1" == "-silent"        goto silentTag
if "%1" == "-prefix"        goto prefixTag
if "%1" == "-libdir"        goto libTag
if "%1" == "-bindir"        goto binTag
if "%1" == "-headerdir"     goto headerTag
if "%1" == "-tests"         goto testTag
if "%1" == "-examples"      goto exampleTag
if "%1" == "-contact-src"   goto contactsTag
if "%1" == "-qt"            goto qtTag
if "%1" == "-vc"            goto vcTag
if "%1" == "/?"             goto usage
if "%1" == "-h"             goto usage
if "%1" == "-help"          goto usage
if "%1" == "--help"         goto usage

echo Unknown option: "%1"
goto usage

:usage
echo Usage: configure.bat [-prefix (dir)] [headerdir (dir)] [libdir (dir)]
    echo                  [-bindir (dir)] [-tests] [-examples]
    echo                  [-debug] [-release] [-silent]
    echo.
    echo Options:
    echo.
    echo -prefix (dir) ..... This will install everything relative to dir
    echo                     (default prefix: C:\QtMobility)
    echo -headerdir (dir) .. Header files will be installed to dir
    echo                     (default prefix: PREFIX/include)
    echo -libdir (dir) ..... Libraries will be installed to dir
    echo                     (default PREFIX/lib)
    echo -bindir (dir) ..... Executables will be installed to dir
    echo                     (default PREFIX/bin)
    echo -debug ............ Build with debugging symbols
    echo -release .......... Build without debugging symbols
    echo -silent ........... Reduces build output
    echo -tests ............ Build unit tests (not build by default)
    echo                     Note, this adds test symbols to all libraries
    echo                     and should not be used for release builds.
    echo -examples ......... Build example applications
    echo -vc ............... Generate Visual Studio make files
    echo -contact-src (backend) ...
    echo                     Compile the specified contacts API backend. Not selecting any backend
    echo                     will result in default selection for build platform
    echo                     options: symbian, wince, memory, maemo

if exist "%PROJECT_CONFIF%" del %PROJECT_CONFIG%
goto exitTag

:qtTag
shift
set QT_PATH=%1\
shift
goto cmdline_parsing

:contactsTag
shift
set CONTACTS_PLUGIN=%CONTACTS_PLUGIN% %1
shift
goto cmdline_parsing

:debugTag
if "%RELEASEMODE%" == "release" set RELEASEMODE=debug
shift
goto cmdline_parsing

:releaseTag
if "%RELEASEMODE%" == "debug"   set RELEASEMODE=release
shift
goto cmdline_parsing

:silentTag
echo CONFIG += silent > %PROJECT_CONFIG%
shift
goto cmdline_parsing

:prefixTag
shift
set QT_MOBILITY_PREFIX=%1
shift
goto cmdline_parsing

:libTag
shift
echo QT_MOBILITY_LIB = %1 >> %PROJECT_CONFIG%
shift
goto cmdline_parsing

:binTag
shift
echo QT_MOBILITY_BIN = %1 >> %PROJECT_CONFIG%
shift
goto cmdline_parsing

:headerTag
shift
echo QT_MOBILITY_INCLUDE = %1 >> %PROJECT_CONFIG%
shift
goto cmdline_parsing

:testTag
set BUILD_UNITTESTS=yes
shift
goto cmdline_parsing

:exampleTag
set BUILD_EXAMPLES=yes
shift
goto cmdline_parsing

:vcTag
shift
set VC_TEMPLATE_OPTION=-tp vc
goto cmdline_parsing

:startProcessing

echo CONFIG += %RELEASEMODE% >> %PROJECT_CONFIG%
echo CONTACTS_BACKENDS = %CONTACTS_PLUGIN% >> %PROJECT_CONFIG%

set CURRENTDIR=%CD%
echo %CURRENTDIR%
if exist %QT_MOBILITY_PREFIX% goto prefixExists
mkdir %QT_MOBILITY_PREFIX%
if errorlevel 1 goto invalidPrefix
cd /D %QT_MOBILITY_PREFIX%
set QT_MOBILITY_PREFIX=%CD%
cd /D %CURRENTDIR%
rd /S /Q %QT_MOBILITY_PREFIX%
goto endprefixProcessing

:invalidPrefix
echo "%QT_MOBILITY_PREFIX%" is not a valid directory path.
goto :exitTag

:prefixExists
cd /D %QT_MOBILITY_PREFIX%
set QT_MOBILITY_PREFIX=%CD%
cd /D %CURRENTDIR%

:endprefixProcessing
echo QT_MOBILITY_PREFIX = %QT_MOBILITY_PREFIX% >> %PROJECT_CONFIG%

echo build_unit_tests = %BUILD_UNITTESTS% >> %PROJECT_CONFIG%
echo build_examples = %BUILD_EXAMPLES% >> %PROJECT_CONFIG%
echo qmf_enabled = no >> %PROJECT_CONFIG%

echo isEmpty($$QT_MOBILITY_INCLUDE):QT_MOBILITY_INCLUDE=$$QT_MOBILITY_PREFIX/include >> %PROJECT_CONFIG%
echo isEmpty($$QT_MOBILITY_LIB):QT_MOBILITY_LIB=$$QT_MOBILITY_PREFIX/lib >> %PROJECT_CONFIG%
echo isEmpty($$QT_MOBILITY_BIN):QT_MOBILITY_BIN=$$QT_MOBILITY_PREFIX/bin >> %PROJECT_CONFIG%

copy %PROJECT_CONFIG% %BUILD_PATH%\config.pri
del %PROJECT_CONFIG%

echo Checking available Qt
%QT_PATH%qmake -v >> %PROJECT_LOG% 2>&1
if errorlevel 1 goto qmakeNotFound
goto qmakeFound
:qmakeNotFound
echo ... Not found  >> %PROJECT_LOG% 2>&1
if "%QT_PATH%" == "" (
    echo >&2 "Cannot find 'qmake' in your PATH."
) else (
    else echo >&2 "Cannot find 'qmake' in %QT_PATH%."
)
echo >&2 "Aborting."
goto exitTag

:qmakeFound
%QT_PATH%qmake -query QT_VERSION

goto checkMake

:makeTest
setlocal
    set CURRENT_PWD=%CD%

    if %BUILD_PATH% == %SOURCE_PATH% (
        cd %SOURCE_PATH%\config.tests\make
        if exist make del make
    ) else (
        rmdir /S /Q config.tests\make
        mkdir config.tests\make
        cd config.tests\make
    )

    for /f "tokens=3" %%i in ('%QT_PATH%qmake %SOURCE_PATH%\config.tests\make\make.pro 2^>^&1 1^>NUL') do set MAKETYPE=%%i

    if %MAKETYPE% == symbian-abld (
        make -h >> %PROJECT_LOG% 2>&1
        if not errorlevel 1 (
            echo ... Symbian abld make found.
            set MAKE=make
        )
    ) else if %MAKETYPE% == symbian-sbsv2 (
        make -h >> %PROJECT_LOG% 2>&1
        if not errorlevel 1 (
            echo ... Symbian sbsv2 make found.
            set MAKE=make
        )
    ) else if %MAKETYPE% == win32-nmake (
        nmake /? >> %PROJECT_LOG% 2>&1
        if not errorlevel 1 (
            echo ... nmake found.
            set MAKE=nmake
        )
    ) else if %MAKETYPE% == win32-mingw (
        mingw32-make -v >> %PROJECT_LOG% 2>&1
        if not errorlevel 1 (
            echo ... mingw32-make found.
            set MAKE=mingw32-make
        )
    ) else (
        echo ... Unknown target environment %MAKETYPE%.
    )
    cd %CURRENT_PWD%
endlocal&set %1=%MAKE%&set %2=%MAKETYPE%&goto :EOF

:checkMake
echo Checking make
call :makeTest MAKE MAKETYPE
if not "%MAKE%" == "" goto compileTests

echo >&2 "Cannot find 'nmake', 'mingw32-make' or 'make' in your PATH"
echo >&2 "Aborting."

goto exitTag

:compileTest
setlocal
    echo Checking %1
    set CURRENT_PWD=%CD%

    if %BUILD_PATH% == %SOURCE_PATH% (
        cd %SOURCE_PATH%\config.tests\%2
        if exist %2 del %2
    ) else (
        rmdir /S /Q config.tests\%2
        mkdir config.tests\%2
        cd config.tests\%2
    )

    %QT_PATH%qmake %SOURCE_PATH%\config.tests\%2\%2.pro >> %PROJECT_LOG% 2>&1
    %MAKE% clean >> %PROJECT_LOG%
    %MAKE% >> %PROJECT_LOG% 2>&1

    set FAILED=0
    if %MAKETYPE% == symbian-sbsv2 (
        for /f "tokens=2" %%i in ('%MAKE% SBS^="@sbs --check"') do set FAILED=1
    ) else if %MAKETYPE% == symbian-abld (
        for /f "tokens=2" %%i in ('%MAKE% ABLD^="@ABLD.BAT -c"') do set FAILED=1
    ) else if errorlevel 1 (
        set FAILED=1
    )

    if %FAILED% == 0 (
        echo ... OK
        echo %2_enabled = yes >> %PROJECT_CONFIG%
    ) else (
        echo ... Not Found
        echo %2_enabled = no >> %PROJECT_CONFIG%
    )

    cd %CURRENT_PWD%
endlocal&goto :EOF

:compileTests

echo.
echo Start of compile tests
REM compile tests go here.
call :compileTest LBT lbt
echo End of compile tests

if not exist "%BUILD_PATH%\features" mkdir %BUILD_PATH%\features
echo "Generating Mobility Headers..."
rd /s /q %BUILD_PATH%\include
mkdir %BUILD_PATH%\include
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\global
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\bearer
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\publishsubscribe
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\location
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\serviceframework
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\systeminfo
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\contacts
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\multimedia
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\messaging

if exist config.pri del config.pri
ren %PROJECT_CONFIG% config.pri

echo.
echo Running qmake...
%QT_PATH%qmake -recursive %VC_TEMPLATE_OPTION% %SOURCE_PATH%\qtmobility.pro
if errorlevel 1 goto qmakeRecError
echo.
echo configure has finished. You may run %MAKE% to build the project now.
goto exitTag

:qmakeRecError
echo.
echo configure failed.

:exitTag

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
:: All rights reserved.
:: Contact: Nokia Corporation (qt-info@nokia.com)
::
:: This file is part of the Qt Mobility Components.
::
:: $QT_BEGIN_LICENSE:LGPL$
:: No Commercial Usage
:: This file contains pre-release code and may not be distributed.
:: You may use this file in accordance with the terms and conditions
:: contained in the Technology Preview License Agreement accompanying
:: this package.
::
:: GNU Lesser General Public License Usage
:: Alternatively, this file may be used under the terms of the GNU Lesser
:: General Public License version 2.1 as published by the Free Software
:: Foundation and appearing in the file LICENSE.LGPL included in the
:: packaging of this file.  Please review the following information to
:: ensure the GNU Lesser General Public License version 2.1 requirements
:: will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
::
:: In addition, as a special exception, Nokia gives you certain additional
:: rights.  These rights are described in the Nokia Qt LGPL Exception
:: version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
::
:: If you have questions regarding the use of this file, please contact
:: Nokia at qt-info@nokia.com.
::
::
::
::
::
::
::
::
:: $QT_END_LICENSE$
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

@echo off

set QT_MOBILITY_PREFIX= C:\QtMobility
set BUILD_PATH=%CD%
set SOURCE_PATH= %~dp0
cd /D %SOURCE_PATH%
set SOURCE_PATH=%CD%
cd /D %BUILD_PATH%

set PROJECT_CONFIG= %BUILD_PATH%\config.in
set PROJECT_LOG= %BUILD_PATH%\config.log
set RELEASEMODE=release
set QT_MOBILITY_LIB=
set BUILD_UNITTESTS=no
set BUILD_EXAMPLES=no
set CONTACTS_PLUGIN=
set VC_TEMPLATE_OPTION=
set QT_PATH=
set QMAKE_CACHE=%BUILD_PATH%\.qmake.cache

if exist "%QMAKE_CACHE%" del %QMAKE_CACHE%
if exist "%PROJECT_LOG%" del %PROJECT_LOG%
if exist "%PROJECT_CONFIG%" del %PROJECT_CONFIG%

echo QT_MOBILITY_SOURCE_TREE = %SOURCE_PATH% > %QMAKE_CACHE%
echo QT_MOBILITY_BUILD_TREE = %BUILD_PATH% >> %QMAKE_CACHE%

:cmdline_parsing

if "%1" == ""               goto startProcessing
if "%1" == "-debug"         goto debugTag
if "%1" == "-release"       goto releaseTag
if "%1" == "-silent"        goto silentTag
if "%1" == "-prefix"        goto prefixTag
if "%1" == "-libdir"        goto libTag
if "%1" == "-bindir"        goto binTag
if "%1" == "-headerdir"     goto headerTag
if "%1" == "-tests"         goto testTag
if "%1" == "-examples"      goto exampleTag
if "%1" == "-contact-src"   goto contactsTag
if "%1" == "-qt"            goto qtTag
if "%1" == "-vc"            goto vcTag
if "%1" == "/?"             goto usage
if "%1" == "-h"             goto usage
if "%1" == "-help"          goto usage
if "%1" == "--help"         goto usage

echo Unknown option: "%1"
goto usage

:usage
echo Usage: configure.bat [-prefix (dir)] [headerdir (dir)] [libdir (dir)]
    echo                  [-bindir (dir)] [-tests] [-examples]
    echo                  [-debug] [-release] [-silent]
    echo.
    echo Options:
    echo.
    echo -prefix (dir) ..... This will install everything relative to dir
    echo                     (default prefix: C:\QtMobility)
    echo -headerdir (dir) .. Header files will be installed to dir
    echo                     (default prefix: PREFIX/include)
    echo -libdir (dir) ..... Libraries will be installed to dir
    echo                     (default PREFIX/lib)
    echo -bindir (dir) ..... Executables will be installed to dir
    echo                     (default PREFIX/bin)
    echo -debug ............ Build with debugging symbols
    echo -release .......... Build without debugging symbols
    echo -silent ........... Reduces build output
    echo -tests ............ Build unit tests (not build by default)
    echo                     Note, this adds test symbols to all libraries
    echo                     and should not be used for release builds.
    echo -examples ......... Build example applications
    echo -vc ............... Generate Visual Studio make files
    echo -contact-src (backend) ...
    echo                     Compile the specified contacts API backend. Not selecting any backend
    echo                     will result in default selection for build platform
    echo                     options: symbian, wince, memory, maemo

if exist "%PROJECT_CONFIG%" del %PROJECT_CONFIG%
goto exitTag

:qtTag
shift
set QT_PATH=%1\
shift
goto cmdline_parsing

:contactsTag
shift
set CONTACTS_PLUGIN=%CONTACTS_PLUGIN% %1
shift
goto cmdline_parsing

:debugTag
if "%RELEASEMODE%" == "release" set RELEASEMODE=debug
shift
goto cmdline_parsing

:releaseTag
if "%RELEASEMODE%" == "debug"   set RELEASEMODE=release
shift
goto cmdline_parsing

:silentTag
echo CONFIG += silent > %PROJECT_CONFIG%
shift
goto cmdline_parsing

:prefixTag
shift
set QT_MOBILITY_PREFIX=%1
shift
goto cmdline_parsing

:libTag
shift
echo QT_MOBILITY_LIB = %1 >> %PROJECT_CONFIG%
shift
goto cmdline_parsing

:binTag
shift
echo QT_MOBILITY_BIN = %1 >> %PROJECT_CONFIG%
shift
goto cmdline_parsing

:headerTag
shift
echo QT_MOBILITY_INCLUDE = %1 >> %PROJECT_CONFIG%
shift
goto cmdline_parsing

:testTag
set BUILD_UNITTESTS=yes
shift
goto cmdline_parsing

:exampleTag
set BUILD_EXAMPLES=yes
shift
goto cmdline_parsing

:vcTag
shift
set VC_TEMPLATE_OPTION=-tp vc
goto cmdline_parsing

:startProcessing

echo CONFIG += %RELEASEMODE% >> %PROJECT_CONFIG%
echo CONTACTS_BACKENDS = %CONTACTS_PLUGIN% >> %PROJECT_CONFIG%

set CURRENTDIR=%CD%
echo %CURRENTDIR%
if exist %QT_MOBILITY_PREFIX% goto prefixExists
mkdir %QT_MOBILITY_PREFIX%
if errorlevel 1 goto invalidPrefix
cd /D %QT_MOBILITY_PREFIX%
set QT_MOBILITY_PREFIX=%CD%
cd /D %CURRENTDIR%
rd /S /Q %QT_MOBILITY_PREFIX%
goto endprefixProcessing

:invalidPrefix
echo "%QT_MOBILITY_PREFIX%" is not a valid directory path.
goto :exitTag

:prefixExists
cd /D %QT_MOBILITY_PREFIX%
set QT_MOBILITY_PREFIX=%CD%
cd /D %CURRENTDIR%

:endprefixProcessing
echo QT_MOBILITY_PREFIX = %QT_MOBILITY_PREFIX% >> %PROJECT_CONFIG%

echo build_unit_tests = %BUILD_UNITTESTS% >> %PROJECT_CONFIG%
echo build_examples = %BUILD_EXAMPLES% >> %PROJECT_CONFIG%
echo qmf_enabled = no >> %PROJECT_CONFIG%

echo isEmpty($$QT_MOBILITY_INCLUDE):QT_MOBILITY_INCLUDE=$$QT_MOBILITY_PREFIX/include >> %PROJECT_CONFIG%
echo isEmpty($$QT_MOBILITY_LIB):QT_MOBILITY_LIB=$$QT_MOBILITY_PREFIX/lib >> %PROJECT_CONFIG%
echo isEmpty($$QT_MOBILITY_BIN):QT_MOBILITY_BIN=$$QT_MOBILITY_PREFIX/bin >> %PROJECT_CONFIG%

copy %PROJECT_CONFIG% %BUILD_PATH%\config.pri
del %PROJECT_CONFIG%

echo Checking available Qt
%QT_PATH%qmake -v >> %PROJECT_LOG% 2>&1
if errorlevel 1 goto qmakeNotFound
goto qmakeFound
:qmakeNotFound
echo ... Not found  >> %PROJECT_LOG% 2>&1
if "%QT_PATH%" == "" (
    echo >&2 "Cannot find 'qmake' in your PATH."
) else (
    else echo >&2 "Cannot find 'qmake' in %QT_PATH%."
)
echo >&2 "Aborting."
goto exitTag

:qmakeFound
%QT_PATH%qmake -query QT_VERSION

goto checkMake

:makeTest
setlocal
    set CURRENT_PWD=%CD%

    if %BUILD_PATH% == %SOURCE_PATH% (
        cd %SOURCE_PATH%\config.tests\make
        if exist make del make
    ) else (
        rmdir /S /Q config.tests\make
        mkdir config.tests\make
        cd config.tests\make
    )

    for /f "tokens=3" %%i in ('%QT_PATH%qmake %SOURCE_PATH%\config.tests\make\make.pro 2^>^&1 1^>NUL') do set MAKETYPE=%%i

    if %MAKETYPE% == symbian-abld (
        make -h >> %PROJECT_LOG% 2>&1
        if not errorlevel 1 (
            echo ... Symbian abld make found.
            set MAKE=make
        )
    ) else if %MAKETYPE% == symbian-sbsv2 (
        make -h >> %PROJECT_LOG% 2>&1
        if not errorlevel 1 (
            echo ... Symbian sbsv2 make found.
            set MAKE=make
        )
    ) else if %MAKETYPE% == win32-nmake (
        nmake /? >> %PROJECT_LOG% 2>&1
        if not errorlevel 1 (
            echo ... nmake found.
            set MAKE=nmake
        )
    ) else if %MAKETYPE% == win32-mingw (
        mingw32-make -v >> %PROJECT_LOG% 2>&1
        if not errorlevel 1 (
            echo ... mingw32-make found.
            set MAKE=mingw32-make
        )
    ) else (
        echo ... Unknown target environment %MAKETYPE%.
    )
    cd %CURRENT_PWD%
endlocal&set %1=%MAKE%&set %2=%MAKETYPE%&goto :EOF

:checkMake
echo Checking make
call :makeTest MAKE MAKETYPE
if not "%MAKE%" == "" goto compileTests

echo >&2 "Cannot find 'nmake', 'mingw32-make' or 'make' in your PATH"
echo >&2 "Aborting."

goto exitTag

:compileTest
setlocal
    echo Checking %1
    set CURRENT_PWD=%CD%

    if %BUILD_PATH% == %SOURCE_PATH% (
        cd %SOURCE_PATH%\config.tests\%2
        if exist %2 del %2
    ) else (
        rmdir /S /Q config.tests\%2
        mkdir config.tests\%2
        cd config.tests\%2
    )

    %QT_PATH%qmake %SOURCE_PATH%\config.tests\%2\%2.pro >> %PROJECT_LOG% 2>&1
    %MAKE% clean >> %PROJECT_LOG%
    %MAKE% >> %PROJECT_LOG% 2>&1

    set FAILED=0
    if %MAKETYPE% == symbian-sbsv2 (
        for /f "tokens=2" %%i in ('%MAKE% SBS^="@sbs --check"') do set FAILED=1
    ) else if %MAKETYPE% == symbian-abld (
        for /f "tokens=2" %%i in ('%MAKE% ABLD^="@ABLD.BAT -c"') do set FAILED=1
    ) else if errorlevel 1 (
        set FAILED=1
    )

    if %FAILED% == 0 (
        echo ... OK
        echo %2_enabled = yes >> %PROJECT_CONFIG%
    ) else (
        echo ... Not Found
        echo %2_enabled = no >> %PROJECT_CONFIG%
    )

    cd %CURRENT_PWD%
endlocal&goto :EOF

:compileTests

echo.
echo Start of compile tests
REM compile tests go here.
call :compileTest LBT lbt
echo End of compile tests

if not exist "%BUILD_PATH%\features" mkdir %BUILD_PATH%\features
echo "Generating Mobility Headers..."
rd /s /q %BUILD_PATH%\include
mkdir %BUILD_PATH%\include
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\global
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\bearer
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\publishsubscribe
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\location
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\serviceframework
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\systeminfo
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\contacts
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\multimedia
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\messaging

if exist config.pri del config.pri
ren %PROJECT_CONFIG% config.pri

echo.
echo Running qmake...
%QT_PATH%qmake -recursive %VC_TEMPLATE_OPTION% %SOURCE_PATH%\qtmobility.pro
if errorlevel 1 goto qmakeRecError
echo.
echo configure has finished. You may run %MAKE% to build the project now.
goto exitTag

:qmakeRecError
echo.
echo configure failed.

:exitTag

Fix typo.

Fix typo.


@rem This is a simple batch script to remove a submodule reference from a
@rem working directory
@rem Call the script by
@rem 1) cd path\to\your\workspace
@rem 2) path\to\removeSubmodule.bat submoduleName

@rem See https://stackoverflow.com/questions/1260748/how-do-i-remove-a-git-submodule for more details

@echo Removing submodule %1
git submodule deinit %1
git rm %1
git rm --cached %1
rm -rf .git/modules/%1

Add batch script to remove a git submodule from a local workspace


export LIBPQ_INC=../ngx_postgres-1.0rc7/include
export LIBPQ_LIB=../ngx_postgres-1.0rc7/lib
export LUAJIT_INC=../luajit-root/luajit/include/luajit-2.1
export LUAJIT_LIB=../luajit-root/luajit/lib

./configure --with-cc=cl --builddir=objs --prefix= --conf-path=conf/nginx.conf --pid-path=logs/nginx.pid --http-log-path=logs/access.log --error-log-path=logs/error.log --sbin-path=nginx.exe --http-client-body-temp-path=temp/client_body_temp --http-proxy-temp-path=temp/proxy_temp --http-fastcgi-temp-path=temp/fastcgi_temp --http-scgi-temp-path=temp/scgi_temp --http-uwsgi-temp-path=temp/uwsgi_temp --with-cc-opt=-DFD_SETSIZE=32768 --with-pcre=objs/lib/pcre --with-zlib=objs/lib/zlib --with-openssl=objs/lib/openssl --with-select_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_stub_status_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_slice_module --with-mail --with-stream --with-http_ssl_module --with-mail_ssl_module --with-stream_ssl_module --with-http_v2_module --add-module=../ngx_devel_kit-0.3.0 --add-module=../echo-nginx-module-0.60 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.31 --add-module=../ngx_postgres-1.0rc7 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.06 --add-module=../ngx_lua --add-module=../ngx_lua_upstream-0.06 --add-module=../headers-more-nginx-module-0.32 --add-module=../array-var-nginx-module-0.05 --add-module=../nginx-http-concat-module --add-module=../rds-json-nginx-module-0.14  --add-module=../redis2-nginx-module-0.13

export LIBPQ_INC=../ngx_postgres-1.0rc7/include
export LIBPQ_LIB=../ngx_postgres-1.0rc7/lib
export LUAJIT_INC=../luajit-root/luajit/include/luajit-2.1
export LUAJIT_LIB=../luajit-root/luajit/lib

./configure --with-cc=cl --builddir=objs --prefix= --conf-path=conf/nginx.conf --pid-path=logs/nginx.pid --http-log-path=logs/access.log --error-log-path=logs/error.log --sbin-path=nginx.exe --http-client-body-temp-path=temp/client_body_temp --http-proxy-temp-path=temp/proxy_temp --http-fastcgi-temp-path=temp/fastcgi_temp --http-scgi-temp-path=temp/scgi_temp --http-uwsgi-temp-path=temp/uwsgi_temp --with-cc-opt=-DFD_SETSIZE=32768 --with-pcre=objs/lib/pcre --with-zlib=objs/lib/zlib --with-openssl=objs/lib/openssl --with-select_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_stub_status_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_slice_module --with-mail --with-stream --with-http_ssl_module --with-mail_ssl_module --with-stream_ssl_module --with-http_v2_module --add-module=../ngx_devel_kit-0.3.0 --add-module=../echo-nginx-module-0.60 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.31 --add-module=../ngx_postgres-1.0rc7 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.06 --add-module=../ngx_lua --add-module=../ngx_lua_upstream-0.06 --add-module=../headers-more-nginx-module-0.32 --add-module=../array-var-nginx-module-0.05 --add-module=../nginx-http-concat-module --add-module=../rds-json-nginx-module-0.14  --add-module=../redis2-nginx-module-0.14

update config.bat

update config.bat

Signed-off-by: zqzjz0911 <ddfdd5fdebc89f7a0d0aba4c5c06c8f1e3f38030@gmail.com>


@echo off
if "%OS%" == "Windows_NT" goto WinNT
REM for 9x/Me you better not have more than 9 args
python -c "import SCons.Script; SCons.Script.main()" %1 %2 %3 %4 %5 %6 %7 %8 %9
REM no way to set exit status of this script for 9x/Me
goto endscons
:WinNT
python -c "import SCons.Script; SCons.Script.main()" %*
if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endscons
if errorlevel 9009 echo you do not have python in your PATH
REM color 00 causes this script to exit with non-zero exit status
if errorlevel 1 color 00
:endscons

@echo off
if "%OS%" == "Windows_NT" goto WinNT
REM for 9x/Me you better not have more than 9 args
python -c "from os.path import join; import sys; sys.path = [ join(sys.prefix, 'scons-__VERSION__'), join(sys.prefix, 'scons')] + sys.path; import SCons.Script; SCons.Script.main()" %1 %2 %3 %4 %5 %6 %7 %8 %9
REM no way to set exit status of this script for 9x/Me
goto endscons
:WinNT
python -c "from os.path import join; import sys; sys.path = [ join(sys.prefix, 'scons-__VERSION__'), join(sys.prefix, 'scons')] + sys.path; import SCons.Script; SCons.Script.main()" %*
if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endscons
if errorlevel 9009 echo you do not have python in your PATH
REM color 00 causes this script to exit with non-zero exit status
if errorlevel 1 color 00
:endscons

Fix the scons.bat file for the new library packaging.


@ECHO OFF
SETLOCAL

SET build_dir=build
SET src_dir=src
SET samp_src_dir=%src_dir%\sample
SET samp_test_src_dir=test\sample
SET obj_dir=%build_dir%\obj
SET lib_dir=%build_dir%\lib
SET inc_dir=%build_dir%\include

SET cc=clang
SET cflags=-Wall -Wextra -Wno-deprecated-declarations -pedantic -Werror -std=c11 -Os -v

RMDIR /S /Q %build_dir%

ECHO:
ECHO Build CinyTest Library...
MKDIR %obj_dir%
%cc% %cflags% -iquote%src_dir% -c %src_dir%\ciny.c -o %obj_dir%\ciny.obj
IF "%ERRORLEVEL%" NEQ "0" GOTO end

%cc% %cflags% -iquote%src_dir% -c %src_dir%\ciny_win.c -o %obj_dir%\ciny_win.obj
IF "%ERRORLEVEL%" NEQ "0" GOTO end

MKDIR %lib_dir%
LIB %obj_dir%\ciny.obj %obj_dir%\ciny_win.obj /OUT:%lib_dir%\cinytest.lib /VERBOSE /NOLOGO
IF "%ERRORLEVEL%" NEQ "0" GOTO end

MKDIR %inc_dir%
COPY %src_dir%\ciny.h %inc_dir%
IF "%ERRORLEVEL%" NEQ "0" GOTO end

ECHO:
ECHO Build CinyTest Sample...
%cc% %cflags% -iquote%samp_src_dir% %samp_src_dir%\binarytree.c %samp_src_dir%\main.c -o %build_dir%\sample.exe
IF "%ERRORLEVEL%" NEQ "0" GOTO end

ECHO:
ECHO Build CinyTest Sample Tests...
%cc% %cflags% -Wno-gnu-zero-variadic-macro-arguments -Wno-unused-parameter -iquote%build_dir%\include -iquote%samp_src_dir% ^
	-L%lib_dir% -lcinytest %samp_src_dir%\binarytree.c %samp_test_src_dir%\main.c %samp_test_src_dir%\binarytree_tests.c ^
	-o %build_dir%\sampletests.exe
IF "%ERRORLEVEL%" NEQ "0" GOTO end

:end
ENDLOCAL
EXIT /B %ERRORLEVEL%

@ECHO OFF
SETLOCAL

SET build_dir=build
SET src_dir=src
SET samp_src_dir=%src_dir%\sample
SET samp_test_src_dir=test\sample
SET obj_dir=%build_dir%\obj
SET lib_dir=%build_dir%\lib
SET inc_dir=%build_dir%\include

SET cc=clang
SET cflags=-Wall -Wextra -Werror -pedantic -Wno-deprecated-declarations -std=c11 -Os -v

RMDIR /S /Q %build_dir%

ECHO:
ECHO Build CinyTest Library...
MKDIR %obj_dir%
%cc% %cflags% -iquote%src_dir% -c %src_dir%\ciny.c -o %obj_dir%\ciny.obj
IF "%ERRORLEVEL%" NEQ "0" GOTO end

%cc% %cflags% -iquote%src_dir% -c %src_dir%\ciny_win.c -o %obj_dir%\ciny_win.obj
IF "%ERRORLEVEL%" NEQ "0" GOTO end

MKDIR %lib_dir%
LIB %obj_dir%\ciny.obj %obj_dir%\ciny_win.obj /OUT:%lib_dir%\cinytest.lib /VERBOSE /NOLOGO
IF "%ERRORLEVEL%" NEQ "0" GOTO end

MKDIR %inc_dir%
COPY %src_dir%\ciny.h %inc_dir%
IF "%ERRORLEVEL%" NEQ "0" GOTO end

ECHO:
ECHO Build CinyTest Sample...
%cc% %cflags% -iquote%samp_src_dir% %samp_src_dir%\binarytree.c %samp_src_dir%\main.c -o %build_dir%\sample.exe
IF "%ERRORLEVEL%" NEQ "0" GOTO end

ECHO:
ECHO Build CinyTest Sample Tests...
%cc% %cflags% -Wno-gnu-zero-variadic-macro-arguments -Wno-unused-parameter -iquote%build_dir%\include -iquote%samp_src_dir% ^
	-L%lib_dir% -lcinytest %samp_src_dir%\binarytree.c %samp_test_src_dir%\main.c %samp_test_src_dir%\binarytree_tests.c ^
	-o %build_dir%\sampletests.exe
IF "%ERRORLEVEL%" NEQ "0" GOTO end

:end
ENDLOCAL
EXIT /B %ERRORLEVEL%

reorder cflags

reorder cflags


@echo off
setlocal
set mypath=%~dp0
set PYTHONPATH=pkgs
if "%PROCESSOR_ARCHITECTURE%"=="x86" (
    set common="%COMMONPROGRAMFILES%"
) else (
    set common="%COMMONPROGRAMFILES(x86)%"
)

REM Start the DbServer in background but within the same context
start "OpenQuake DB server" /B %common%\Python\2.7\python.exe -m openquake.server.dbserver

REM Make sure that the dbserver is up and running
echo Please wait ...
if exist C:\Windows\System32\timeout.exe (
    timeout /t 10 /nobreak > NUL
) else (
    REM Windows XP hack
    ping 192.0.2.2 -n 1 -w 10000 > NUL
)

REM Start the WebUI using django
%common%\Python\2.7\python.exe -m openquake.server.manage runserver %*

endlocal

@echo off
setlocal
set mypath=%~dp0
set PYTHONPATH=pkgs
if "%PROCESSOR_ARCHITECTURE%"=="x86" (
    set common="%COMMONPROGRAMFILES%"
) else (
    set common="%COMMONPROGRAMFILES(x86)%"
)

REM Start the DbServer in background but within the same context
start "OpenQuake DB server" /B %common%\Python\2.7\python.exe -m openquake.server.dbserver

REM Make sure that the dbserver is up and running
echo Please wait ...
if exist C:\Windows\System32\timeout.exe (
    timeout /t 10 /nobreak > NUL
) else (
    REM Windows XP hack
    ping 192.0.2.2 -n 1 -w 10000 > NUL
)

REM Create the DB or update it
%common%\Python\2.7\python.exe -m openquake.server.db.upgrade_manager

REM Start the WebUI using django
%common%\Python\2.7\python.exe -m openquake.server.manage runserver %*

endlocal

Make sure DB exists and is aligned before running the server


@echo off
setlocal
pushd %~dp0
cd ..
goto :start

:help
echo Usage: build [debug|release] [x64|x86] [nosync] [clean|noclean]
echo nosync - do not update the git submodules.
echo clean - only clean the build
echo noclean - do not clean the build, so do incemental build

goto :exit

:start
echo ============= Building P SDK on %COMPUTERNAME% ===============

Bld\nuget restore P.sln

set MSBuildPath=
for /F "usebackq tokens=1,2* delims= " %%i in (`reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0 -v MSBuildToolsPath`) do (
   if "%%i" == "MSBuildToolsPath" set MSBuildPath=%%k
)

if not "%MSBuildPath%"=="" goto :step2

echo MSBUILD 14.0 does not appear to be installed.
echo No info found in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0
goto :eof

:step2
set TAIL=%MSBuildPath:~-6%
if "[%TAIL%]" == "[amd64\]" set MSBuildPath=%MSBuildPath:~0,-6%"
set PATH=%PATH%;%MSBuildPath%
set Configuration=Debug
set Platform=x86
set NoSync=
set CleanOnly=
set NoClean=
set SubmoduleOutOfDate=false

:parseargs
if /I "%1"=="debug" set Configuration=Debug
if /I "%1"=="release" set Configuration=Release
if /I "%1"=="x86" set Platform=x86
if /I "%1"=="x64" set Platform=x64
if /I "%1"=="nosync" set NoSync=true
if /I "%1"=="clean" set CleanOnly=true
if /I "%1"=="noclean" set NoClean=true
if /I "%1"=="" goto :initsub
if /I "%1"=="/?" goto :help
if /I "%1"=="/h" goto :help
if /I "%1"=="/help" goto :help
if /I "%1"=="help" goto :help
shift
goto :parseargs

:initsub
if exist "Ext\Formula\README.md" goto :updatesub

echo ### Initializing your submodules
git submodule init
git submodule update
goto :sync

:checksubmodule
for /f "usebackq tokens=1,2*" %%i in (`git submodule summary %1`) do (
  if "%%j"=="%1" echo #### Submodule is out of date: %1 & set SubmoduleOutOfDate=true
)

goto :eof

:updatesub
if "%NoSync%"=="true" goto :nosync

echo ### Updating your submodules
call :checksubmodule Ext/Formula
call :checksubmodule Ext/Zing

if "%SubmoduleOutOfDate%"=="false" goto :nosync

:sync
echo ### Fixing your submodules so they are up to date...
git submodule sync --recursive
git submodule update --init --recursive
goto :nosync

:nosync
cd ext\zing

echo msbuild  Zing.sln /p:Platform=%Platform% /p:Configuration=Release
msbuild  Zing.sln /p:Platform=%Platform% /p:Configuration=Release
if ERRORLEVEL 1 goto :exit

set BinaryDrop=..\..\Bld\Drops\%Configuration%\%Platform%\Binaries
if NOT exist %BinaryDrop% mkdir %BinaryDrop%

for %%i in (zc\bin\%Platform%\Release\zc.exe
             ZingExplorer\bin\%Platform%\Release\ZingExplorer.dll
             Zinger\bin\%Platform%\Release\Zinger.exe
             Microsoft.Zing\bin\%Platform%\Release\Microsoft.Zing.dll
             Microsoft.Zing.Runtime\bin\%Platform%\Release\Microsoft.Zing.Runtime.dll
             Microsoft.Zing\bin\%Platform%\Release\Microsoft.Comega.dll
             Microsoft.Zing\bin\%Platform%\Release\Microsoft.Comega.Runtime.dll
             Resources\external\CCI\System.Compiler.dll
             Resources\external\CCI\System.Compiler.Framework.dll
             Resources\external\CCI\System.Compiler.Runtime.dll
             DelayingSchedulers\CustomDelayingScheduler\bin\%Platform%\Release\CustomDelayingScheduler.dll
             DelayingSchedulers\RandomDelayingScheduler\bin\%Platform%\Release\RandomDelayingScheduler.dll
             DelayingSchedulers\RoundRobinDelayingScheduler\bin\%Platform%\Release\RoundRobinDelayingScheduler.dll
             DelayingSchedulers\RunToCompletionDelayingScheduler\bin\%Platform%\Release\RunToCompletionDelayingScheduler.dll
	     DelayingSchedulers\SealingScheduler\bin\%Platform%\Release\SealingScheduler.dll) do (

    copy %%i %BinaryDrop%
)

cd ..\..
REM this code fixes a problem in MIDL compile by forcing recompile of these files for each configuration.
del Src\PrtDist\Core\NodeManager_c.c
del Src\PrtDist\Core\NodeManager_s.c

if "%NoClean%"=="true" goto :build
echo msbuild P.sln /p:Platform=%Platform% /p:Configuration=%Configuration%
msbuild  P.sln /p:Platform=%Platform% /p:Configuration=%Configuration% /t:Clean

:build
if "%CleanOnly%"=="true" goto :exit
msbuild P.sln /p:Platform=%Platform% /p:Configuration=%Configuration% /p:SOLVER=NOSOLVER

:exit
popd

@echo off
setlocal
pushd %~dp0
cd ..
goto :start

:help
echo Usage: build [debug|release] [x64|x86] [nosync] [clean|noclean]
echo nosync - do not update the git submodules.
echo clean - only clean the build
echo noclean - do not clean the build, so do incemental build

goto :exit

:start
echo ============= Building P SDK on %COMPUTERNAME% ===============

Bld\nuget restore P.sln

set MSBuildPath=
for /F "usebackq tokens=1,2* delims= " %%i in (`reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0 -v MSBuildToolsPath`) do (
   if "%%i" == "MSBuildToolsPath" set MSBuildPath=%%k
)

if not "%MSBuildPath%"=="" goto :step2

echo MSBUILD 14.0 does not appear to be installed.
echo No info found in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0
goto :eof

:step2
set TAIL=%MSBuildPath:~-6%
set Build64=0
if "[%TAIL%]" == "[amd64\]" set Build64=1
set PATH=%PATH%;%MSBuildPath%
set Configuration=Debug
set Platform=x86
set NoSync=
set CleanOnly=
set NoClean=
set SubmoduleOutOfDate=false

:parseargs
if /I "%1"=="debug" set Configuration=Debug
if /I "%1"=="release" set Configuration=Release
if /I "%1"=="x86" set Platform=x86
if /I "%1"=="x64" set Platform=x64
if /I "%1"=="nosync" set NoSync=true
if /I "%1"=="clean" set CleanOnly=true
if /I "%1"=="noclean" set NoClean=true
if /I "%1"=="" goto :initsub
if /I "%1"=="/?" goto :help
if /I "%1"=="/h" goto :help
if /I "%1"=="/help" goto :help
if /I "%1"=="help" goto :help
shift
goto :parseargs

:initsub
if exist "Ext\Formula\README.md" goto :updatesub

echo ### Initializing your submodules
git submodule init
git submodule update
goto :sync

:checksubmodule
for /f "usebackq tokens=1,2*" %%i in (`git submodule summary %1`) do (
  if "%%j"=="%1" echo #### Submodule is out of date: %1 & set SubmoduleOutOfDate=true
)

goto :eof

:updatesub
if "%NoSync%"=="true" goto :nosync

echo ### Updating your submodules
call :checksubmodule Ext/Formula
call :checksubmodule Ext/Zing

if "%SubmoduleOutOfDate%"=="false" goto :nosync

:sync
echo ### Fixing your submodules so they are up to date...
git submodule sync --recursive
git submodule update --init --recursive
goto :nosync

:nosync
cd ext\zing

echo msbuild  Zing.sln /p:Platform=%Platform% /p:Configuration=Release
msbuild  Zing.sln /p:Platform=%Platform% /p:Configuration=Release
if ERRORLEVEL 1 goto :exit

set BinaryDrop=..\..\Bld\Drops\%Configuration%\%Platform%\Binaries
if NOT exist %BinaryDrop% mkdir %BinaryDrop%

for %%i in (zc\bin\%Platform%\Release\zc.exe
             ZingExplorer\bin\%Platform%\Release\ZingExplorer.dll
             Zinger\bin\%Platform%\Release\Zinger.exe
             Microsoft.Zing\bin\%Platform%\Release\Microsoft.Zing.dll
             Microsoft.Zing.Runtime\bin\%Platform%\Release\Microsoft.Zing.Runtime.dll
             Microsoft.Zing\bin\%Platform%\Release\Microsoft.Comega.dll
             Microsoft.Zing\bin\%Platform%\Release\Microsoft.Comega.Runtime.dll
             Resources\external\CCI\System.Compiler.dll
             Resources\external\CCI\System.Compiler.Framework.dll
             Resources\external\CCI\System.Compiler.Runtime.dll
             DelayingSchedulers\CustomDelayingScheduler\bin\%Platform%\Release\CustomDelayingScheduler.dll
             DelayingSchedulers\RandomDelayingScheduler\bin\%Platform%\Release\RandomDelayingScheduler.dll
             DelayingSchedulers\RoundRobinDelayingScheduler\bin\%Platform%\Release\RoundRobinDelayingScheduler.dll
             DelayingSchedulers\RunToCompletionDelayingScheduler\bin\%Platform%\Release\RunToCompletionDelayingScheduler.dll
	     DelayingSchedulers\SealingScheduler\bin\%Platform%\Release\SealingScheduler.dll) do (

    copy %%i %BinaryDrop%
)

cd ..\..
REM this code fixes a problem in MIDL compile by forcing recompile of these files for each configuration.
del Src\PrtDist\Core\NodeManager_c.c
del Src\PrtDist\Core\NodeManager_s.c

if "%NoClean%"=="true" goto :build
echo msbuild P.sln /p:Platform=%Platform% /p:Configuration=%Configuration%  /t:Clean
msbuild  P.sln /p:Platform=%Platform% /p:Configuration=%Configuration% /t:Clean

:build

set FormulaCodeGeneratorTaskPlatform=x86
if "%Build64%"=="1" set FormulaCodeGeneratorTaskPlatform=x64
echo msbuild FormulaCodeGeneratorTask /p:Platform=%FormulaCodeGeneratorTaskPlatform% /p:Configuration=%Configuration%
msbuild  ext\Formula\src\Extensions\FormulaCodeGeneratorTask\FormulaCodeGeneratorTask.csproj /p:Platform=%FormulaCodeGeneratorTaskPlatform% /p:Configuration=%Configuration%

if "%CleanOnly%"=="true" goto :exit
msbuild P.sln /p:Platform=%Platform% /p:Configuration=%Configuration% /p:SOLVER=NOSOLVER

:exit
popd

Fix build.bat so that it builds the required version of FormulaCodeGeneratorTask.dll.


FOR /d /r . %d IN (_backups) DO @IF EXIST "%d" rd /s /q "%d"

rem find all directories called _backups and delete them and their contents
FOR /d /r . %%d IN (_backups) DO @IF EXIST "%%d" rd /s /q "%%d"

fix to delete backups.bat

fix to delete backups.bat


:: activate the python virtual environment
call .\.venv\Scripts\activate
:: build the .exe into a single file
pyinstaller --onefile .\src\play\controller\GTPengine.py
:: move the .exe from dist/ to toplevel
move .\dist\GTPengine.exe GTPengine.exe
:: remove file and folders that pyinstaller created
del GTPengine.spec
rd /S /Q dist
rd /S /Q build
:: remove (large) cache-files that pyinstaller created
rd /S /Q %APPDATA%\pyinstaller
pause

add windows script to build .exe and clean up afterwards


@ECHO OFF

SET FILE=1.cs
SET FILE2=2.cs
SET FILE3=3.cs
SET LEX=3.lex
SET LEX_LIST=3.lst
SET DATA_APP=data.exe

SET VS_DEV_BAT="%VS140COMNTOOLS%VsDevCmd.bat"

IF NOT EXIST %VS_DEV_BAT% (
    SET VS_DEV_BAT="%VS120COMNTOOLS%VsDevCmd.bat"
) ELSE (
    GOTO :MAIN
)

IF NOT EXIST %VS_DEV_BAT% (
    ECHO "There are no supported Visual Studio version installed on your machine!!!"
    GOTO :PAUSE
) ELSE (
	GOTO :MAIN
)

GOTO :PAUSE

GOTO :EOF

REM --------------MAIN START---------
:MAIN
ECHO Found %VS_DEV_BAT%
CALL :CLEAN

ShaderlabVS.LexTools.exe %LEX%
gplex %LEX%

CALL :WRITE_CS_ONE
CALL :WRITE_CS_TWO

CALL %VS_DEV_BAT%
ECHO Building
csc /target:exe /out:%DATA_APP% %FILE% %FILE2% %FILE3%

IF EXIST %DATA_APP% (
    %DATA_APP%
) ELSE (
    ECHO no data exe generated!!!
)

GOTO :CLEAN
GOTO :PAUSE

REM --------------MAIN END--------

:WRITE_CS_ONE

IF EXIST %FILE% (
    DEL /q %FILE%
)

echo namespace ShaderlabVS              >> %FILE%
echo {                                  >> %FILE%
echo    internal enum ShaderlabToken    >> %FILE%
echo    {                               >> %FILE%
echo       TEXT,                        >> %FILE%
echo        COMMENT,                    >> %FILE%
echo        STRING_LITERAL,             >> %FILE%
echo        HLSLCGKEYWORD,              >> %FILE%
echo        HLSLCGKEYWORDSPECIAL,       >> %FILE%
echo        HLSLCGDATATYPE,             >> %FILE%
echo        HLSLCGFUNCTION,             >> %FILE%
echo        UNITYKEYWORD,               >> %FILE%
echo        UNITYKEYWORD_PARA,          >> %FILE%
echo        UNITYVALUES,                >> %FILE%
echo        UNITYDATATYPE,              >> %FILE%
echo        UNITYFUNCTION,              >> %FILE%
echo        UNITYMACROS,                >> %FILE%
echo        UNDEFINED,                  >> %FILE%
echo    }                               >> %FILE%
echo }                                  >> %FILE%

GOTO :EOF

:WRITE_CS_TWO

IF EXIST %FILE2% (
    DEL /q %FILE2%
)

echo using ShaderlabVS.Lexer;                   >> %FILE2%
echo namespace ShaderlabVS.LexData              >> %FILE2%
echo {                                          >> %FILE2%
echo     class Program                          >> %FILE2%
echo     {                                      >> %FILE2%
echo         static void Main(string[] args)    >> %FILE2%
echo         {                                  >> %FILE2%
echo             Scanner.GenerateTableData();   >> %FILE2%
echo         }                                  >> %FILE2%
echo     }                                      >> %FILE2%
echo }                                          >> %FILE2%

GOTO :EOF

:CLEAN
DEL /q %FILE%
DEL /q %FILE2%
DEL /q %LEX%
DEL /q %LEX_LIST%
DEL /q %FILE3%
DEL /q %DATA_APP%
GOTO :EOF

:PAUSE
pause

:EOF

@ECHO OFF

SET FILE=1.cs
SET FILE2=2.cs
SET FILE3=3.cs
SET LEX=3.lex
SET LEX_LIST=3.lst
SET DATA_APP=data.exe

SET VS_DEV_BAT="%VS140COMNTOOLS%VsDevCmd.bat"

IF NOT EXIST %VS_DEV_BAT% (
    SET VS_DEV_BAT="%VS150COMNTOOLS%VsDevCmd.bat"
    IF NOT EXIST %VS_DEV_BAT% (
    	SET VS_DEV_BAT="%VS120COMNTOOLS%VsDevCmd.bat"
    )
) ELSE (
    GOTO :MAIN
)

IF NOT EXIST %VS_DEV_BAT% (
    ECHO "There are no supported Visual Studio version installed on your machine!!!"
    GOTO :PAUSE
) ELSE (
	GOTO :MAIN
)

GOTO :PAUSE

GOTO :EOF

REM --------------MAIN START---------
:MAIN
ECHO Found %VS_DEV_BAT%
CALL :CLEAN

ShaderlabVS.LexTools.exe %LEX%
gplex %LEX%

CALL :WRITE_CS_ONE
CALL :WRITE_CS_TWO

CALL %VS_DEV_BAT%
ECHO Building
csc /target:exe /out:%DATA_APP% %FILE% %FILE2% %FILE3%

IF EXIST %DATA_APP% (
    %DATA_APP%
) ELSE (
    ECHO no data exe generated!!!
)

GOTO :CLEAN
GOTO :PAUSE

REM --------------MAIN END--------

:WRITE_CS_ONE

IF EXIST %FILE% (
    DEL /q %FILE%
)

echo namespace ShaderlabVS              >> %FILE%
echo {                                  >> %FILE%
echo    internal enum ShaderlabToken    >> %FILE%
echo    {                               >> %FILE%
echo       TEXT,                        >> %FILE%
echo        COMMENT,                    >> %FILE%
echo        STRING_LITERAL,             >> %FILE%
echo        HLSLCGKEYWORD,              >> %FILE%
echo        HLSLCGKEYWORDSPECIAL,       >> %FILE%
echo        HLSLCGDATATYPE,             >> %FILE%
echo        HLSLCGFUNCTION,             >> %FILE%
echo        UNITYKEYWORD,               >> %FILE%
echo        UNITYKEYWORD_PARA,          >> %FILE%
echo        UNITYVALUES,                >> %FILE%
echo        UNITYDATATYPE,              >> %FILE%
echo        UNITYFUNCTION,              >> %FILE%
echo        UNITYMACROS,                >> %FILE%
echo        UNDEFINED,                  >> %FILE%
echo    }                               >> %FILE%
echo }                                  >> %FILE%

GOTO :EOF

:WRITE_CS_TWO

IF EXIST %FILE2% (
    DEL /q %FILE2%
)

echo using ShaderlabVS.Lexer;                   >> %FILE2%
echo namespace ShaderlabVS.LexData              >> %FILE2%
echo {                                          >> %FILE2%
echo     class Program                          >> %FILE2%
echo     {                                      >> %FILE2%
echo         static void Main(string[] args)    >> %FILE2%
echo         {                                  >> %FILE2%
echo             Scanner.GenerateTableData();   >> %FILE2%
echo         }                                  >> %FILE2%
echo     }                                      >> %FILE2%
echo }                                          >> %FILE2%

GOTO :EOF

:CLEAN
DEL /q %FILE%
DEL /q %FILE2%
DEL /q %LEX%
DEL /q %LEX_LIST%
DEL /q %FILE3%
DEL /q %DATA_APP%
GOTO :EOF

:PAUSE
pause

:EOF

Update UpdateLexData.cmd

Update UpdateLexData.cmd


setlocal EnableDelayedExpansion

if "%ARCH%"=="64" (
    set WIN64="WIN64=YES"
) else (
    set WIN64=
)

:: Work out MSVC_VER - needed for build process.
:: Currently guess from Python version
if  %vc% LEQ 9 set MSVC_VER=1500
if  %vc% GTR 9 set MSVC_VER=1900

:: Get the minor/major version of poppler from the %poppler% environment
:: variable that is set by conda-build
FOR /F "tokens=1,2 delims=." %%a IN ("%poppler%") DO (
  set POPPLER_MAJOR_VERSION=%%a
  set POPPLER_MINOR_VERSION=%%b
)
:: remove leading zeros
set /a POPPLER_MINOR_VERSION=10000%POPPLER_MINOR_VERSION% %% 10000

:: Need consistent flags between build and install.
set BLD_OPTS=%WIN64% ^
    MSVC_VER=%MSVC_VER% ^
    GDAL_HOME=%LIBRARY_PREFIX% ^
    BINDIR=%LIBRARY_BIN% ^
    LIBDIR=%LIBRARY_LIB% ^
    INCDIR=%LIBRARY_INC% ^
    DATADIR=%LIBRARY_PREFIX%\share\gdal ^
    DLLBUILD=1 ^
    BLOSC_CFLAGS="-I%LIBRARY_INC%" ^
    BLOSC_LIBS=%LIBRARY_LIB%\blosc.lib ^
    CURL_INC="-I%LIBRARY_INC%" ^
    CURL_LIB="%LIBRARY_LIB%\libcurl.lib wsock32.lib wldap32.lib winmm.lib" ^
    EXPAT_DIR=%LIBRARY_PREFIX% ^
    EXPAT_INCLUDE="-I%LIBRARY_INC%" ^
    EXPAT_LIB=%LIBRARY_LIB%\expat.lib ^
    FITS_PLUGIN=NO ^
    FITS_INC_DIR=%LIBRARY_INC% ^
    FITS_LIB="%LIBRARY_LIB%\cfitsio.lib" ^
    FREEXL_CFLAGS="-I%LIBRARY_INC%" ^
    FREEXL_LIBS=%LIBRARY_LIB%\freexl_i.lib ^
    GEOS_CFLAGS="-I%LIBRARY_INC% -DHAVE_GEOS" ^
    GEOS_DIR=%LIBRARY_PREFIX% ^
    GEOS_LIB=%LIBRARY_LIB%\geos_c.lib ^
    HDF4_DIR=%LIBRARY_PREFIX% ^
    HDF4_HAS_MAXOPENFILES=YES ^
    HDF4_LIB="%LIBRARY_LIB%\hdf.lib %LIBRARY_LIB%\mfhdf.lib %LIBRARY_LIB%\xdr.lib" ^
    HDF5_DIR=%LIBRARY_PREFIX% ^
    HDF5_LIB=%LIBRARY_LIB%\hdf5.lib ^
    HDF5_H5_IS_DLL=YES ^
    TILEDB_ENABLED=YES ^
    TILEDB_DIR=%LIBRARY_PREFIX% ^
    TILEDB_LIBS=%LIBRARY_LIB%\tiledb.lib ^
    JPEGDIR=%LIBRARY_INC% ^
    JPEG_EXTERNAL_LIB=1 ^
    JPEG_LIB=%LIBRARY_LIB%\libjpeg.lib ^
    KEA_CFLAGS="-I%LIBRARY_INC%" ^
    KEA_LIB="%LIBRARY_LIB%\hdf5_cpp.lib %LIBRARY_LIB%\libkea.lib" ^
    NETCDF_INC_DIR=%LIBRARY_INC% ^
    NETCDF_LIB=%LIBRARY_LIB%\netcdf.lib ^
    NETCDF_SETTING=yes ^
    NETCDF_HAS_NC4=yes ^
    OPENJPEG_CFLAGS="-I%LIBRARY_INC%\openjpeg-2.5" ^
    OPENJPEG_ENABLED=YES ^
    OPENJPEG_LIB=%LIBRARY_LIB%\openjp2.lib ^
    PG_INC_DIR=%LIBRARY_INC% ^
    PG_LIB=%LIBRARY_LIB%\libpq.lib ^
    PNGDIR=%LIBRARY_INC% ^
    PNG_EXTERNAL_LIB=1 ^
    PNG_LIB=%LIBRARY_LIB%\libpng.lib ^
    PROJ_FLAGS="-DPROJ_STATIC" ^
    PROJ_INCLUDE="-I%LIBRARY_INC%" ^
    PROJ_LIBRARY=%LIBRARY_LIB%\proj.lib ^
    SETARGV="\"%VCToolsInstallDir%\lib\x64\setargv.obj\"" ^
    SPATIALITE_412_OR_LATER=yes ^
    SQLITE_INC="-I%LIBRARY_INC% -DHAVE_SPATIALITE" ^
    SQLITE_LIB="%LIBRARY_LIB%\sqlite3.lib %LIBRARY_LIB%\spatialite_i.lib" ^
    TIFF_INC="-I%LIBRARY_INC%" ^
    TIFF_LIB=%LIBRARY_LIB%\tiff.lib ^
    TIFF_OPTS=-DBIGTIFF_SUPPORT ^
    XERCES_DIR=%LIBRARY_PREFIX% ^
    XERCES_INCLUDE="-I%LIBRARY_INC% -I%LIBRARY_INC%\xercesc" ^
    XERCES_LIB=%LIBRARY_LIB%\xerces-c_3.lib ^
    GEOTIFF_INC="-I%LIBRARY_INC%" ^
    GEOTIFF_LIB=%LIBRARY_LIB%\geotiff_i.lib ^
    LIBICONV_INCLUDE="-I%LIBRARY_INC% -DICONV_CONST= " ^
    LIBICONV_LIBRARY="%LIBRARY_LIB%\iconv.lib" ^
    POPPLER_ENABLED=YES ^
    POPPLER_CFLAGS="-I%LIBRARY_INC%\poppler -DPOPPLER_HAS_OPTCONTENT= -DPOPPLER_BASE_STREAM_HAS_TWO_ARGS= " ^
    POPPLER_MAJOR_VERSION=%POPPLER_MAJOR_VERSION% ^
    POPPLER_MINOR_VERSION=%POPPLER_MINOR_VERSION% ^
    POPPLER_LIBS="%LIBRARY_LIB%\poppler.lib /FORCE:MULTIPLE" ^
    WEBP_ENABLED=YES ^
    WEBP_CFLAGS="-I%LIBRARY_INC%" ^
    WEBP_LIBS="%LIBARY_LIB%\libwebp.lib" ^
    ZSTD_CFLAGS="-I%LIBRARY_INC%" ^
    ZSTD_LIBS="%LIBRARY_LIB%\libzstd.lib" ^
    LIBKML_DIR="%LIBRARY_PREFIX%" ^
    LIBKML_INCLUDE="-I%LIBRARY_INC%" ^
    LIBKML_LIBS="%LIBRARY_LIB%\kmlbase.lib %LIBRARY_LIB%\kmlconvenience.lib %LIBRARY_LIB%\kmldom.lib %LIBRARY_LIB%\kmlengine.lib %LIBRARY_LIB%\kmlregionator.lib %LIBRARY_LIB%\kmlxsd.lib %LIBRARY_LIB%\minizip.lib %LIBRARY_LIB%\uriparser.lib"

endlocal && set BLD_OPTS=%BLD_OPTS%

setlocal EnableDelayedExpansion

if "%ARCH%"=="64" (
    set WIN64="WIN64=YES"
) else (
    set WIN64=
)

:: Work out MSVC_VER - needed for build process.
:: Currently guess from Python version
if  %vc% LEQ 9 set MSVC_VER=1500
if  %vc% GTR 9 set MSVC_VER=1900

:: Get the minor/major version of poppler from the %poppler% environment
:: variable that is set by conda-build
FOR /F "tokens=1,2 delims=." %%a IN ("%poppler%") DO (
  set POPPLER_MAJOR_VERSION=%%a
  set POPPLER_MINOR_VERSION=%%b
)
:: remove leading zeros
set /a POPPLER_MINOR_VERSION=10000%POPPLER_MINOR_VERSION% %% 10000

:: Need consistent flags between build and install.
set BLD_OPTS=%WIN64% ^
    MSVC_VER=%MSVC_VER% ^
    GDAL_HOME=%LIBRARY_PREFIX% ^
    BINDIR=%LIBRARY_BIN% ^
    LIBDIR=%LIBRARY_LIB% ^
    INCDIR=%LIBRARY_INC% ^
    DATADIR=%LIBRARY_PREFIX%\share\gdal ^
    DLLBUILD=1 ^
    BLOSC_CFLAGS="-I%LIBRARY_INC%" ^
    BLOSC_LIBS=%LIBRARY_LIB%\blosc.lib ^
    CURL_INC="-I%LIBRARY_INC%" ^
    CURL_LIB="%LIBRARY_LIB%\libcurl.lib wsock32.lib wldap32.lib winmm.lib" ^
    EXPAT_DIR=%LIBRARY_PREFIX% ^
    EXPAT_INCLUDE="-I%LIBRARY_INC%" ^
    EXPAT_LIB=%LIBRARY_LIB%\expat.lib ^
    FITS_PLUGIN=NO ^
    FITS_INC_DIR=%LIBRARY_INC% ^
    FITS_LIB="%LIBRARY_LIB%\cfitsio.lib" ^
    FREEXL_CFLAGS="-I%LIBRARY_INC%" ^
    FREEXL_LIBS=%LIBRARY_LIB%\freexl_i.lib ^
    GEOS_CFLAGS="-I%LIBRARY_INC% -DHAVE_GEOS" ^
    GEOS_DIR=%LIBRARY_PREFIX% ^
    GEOS_LIB=%LIBRARY_LIB%\geos_c.lib ^
    HDF4_DIR=%LIBRARY_PREFIX% ^
    HDF4_HAS_MAXOPENFILES=YES ^
    HDF4_LIB="%LIBRARY_LIB%\hdf.lib %LIBRARY_LIB%\mfhdf.lib %LIBRARY_LIB%\xdr.lib" ^
    HDF5_DIR=%LIBRARY_PREFIX% ^
    HDF5_LIB=%LIBRARY_LIB%\hdf5.lib ^
    HDF5_H5_IS_DLL=YES ^
    TILEDB_ENABLED=YES ^
    TILEDB_DIR=%LIBRARY_PREFIX% ^
    TILEDB_LIBS=%LIBRARY_LIB%\tiledb.lib ^
    JPEGDIR=%LIBRARY_INC% ^
    JPEG_EXTERNAL_LIB=1 ^
    JPEG_LIB=%LIBRARY_LIB%\libjpeg.lib ^
    KEA_CFLAGS="-I%LIBRARY_INC%" ^
    KEA_LIB="%LIBRARY_LIB%\hdf5_cpp.lib %LIBRARY_LIB%\libkea.lib" ^
    NETCDF_INC_DIR=%LIBRARY_INC% ^
    NETCDF_LIB=%LIBRARY_LIB%\netcdf.lib ^
    NETCDF_SETTING=yes ^
    NETCDF_HAS_NC4=yes ^
    OPENJPEG_CFLAGS="-I%LIBRARY_INC%\openjpeg-%openjpeg%" ^
    OPENJPEG_ENABLED=YES ^
    OPENJPEG_LIB=%LIBRARY_LIB%\openjp2.lib ^
    PG_INC_DIR=%LIBRARY_INC% ^
    PG_LIB=%LIBRARY_LIB%\libpq.lib ^
    PNGDIR=%LIBRARY_INC% ^
    PNG_EXTERNAL_LIB=1 ^
    PNG_LIB=%LIBRARY_LIB%\libpng.lib ^
    PROJ_FLAGS="-DPROJ_STATIC" ^
    PROJ_INCLUDE="-I%LIBRARY_INC%" ^
    PROJ_LIBRARY=%LIBRARY_LIB%\proj.lib ^
    SETARGV="\"%VCToolsInstallDir%\lib\x64\setargv.obj\"" ^
    SPATIALITE_412_OR_LATER=yes ^
    SQLITE_INC="-I%LIBRARY_INC% -DHAVE_SPATIALITE" ^
    SQLITE_LIB="%LIBRARY_LIB%\sqlite3.lib %LIBRARY_LIB%\spatialite_i.lib" ^
    TIFF_INC="-I%LIBRARY_INC%" ^
    TIFF_LIB=%LIBRARY_LIB%\tiff.lib ^
    TIFF_OPTS=-DBIGTIFF_SUPPORT ^
    XERCES_DIR=%LIBRARY_PREFIX% ^
    XERCES_INCLUDE="-I%LIBRARY_INC% -I%LIBRARY_INC%\xercesc" ^
    XERCES_LIB=%LIBRARY_LIB%\xerces-c_3.lib ^
    GEOTIFF_INC="-I%LIBRARY_INC%" ^
    GEOTIFF_LIB=%LIBRARY_LIB%\geotiff_i.lib ^
    LIBICONV_INCLUDE="-I%LIBRARY_INC% -DICONV_CONST= " ^
    LIBICONV_LIBRARY="%LIBRARY_LIB%\iconv.lib" ^
    POPPLER_ENABLED=YES ^
    POPPLER_CFLAGS="-I%LIBRARY_INC%\poppler -DPOPPLER_HAS_OPTCONTENT= -DPOPPLER_BASE_STREAM_HAS_TWO_ARGS= " ^
    POPPLER_MAJOR_VERSION=%POPPLER_MAJOR_VERSION% ^
    POPPLER_MINOR_VERSION=%POPPLER_MINOR_VERSION% ^
    POPPLER_LIBS="%LIBRARY_LIB%\poppler.lib /FORCE:MULTIPLE" ^
    WEBP_ENABLED=YES ^
    WEBP_CFLAGS="-I%LIBRARY_INC%" ^
    WEBP_LIBS="%LIBARY_LIB%\libwebp.lib" ^
    ZSTD_CFLAGS="-I%LIBRARY_INC%" ^
    ZSTD_LIBS="%LIBRARY_LIB%\libzstd.lib" ^
    LIBKML_DIR="%LIBRARY_PREFIX%" ^
    LIBKML_INCLUDE="-I%LIBRARY_INC%" ^
    LIBKML_LIBS="%LIBRARY_LIB%\kmlbase.lib %LIBRARY_LIB%\kmlconvenience.lib %LIBRARY_LIB%\kmldom.lib %LIBRARY_LIB%\kmlengine.lib %LIBRARY_LIB%\kmlregionator.lib %LIBRARY_LIB%\kmlxsd.lib %LIBRARY_LIB%\minizip.lib %LIBRARY_LIB%\uriparser.lib"

endlocal && set BLD_OPTS=%BLD_OPTS%

Generalize openjpeg include path

Generalize openjpeg include path

Co-authored-by: Mark Harfouche <1661e706fb4ac840f22b2defa89ccdf03c800b8d@gmail.com>


setlocal EnableDelayedExpansion

if "%ARCH%"=="64" (
    set WIN64="WIN64=YES"
) else (
    set WIN64=
)

:: Work out MSVC_VER - needed for build process.
:: Currently guess from Python version
if  %vc% LEQ 9 set MSVC_VER=1500
if  %vc% GTR 9 set MSVC_VER=1900

:: Get the minor/major version of poppler from the %poppler% environment
:: variable that is set by conda-build
FOR /F "tokens=1,2 delims=." %%a IN ("%poppler%") DO (
  set POPPLER_MAJOR_VERSION=%%a
  set POPPLER_MINOR_VERSION=%%b
)

:: Need consistent flags between build and install.
set BLD_OPTS=%WIN64% ^
    MSVC_VER=%MSVC_VER% ^
    GDAL_HOME=%LIBRARY_PREFIX% ^
    BINDIR=%LIBRARY_BIN% ^
    LIBDIR=%LIBRARY_LIB% ^
    INCDIR=%LIBRARY_INC% ^
    DATADIR=%LIBRARY_PREFIX%\share\gdal ^
    HTMLDIR=%LIBRARY_PREFIX%\share\doc\gdal ^
    CURL_INC="-I%LIBRARY_INC%" ^
    CURL_LIB="%LIBRARY_LIB%\libcurl.lib wsock32.lib wldap32.lib winmm.lib" ^
    EXPAT_DIR=%LIBRARY_PREFIX% ^
    EXPAT_INCLUDE="-I%LIBRARY_INC%" ^
    EXPAT_LIB=%LIBRARY_LIB%\expat.lib ^
    FITS_PLUGIN=NO ^
    FITS_INC_DIR=%LIBRARY_INC% ^
    FITS_LIB="%LIBRARY_LIB%\cfitsio.lib" ^
    FREEXL_CFLAGS="-I%LIBRARY_INC%" ^
    FREEXL_LIBS=%LIBRARY_LIB%\freexl_i.lib ^
    GEOS_CFLAGS="-I%LIBRARY_INC% -DHAVE_GEOS" ^
    GEOS_DIR=%LIBRARY_PREFIX% ^
    GEOS_LIB=%LIBRARY_LIB%\geos_c.lib ^
    HDF4_DIR=%LIBRARY_PREFIX% ^
    HDF4_HAS_MAXOPENFILES=YES ^
    HDF4_LIB="%LIBRARY_LIB%\hdf.lib %LIBRARY_LIB%\mfhdf.lib %LIBRARY_LIB%\xdr.lib" ^
    HDF5_DIR=%LIBRARY_PREFIX% ^
    HDF5_LIB=%LIBRARY_LIB%\hdf5.lib ^
    HDF5_H5_IS_DLL=YES ^
    TILEDB_ENABLED=YES ^
    TILEDB_DIR=%LIBRARY_PREFIX% ^
    TILEDB_LIBS=%LIBRARY_LIB%\tiledb.lib ^
    JPEGDIR=%LIBRARY_INC% ^
    JPEG_EXTERNAL_LIB=1 ^
    JPEG_LIB=%LIBRARY_LIB%\libjpeg.lib ^
    KEA_CFLAGS="-I%LIBRARY_INC%" ^
    KEA_LIB="%LIBRARY_LIB%\hdf5_cpp.lib %LIBRARY_LIB%\libkea.lib" ^
    NETCDF_INC_DIR=%LIBRARY_INC% ^
    NETCDF_LIB=%LIBRARY_LIB%\netcdf.lib ^
    NETCDF_SETTING=yes ^
    NETCDF_HAS_NC4=yes ^
    OPENJPEG_CFLAGS="-I%LIBRARY_INC%\openjpeg-2.3" ^
    OPENJPEG_ENABLED=YES ^
    OPENJPEG_LIB=%LIBRARY_LIB%\openjp2.lib ^
    PG_INC_DIR=%LIBRARY_INC% ^
    PG_LIB=%LIBRARY_LIB%\libpq.lib ^
    PNGDIR=%LIBRARY_INC% ^
    PNG_EXTERNAL_LIB=1 ^
    PNG_LIB=%LIBRARY_LIB%\libpng.lib ^
    PROJ_FLAGS="-DPROJ_STATIC -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H" ^
    PROJ_INCLUDE="-I%LIBRARY_INC%" ^
    PROJ_LIBRARY=%LIBRARY_LIB%\proj.lib ^
    SPATIALITE_412_OR_LATER=yes ^
    SQLITE_INC="-I%LIBRARY_INC% -DHAVE_SPATIALITE" ^
    SQLITE_LIB="%LIBRARY_LIB%\sqlite3.lib %LIBRARY_LIB%\spatialite_i.lib" ^
    TIFF_INC="-I%LIBRARY_INC%" ^
    TIFF_LIB=%LIBRARY_LIB%\tiff.lib ^
    TIFF_OPTS=-DBIGTIFF_SUPPORT ^
    XERCES_DIR=%LIBRARY_PREFIX% ^
    XERCES_INCLUDE="-I%LIBRARY_INC% -I%LIBRARY_INC%\xercesc" ^
    XERCES_LIB=%LIBRARY_LIB%\xerces-c_3.lib ^
    GEOTIFF_INC="-I%LIBRARY_INC%" ^
    GEOTIFF_LIB=%LIBRARY_LIB%\geotiff_i.lib ^
    LIBICONV_INCLUDE="-I%LIBRARY_INC% -DICONV_CONST= " ^
    LIBICONV_LIBRARY="%LIBRARY_LIB%\iconv.lib" ^
    POPPLER_ENABLED=YES ^
    POPPLER_CFLAGS="-I%LIBRARY_INC%\poppler -DPOPPLER_HAS_OPTCONTENT= -DPOPPLER_BASE_STREAM_HAS_TWO_ARGS= " ^
    POPPLER_MAJOR_VERSION=%POPPLER_MAJOR_VERSION% ^
    POPPLER_MINOR_VERSION=%POPPLER_MINOR_VERSION% ^
    POPPLER_LIBS="%LIBRARY_LIB%\poppler.lib" ^
    WEBP_ENABLED=YES ^
    WEBP_CFLAGS="-I%LIBRARY_INC%" ^
    WEBP_LIBS="%LIBARY_LIB%\libwebp.lib" ^
    ZSTD_CFLAGS="-I%LIBRARY_INC%" ^
    ZSTD_LIBS=""%LIBRARY_LIB%\libzstd.lib"

endlocal && set BLD_OPTS=%BLD_OPTS%

setlocal EnableDelayedExpansion

if "%ARCH%"=="64" (
    set WIN64="WIN64=YES"
) else (
    set WIN64=
)

:: Work out MSVC_VER - needed for build process.
:: Currently guess from Python version
if  %vc% LEQ 9 set MSVC_VER=1500
if  %vc% GTR 9 set MSVC_VER=1900

:: Get the minor/major version of poppler from the %poppler% environment
:: variable that is set by conda-build
FOR /F "tokens=1,2 delims=." %%a IN ("%poppler%") DO (
  set POPPLER_MAJOR_VERSION=%%a
  set POPPLER_MINOR_VERSION=%%b
)

:: Need consistent flags between build and install.
set BLD_OPTS=%WIN64% ^
    MSVC_VER=%MSVC_VER% ^
    GDAL_HOME=%LIBRARY_PREFIX% ^
    BINDIR=%LIBRARY_BIN% ^
    LIBDIR=%LIBRARY_LIB% ^
    INCDIR=%LIBRARY_INC% ^
    DATADIR=%LIBRARY_PREFIX%\share\gdal ^
    CURL_INC="-I%LIBRARY_INC%" ^
    CURL_LIB="%LIBRARY_LIB%\libcurl.lib wsock32.lib wldap32.lib winmm.lib" ^
    EXPAT_DIR=%LIBRARY_PREFIX% ^
    EXPAT_INCLUDE="-I%LIBRARY_INC%" ^
    EXPAT_LIB=%LIBRARY_LIB%\expat.lib ^
    FITS_PLUGIN=NO ^
    FITS_INC_DIR=%LIBRARY_INC% ^
    FITS_LIB="%LIBRARY_LIB%\cfitsio.lib" ^
    FREEXL_CFLAGS="-I%LIBRARY_INC%" ^
    FREEXL_LIBS=%LIBRARY_LIB%\freexl_i.lib ^
    GEOS_CFLAGS="-I%LIBRARY_INC% -DHAVE_GEOS" ^
    GEOS_DIR=%LIBRARY_PREFIX% ^
    GEOS_LIB=%LIBRARY_LIB%\geos_c.lib ^
    HDF4_DIR=%LIBRARY_PREFIX% ^
    HDF4_HAS_MAXOPENFILES=YES ^
    HDF4_LIB="%LIBRARY_LIB%\hdf.lib %LIBRARY_LIB%\mfhdf.lib %LIBRARY_LIB%\xdr.lib" ^
    HDF5_DIR=%LIBRARY_PREFIX% ^
    HDF5_LIB=%LIBRARY_LIB%\hdf5.lib ^
    HDF5_H5_IS_DLL=YES ^
    TILEDB_ENABLED=YES ^
    TILEDB_DIR=%LIBRARY_PREFIX% ^
    TILEDB_LIBS=%LIBRARY_LIB%\tiledb.lib ^
    JPEGDIR=%LIBRARY_INC% ^
    JPEG_EXTERNAL_LIB=1 ^
    JPEG_LIB=%LIBRARY_LIB%\libjpeg.lib ^
    KEA_CFLAGS="-I%LIBRARY_INC%" ^
    KEA_LIB="%LIBRARY_LIB%\hdf5_cpp.lib %LIBRARY_LIB%\libkea.lib" ^
    NETCDF_INC_DIR=%LIBRARY_INC% ^
    NETCDF_LIB=%LIBRARY_LIB%\netcdf.lib ^
    NETCDF_SETTING=yes ^
    NETCDF_HAS_NC4=yes ^
    OPENJPEG_CFLAGS="-I%LIBRARY_INC%\openjpeg-2.3" ^
    OPENJPEG_ENABLED=YES ^
    OPENJPEG_LIB=%LIBRARY_LIB%\openjp2.lib ^
    PG_INC_DIR=%LIBRARY_INC% ^
    PG_LIB=%LIBRARY_LIB%\libpq.lib ^
    PNGDIR=%LIBRARY_INC% ^
    PNG_EXTERNAL_LIB=1 ^
    PNG_LIB=%LIBRARY_LIB%\libpng.lib ^
    PROJ_FLAGS="-DPROJ_STATIC -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H" ^
    PROJ_INCLUDE="-I%LIBRARY_INC%" ^
    PROJ_LIBRARY=%LIBRARY_LIB%\proj.lib ^
    SPATIALITE_412_OR_LATER=yes ^
    SQLITE_INC="-I%LIBRARY_INC% -DHAVE_SPATIALITE" ^
    SQLITE_LIB="%LIBRARY_LIB%\sqlite3.lib %LIBRARY_LIB%\spatialite_i.lib" ^
    TIFF_INC="-I%LIBRARY_INC%" ^
    TIFF_LIB=%LIBRARY_LIB%\tiff.lib ^
    TIFF_OPTS=-DBIGTIFF_SUPPORT ^
    XERCES_DIR=%LIBRARY_PREFIX% ^
    XERCES_INCLUDE="-I%LIBRARY_INC% -I%LIBRARY_INC%\xercesc" ^
    XERCES_LIB=%LIBRARY_LIB%\xerces-c_3.lib ^
    GEOTIFF_INC="-I%LIBRARY_INC%" ^
    GEOTIFF_LIB=%LIBRARY_LIB%\geotiff_i.lib ^
    LIBICONV_INCLUDE="-I%LIBRARY_INC% -DICONV_CONST= " ^
    LIBICONV_LIBRARY="%LIBRARY_LIB%\iconv.lib" ^
    POPPLER_ENABLED=YES ^
    POPPLER_CFLAGS="-I%LIBRARY_INC%\poppler -DPOPPLER_HAS_OPTCONTENT= -DPOPPLER_BASE_STREAM_HAS_TWO_ARGS= " ^
    POPPLER_MAJOR_VERSION=%POPPLER_MAJOR_VERSION% ^
    POPPLER_MINOR_VERSION=%POPPLER_MINOR_VERSION% ^
    POPPLER_LIBS="%LIBRARY_LIB%\poppler.lib" ^
    WEBP_ENABLED=YES ^
    WEBP_CFLAGS="-I%LIBRARY_INC%" ^
    WEBP_LIBS="%LIBARY_LIB%\libwebp.lib" ^
    ZSTD_CFLAGS="-I%LIBRARY_INC%" ^
    ZSTD_LIBS=""%LIBRARY_LIB%\libzstd.lib"

endlocal && set BLD_OPTS=%BLD_OPTS%

remove HTMLDIR as this seems to need cygwin to build


@echo off

mkdir build
cd build

rem Need to handle Python 3.x case at some point (Visual Studio 2010)
if %ARCH%==32 (
  if %PY_VER% LSS 3 (
    set CMAKE_CONFIG="Release|Win32"
	set GENERATOR="Visual Studio 9 2008"
  )
)
if %ARCH%==64 (
  if %PY_VER% LSS 3 (
    set CMAKE_CONFIG="Release|x64"
	set GENERATOR="Visual Studio 9 2008 Win64"
  )
)

rem The Python lib has no period in the
rem version string, so we remove it here.
set PY_VER_NO_DOT=%PY_VER:.=%

cmake ..\tools\python -LAH -G%GENERATOR% ^
-DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^
-DBUILD_SHARED_LIBS=1 ^
-DBoost_USE_STATIC_LIBS=0 ^
-DBoost_USE_STATIC_RUNTIME=0 ^
-DBOOST_INCLUDEDIR="%LIBRARY_INC%" ^
-DBOOST_LIBRARYDIR="%LIBRARY_LIB%" ^
-DPYTHON_LIBRARY="%PREFIX%\libs\python%PY_VER_NO_DOT%.lib" ^
-DPYTHON_INCLUDE_DIR="%PREFIX%\include" ^
-DDLIB_NO_GUI_SUPPORT=1 ^
-DDLIB_USE_BLAS=0 ^
-DDLIB_USE_LAPACK=0

cmake --build . --config %CMAKE_CONFIG% --target ALL_BUILD
cmake --build . --config %CMAKE_CONFIG% --target INSTALL

rem Copy the dlib libraries and the dlls it depends upon
rem Unfortunately, they have to be put in the root.
move "..\python_examples\*.dll" "%SP_DIR%"
move "..\python_examples\dlib.lib" "%SP_DIR%"
move "..\python_examples\dlib.pyd" "%SP_DIR%"

@echo off

mkdir build
cd build

rem Need to handle Python 3.x case at some point (Visual Studio 2010)
if %ARCH%==32 (
    set CMAKE_CONFIG="Release|Win32"
  if %PY_VER% LSS 3 (
	set GENERATOR="Visual Studio 9 2008"
  ) else (
	set GENERATOR="Visual Studio 10"
  )
)
if %ARCH%==64 (
    set CMAKE_CONFIG="Release|x64"
  if %PY_VER% LSS 3 (
	set GENERATOR="Visual Studio 9 2008 Win64"
  ) else (
	set GENERATOR="Visual Studio 10 Win64"
  )
)

rem The Python lib has no period in the
rem version string, so we remove it here.
set PY_VER_NO_DOT=%PY_VER:.=%

cmake ..\tools\python -LAH -G%GENERATOR% ^
-DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^
-DBUILD_SHARED_LIBS=1 ^
-DBoost_USE_STATIC_LIBS=0 ^
-DBoost_USE_STATIC_RUNTIME=0 ^
-DBOOST_INCLUDEDIR="%LIBRARY_INC%" ^
-DBOOST_LIBRARYDIR="%LIBRARY_LIB%" ^
-DPYTHON_LIBRARY="%PREFIX%\libs\python%PY_VER_NO_DOT%.lib" ^
-DPYTHON_INCLUDE_DIR="%PREFIX%\include" ^
-DDLIB_NO_GUI_SUPPORT=1 ^
-DDLIB_USE_BLAS=0 ^
-DDLIB_USE_LAPACK=0

cmake --build . --config %CMAKE_CONFIG% --target ALL_BUILD
cmake --build . --config %CMAKE_CONFIG% --target INSTALL

rem Copy the dlib libraries and the dlls it depends upon
rem Unfortunately, they have to be put in the root.
move "..\python_examples\*.dll" "%SP_DIR%"
move "..\python_examples\dlib.lib" "%SP_DIR%"
move "..\python_examples\dlib.pyd" "%SP_DIR%"

Allow Python3 building

Allow Python3 building

Update CMAKE to take into account using Visual Studio 2010 for Py34
builds.


@echo off

:: BatchGotAdmin
:-------------------------------------
rem Check for permissions
    if "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) else (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)

rem If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    set params = %*:"=""
    echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"

    "%temp%\getadmin.vbs"
    del "%temp%\getadmin.vbs"
    exit /b

:gotAdmin
    pushd "%CD%"
    CD /D "%~dp0"
:--------------------------------------

rem Check for necessary dependencies and install them as needed

for %%I in (node npm gem mvn java javac) do (
    echo Checking if %%I exists in the system...
    call :isInstalled %%I
)

echo. & echo Installing the required dependencies..

echo. & echo Angular CLI
call :ifExists ng && ng --version | find "@angular/cli">nul
if %errorlevel% NEQ 0 (
    echo Installing angular-cli
    npm install -g @angular/cli
    call :showErrorMsg
)

echo. & echo Gulp
call :ifExists gulp || (
    echo Installing gulp
    npm install -g gulp
    call :showErrorMsg
)

echo. & echo SASS
call :ifExists sass || (
    echo Installing sass
    gem install sass
    call :showErrorMsg
)

echo. & echo Running npm-install
cd plug-n-code
npm install
call :showErrorMsg

cd ../server
rem TODO: install server dependencies
rem mvn install:install-file -Dfile=lib/ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar

echo. & echo All done!
pause>nul
goto :eof

:showErrorMsg
    if '%errorlevel%' EQU 0 exit /b 0
    echo Seems like an error occurred while installing the dependencies
    echo Please try re-running this script
    echo If the issue still persists, please report the issue with all your system details at
    echo https://github.com/yashdsaraf/reimagined-eureka/issues/new
    pause>nul
    (goto) 2>nul & endlocal & exit /b %errorlevel%

:isInstalled
    call :ifExists %1 && exit /b 0
    echo Could not find %1
    echo Please install all the required dependencies listed in
    echo https://github.com/yashdsaraf/reimagined-eureka/tree/master/INSTALL.md
    pause>nul
    (goto) 2>nul & endlocal & exit /b %errorlevel%

:ifExists
    where %1>nul 2>&1
    exit /b %errorlevel%

@echo off

:: BatchGotAdmin
:-------------------------------------
rem Check for permissions
    if "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) else (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)

rem If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    set params = %*:"=""
    echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"

    "%temp%\getadmin.vbs"
    del "%temp%\getadmin.vbs"
    exit /b

:gotAdmin
    pushd "%CD%"
    CD /D "%~dp0"
:--------------------------------------

rem Check for necessary dependencies and install them as needed

for %%I in (node npm gem mvn java javac) do (
    echo Checking if %%I exists in the system...
    call :isInstalled %%I
)

echo. & echo Installing the required dependencies..

echo. & echo Angular CLI
call :ifExists ng && ng --version | find "@angular/cli">nul
if %errorlevel% NEQ 0 (
    echo Installing angular-cli
    npm install -g @angular/cli
    call :showErrorMsg
)

echo. & echo Gulp
call :ifExists gulp || (
    echo Installing gulp
    npm install -g gulp
    call :showErrorMsg
)

echo. & echo SASS
call :ifExists sass || (
    echo Installing sass
    gem install sass
    call :showErrorMsg
)

echo. & echo Running npm-install
cd plug-n-code
npm install
call :showErrorMsg

echo. & echo Building semantic dist files
cd semantic
gulp build
call :showErrorMsg
cd ..

cd ../server
rem TODO: install server dependencies
rem mvn install:install-file -Dfile=lib/ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar

echo. & echo All done!
pause>nul
goto :eof

:showErrorMsg
    if '%errorlevel%' EQU 0 exit /b 0
    echo Seems like an error occurred while installing the dependencies
    echo Please try re-running this script
    echo If the issue still persists, please report the issue with all your system details at
    echo https://github.com/yashdsaraf/reimagined-eureka/issues/new
    pause>nul
    (goto) 2>nul & endlocal & exit /b %errorlevel%

:isInstalled
    call :ifExists %1 && exit /b 0
    echo Could not find %1
    echo Please install all the required dependencies listed in
    echo https://github.com/yashdsaraf/reimagined-eureka/tree/master/INSTALL.md
    pause>nul
    (goto) 2>nul & endlocal & exit /b %errorlevel%

:ifExists
    where %1>nul 2>&1
    exit /b %errorlevel%

Build semantic dist files in configure.bat #1


rem Generate the zip Release package.
rem For information on how to setup your environment.
rem see https://github.com/neuoy/KSPTrajectories/tree/master/misc/VisualStudio/Readme.md

@echo off

rem get parameters that are passed by visual studio post build event
SET TargetName=%1
SET Dllversion=%2

rem make sure the initial working directory is the one containing the current script
SET scriptPath=%~dp0
SET rootPath=%scriptPath%..\..\..\..\
SET initialWD=%CD%

rem current module manager version in misc\3rdParty\
SET MODMANAGER_VERSION=2.8.1

echo Generating %TargetName% Release Package...
cd "%rootPath%"

IF EXIST package\ rd /s /q package
mkdir package
cd package

mkdir GameData
cd GameData
xcopy /y ..\..\3rdParty\ModuleManager.%MODMANAGER_VERSION%.dll .
xcopy /y ..\..\3rdParty\README.md .

mkdir %TargetName%
cd %TargetName%
xcopy /y ..\..\..\License.txt .
xcopy /y ..\..\..\%TargetName%.cfg .
xcopy /y ..\..\..\%TargetName%.version .
xcopy /y ..\..\..\README.md .

mkdir Plugin
xcopy /y %initialWD%\%TargetName%.dll Plugin

mkdir Textures
xcopy /y ..\..\..\Textures\icon.png Textures
xcopy /y ..\..\..\Textures\icon-blizzy.png Textures

echo.
echo Compressing %TargetName% Release Package...
IF EXIST "%rootPath%%TargetName%*.zip" del "%rootPath%%TargetName%*.zip"
"%scriptPath%7za.exe" a "..\..\..\%TargetName%%Dllversion%.zip" ..\..\GameData

cd "%rootPath%"
rd /s /q package

cd "%initialWD%"

rem Generate the zip Release package.
rem For information on how to setup your environment.
rem see https://github.com/neuoy/KSPTrajectories/tree/master/misc/VisualStudio/Readme.md

@echo off

rem get parameters that are passed by visual studio post build event
SET TargetName=%1
SET Dllversion=%2

rem make sure the initial working directory is the one containing the current script
SET scriptPath=%~dp0
SET rootPath=%scriptPath%..\..\..\..\
SET initialWD=%CD%

rem current module manager version in misc\3rdParty\
SET MODMANAGER_VERSION=2.8.1

echo Generating %TargetName% Release Package...
cd "%rootPath%"

IF EXIST package\ rd /s /q package
mkdir package
cd package

mkdir GameData
cd GameData
xcopy /y ..\..\3rdParty\ModuleManager.%MODMANAGER_VERSION%.dll .
xcopy /y ..\..\3rdParty\README.md .

mkdir %TargetName%
cd %TargetName%
xcopy /y ..\..\..\License.txt .
xcopy /y ..\..\..\%TargetName%.cfg .
xcopy /y ..\..\..\%TargetName%.version .
xcopy /y ..\..\..\README.md .

mkdir Localization
xcopy /y ..\..\..\Localization\TrajectoriesLocalization.cfg Localization

mkdir Plugin
xcopy /y %initialWD%\%TargetName%.dll Plugin

mkdir Textures
xcopy /y ..\..\..\Textures\icon.png Textures
xcopy /y ..\..\..\Textures\icon-blizzy.png Textures

echo.
echo Compressing %TargetName% Release Package...
IF EXIST "%rootPath%%TargetName%*.zip" del "%rootPath%%TargetName%*.zip"
"%scriptPath%7za.exe" a "..\..\..\%TargetName%%Dllversion%.zip" ..\..\GameData

cd "%rootPath%"
rd /s /q package

cd "%initialWD%"

Include localization file in ZipPack build script.


REM @file    CI/appveyor/install_dependencies.bat
REM @date    nov. 2015
REM @author  PhRG / opticalp.fr
REM @license MIT

REM Install dependencies:
REM  - build POCO from latest git release.

set CURRENT_DIR=%CD%
REM echo "current dir is %CURRENT_DIR%"

REM set POCO_INSTALL_PREFIX=%PROGRAMFILES%\Poco
REM echo "Poco install destination directory: %POCO_INSTALL_PREFIX%"

REM get last poco via github
echo "getting the last poco release from github"
mkdir dependencies
cd dependencies
git clone https://github.com/pocoproject/poco.git
echo "Poco is now cloned. "
cd poco

REM now using msys to make things easier (getting last release)
%SH_COMMAND% -c "POCO_TAG_NAME=$(git describe --tags) ; git checkout $POCO_TAG_NAME"

REM build using cmake
echo "building poco with cmake, configuration: %CONFIGURATION%"
cd ..
mkdir poco-build
cd poco-build

echo "Preparing to install POCO into %POCO_INSTALL_PREFIX%"
echo "CMake generator is: %GENERATOR%"
cmake ../poco -DENABLE_XML=ON -DENABLE_JSON=ON -DENABLE_MONGODB=OFF -DENABLE_PDF=OFF ^
    -DENABLE_UTIL=ON -DENABLE_NET=OFF -DENABLE_NETSSL=OFF -DENABLE_NETSSL_WIN=OFF -DENABLE_CRYPTO=OFF ^
    -DENABLE_DATA=OFF -DENABLE_DATA_SQLITE=OFF -DENABLE_DATA_MYSQL=OFF -DENABLE_DATA_ODBC=OFF ^
    -DENABLE_SEVENZIP=OFF -DENABLE_ZIP=OFF -DENABLE_APACHECONNECTOR=OFF -DENABLE_CPPPARSER=OFF ^
    -DENABLE_POCODOC=OFF -DENABLE_PAGECOMPILER=OFF -DENABLE_PAGECOMPILER_FILE2PAGE=OFF ^
    -DENABLE_REDIS=OFF ^
    -DCMAKE_INSTALL_PREFIX="%POCO_INSTALL_PREFIX%" -G"%GENERATOR%"
cmake --build . --config %CONFIGURATION%
REM echo "Poco build done. "
cmake --build . --target install --config %CONFIGURATION%
REM echo "Poco install done. "

REM %PATH% has to be modified to take into account poco .dlls
cd %CURRENT_DIR%

REM fix python configuration for 2.7.11
if "%ARCH%"=="Win64" (
  set PYTHONHOME=C:\Python27-x64
) else (
  set PYTHONHOME=C:\Python27
)

fix python configuration for 2.7.11

fix python configuration for 2.7.11

set PYTHONHOME


@ECHO OFF

REM ; %PROJECT_NAME% is set by Jenkins, this allows us to use the same script to verify
REM ; Chef and Angry Chef
cd C:\opscode\%PROJECT_NAME%\bin

REM ; We don't want to add the embedded bin dir to the main PATH as this
REM ; could mask issues in our binstub shebangs.
SET EMBEDDED_BIN_DIR=C:\opscode\%PROJECT_NAME%\embedded\bin

ECHO.

REM ; Set the temporary directory to a custom location, and wipe it before
REM ; and after the tests run.
SET TEMP=%TEMP%\cheftest
SET TMP=%TMP%\cheftest
RMDIR /S /Q %TEMP%
MKDIR %TEMP%

REM ; FIXME: we should really use Bundler.with_clean_env in the caller instead of re-inventing it here
set _ORIGINAL_GEM_PATH=
set BUNDLE_BIN_PATH=
set BUNDLE_GEMFILE=
set GEM_HOME=
set GEM_PATH=
set GEM_ROOT=
set RUBYLIB=
set RUBYOPT=
set RUBY_ENGINE=
set RUBY_ROOT=
set RUBY_VERSION=
set BUNDLER_VERSION=

FOR %%b IN (
  chef-client
  knife
  chef-solo
  ohai
) DO (

  ECHO Checking for existence of binfile `%%b`...

  IF EXIST %%b (
    ECHO ...FOUND IT!
  ) ELSE (
    GOTO :error
  )
  ECHO.
)

call chef-client --version

REM ; Exercise various packaged tools to validate binstub shebangs
call %EMBEDDED_BIN_DIR%\ruby --version
call %EMBEDDED_BIN_DIR%\gem --version
call %EMBEDDED_BIN_DIR%\bundle --version
call %EMBEDDED_BIN_DIR%\rspec --version

SET PATH=C:\opscode\%PROJECT_NAME%\bin;C:\opscode\%PROJECT_NAME%\embedded\bin;%PATH%

REM ; Test against the vendored chef gem (cd into the output of "gem which chef")
for /f "delims=" %%a in ('gem which chef') do set CHEFDIR=%%a
call :dirname "%CHEFDIR%" CHEFDIR
call :dirname "%CHEFDIR%" CHEFDIR
cd %CHEFDIR%

cd

type Gemfile.lock

IF NOT EXIST "Gemfile.lock" (
  ECHO "Chef gem does not contain a Gemfile.lock! This is needed to run any tests."
  GOTO :error
)

IF "%PIPELINE_NAME%" == "chef-fips" (
  set CHEF_FIPS=1
)

REM ; ffi-yajl must run in c-extension mode for perf, so force it so we don't accidentally fall back to ffi
set FORCE_FFI_YAJL=ext

set
call %EMBEDDED_BIN_DIR%\rspec -r rspec_junit_formatter -f RspecJunitFormatter -o %WORKSPACE%\test.xml -f documentation spec/functional

GOTO :EOF

:dirname file varName
    setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
    SET _dir=%~dp1
    SET _dir=%_dir:~0,-1%
    endlocal & set %2=%_dir%
GOTO thout:EOF

@ECHO OFF

REM ; %PROJECT_NAME% is set by Jenkins, this allows us to use the same script to verify
REM ; Chef and Angry Chef
cd C:\opscode\%PROJECT_NAME%\bin

REM ; We don't want to add the embedded bin dir to the main PATH as this
REM ; could mask issues in our binstub shebangs.
SET EMBEDDED_BIN_DIR=C:\opscode\%PROJECT_NAME%\embedded\bin

ECHO.

REM ; Set the temporary directory to a custom location, and wipe it before
REM ; and after the tests run.
SET TEMP=%TEMP%\cheftest
SET TMP=%TMP%\cheftest
RMDIR /S /Q %TEMP%
MKDIR %TEMP%

REM ; FIXME: we should really use Bundler.with_clean_env in the caller instead of re-inventing it here
set _ORIGINAL_GEM_PATH=
set BUNDLE_BIN_PATH=
set BUNDLE_GEMFILE=
set GEM_HOME=
set GEM_PATH=
set GEM_ROOT=
set RUBYLIB=
set RUBYOPT=
set RUBY_ENGINE=
set RUBY_ROOT=
set RUBY_VERSION=
set BUNDLER_VERSION=

FOR %%b IN (
  chef-client
  knife
  chef-solo
  ohai
) DO (

  ECHO Checking for existence of binfile `%%b`...

  IF EXIST %%b (
    ECHO ...FOUND IT!
  ) ELSE (
    GOTO :error
  )
  ECHO.
)

call chef-client --version

REM ; Exercise various packaged tools to validate binstub shebangs
call %EMBEDDED_BIN_DIR%\ruby --version
call %EMBEDDED_BIN_DIR%\gem --version
call %EMBEDDED_BIN_DIR%\bundle --version
call %EMBEDDED_BIN_DIR%\rspec --version

SET PATH=C:\opscode\%PROJECT_NAME%\bin;C:\opscode\%PROJECT_NAME%\embedded\bin;%PATH%

REM ; Test against the vendored chef gem (cd into the output of "gem which chef")
for /f "delims=" %%a in ('gem which chef') do set CHEFDIR=%%a
call :dirname "%CHEFDIR%" CHEFDIR
call :dirname "%CHEFDIR%" CHEFDIR
cd %CHEFDIR%

cd

type Gemfile.lock

IF NOT EXIST "Gemfile.lock" (
  ECHO "Chef gem does not contain a Gemfile.lock! This is needed to run any tests."
  GOTO :error
)

IF "%PIPELINE_NAME%" == "chef-fips" (
  set CHEF_FIPS=1
)

REM ; ffi-yajl must run in c-extension mode for perf, so force it so we don't accidentally fall back to ffi
set FORCE_FFI_YAJL=ext

set
REM ; we should use bundler, but aren't because of a bug
REM ; this should be `bundle exec rspec yadda yadda...`
REM ; the bug is here: https://github.com/bundler/bundler/issues/5644
REM ; while this opens us up to some testing edge conditions if we're doing our job right to build the omnibus package and its gems correct that shouldn't matter
REM ; since that assumption has gone wrong before we should really go back to using bundler at some point
call %EMBEDDED_BIN_DIR%\rspec -r rspec_junit_formatter -f RspecJunitFormatter -o %WORKSPACE%\test.xml -f documentation spec/functional

GOTO :EOF

:dirname file varName
    setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
    SET _dir=%~dp1
    SET _dir=%_dir:~0,-1%
    endlocal & set %2=%_dir%
GOTO thout:EOF

add note to hack

add note to hack

Signed-off-by: Lamont Granquist <0ab8dc438f73addc98d9ad5925ec8f2b97991703@scriptkiddie.org>


@echo off

setlocal

if exist run.bat goto exec
 echo run.bat must be run from its folder

:exec
tasklist /nh|find /i "dreamgo.exe"

if ERRORLEVEL 1 goto reload else(
    goto stop
    goto reload
    )

:reload
call install.bat
if exist bin\dreamgo.exe go run else echo install fail...

:run
echo running success...
bin\dreamgo.exe

:stop
 taskkill /im "dreamgo.exe"

@echo off

setlocal

if exist run.bat goto exec
 echo run.bat must be run from its folder

:exec
tasklist /nh|find /i "dreamgo"

if ERRORLEVEL 1 (
    goto reload
 ) else (
     goto kill
 )

:reload
call install.bat
if exist bin\dreamgo.exe (
    echo .........rebuild success.........
    goto run
    )else (
    echo .........the command install fail.........
    goto end
    )

:run
echo .........the program is starting.......
start /min bin\dreamgo.exe
echo .........started success.........
goto end

:kill
echo .........run kill exist process.........
 taskkill /f /im "dreamgo.exe" /t >null 2>&1
 goto reload

:end
echo run finished

update run.bat file

update run.bat file


:: Copyright 2014 by SyneArt <sa@syneart.com>
@echo off&cls&title Install&color 0F&mode con cols=38 lines=10
setlocal enableextensions enabledelayedexpansion
echo.&echo.&echo.&echo.&echo Install ConnectivityLab Theme Now ..
set str=%PATH: =/%&set MiKTeXPath=nul
FOR %%b in ("%str%") DO (
	set nowStr=%%b&set MiKTeXStr=x!nowStr:MiKTeX=!
	if not !MiKTeXStr!==x!nowStr! set MiKTeXPath=!nowStr!
)
if %MiKTeXPath%==nul (
	cls&echo.&echo.&echo.&echo.&echo 請先安裝 MiKTeX, 再執行本安裝
	color E3&set /p=&goto exit
)
set MiKTeXPath=%MiKTeXPath:miktex\bin\=%
set MiKTeXPath=%MiKTeXPath:/= %
if not exist "%MiKTeXPath%tex\latex\beamer\" (
	cls&echo.&echo.&echo.&echo.&echo 請先安裝 Beamer, 再執行本安裝
	color E3&set /p=&goto exit
)
call:copyFile .\themes, *.sty&call:copyFile .\art, *.jpg
initexmf --update-fndb 1>nul 2>nul
if !errorlevel!==1 (
	cls&echo.&echo.&echo.&echo.&echo 請先停止編譯 MiKTeX 專案, 再執行
	color 4C&set /p=&goto exit
)
cls&echo.&echo.&echo.&echo.&echo Install Theme Successful！&color 2A&ping 127.0.0.1 -n 3 >nul&goto exit

:copyFile
FOR /R %~1 %%c in (%~2) DO (
	set themesFile=%%c&set themesFile=!themesFile:%~dp0=!
	copy "%%c" "%MiKTeXPath%tex\latex\beamer\base\!themesFile!" 1>nul 2>nul
)

:exit

:: Copyright 2014 by SyneArt <sa@syneart.com>
@echo off&cls&title Install&color 0F&mode con cols=38 lines=10
setlocal enableextensions enabledelayedexpansion
echo.&echo.&echo.&echo.&echo Install Theme Now ..
set str=!PATH: =/!&set str=!str:(x86)=[x86]!&set MiKTeXPath=nul
FOR %%b in (!str!) DO (
	set nowStr=%%b&set MiKTeXStr=x!nowStr:MiKTeX=!
	if not !MiKTeXStr!==x!nowStr! set MiKTeXPath=!nowStr!
)
if !MiKTeXPath!==nul (
	cls&echo.&echo.&echo.&echo.&echo 請先安裝 MiKTeX, 再執行本安裝
	color E3&set /p=&goto exit
)
set MiKTeXPath=!MiKTeXPath:miktex\bin\=!&set MiKTeXPath=!MiKTeXPath:/= !&set MiKTeXPath=!MiKTeXPath:[x86]=(x86)!
if not exist "!MiKTeXPath!tex\latex\beamer\" (
	cls&echo.&echo.&echo.&echo.&echo 請先安裝 Beamer, 再執行本安裝
	color E3&set /p=&goto exit
)
call:copyFile .\themes, *.sty&call:copyFile .\art, *.jpg
initexmf --update-fndb >nul
if !errorlevel!==1 (
	cls&echo.&echo.&echo.&echo.&echo 請先停止編譯 MiKTeX 專案, 再執行
	color 4C&set /p=&goto exit
)
cls&echo.&echo.&echo.&echo.&echo Install Theme Successful！&color 2A&ping 127.0.0.1 -n 3 >nul&goto exit

:copyFile
FOR /R %~1 %%c in (%~2) DO (
	set themesFile=%%c&set themesFile=!themesFile:%~dp0=!
	copy "%%c" "!MiKTeXPath!tex\latex\beamer\base\!themesFile!" >nul
)

:exit

support x64 now

support x64 now


rem Script to build SciTE for Windows with all the different
rem compilers and exercise all the projects and makefiles.
rem Current directory must be scite\scripts before running.
rem Contains references to local install directories on Neil's
rem machine so must be modified for other installations.
rem Assumes environment set up so gcc and MSVC can be called.
rem
cd ..\..
set
set BORLAND_BASE=G:\Borland\bcc55
set MSDEV_BASE=C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin
rem
rem Target 1: Normal gcc build
call scite\scripts\clearboth
cd scintilla\win32
make
if ERRORLEVEL 2 goto ERROR
cd ..\..\scite\win32
make
if ERRORLEVEL 2 goto ERROR
cd ..\..
rem
rem Target 2: Microsoft VC++ build
call scite\scripts\clearboth
cd scintilla\win32
cl
nmake -f scintilla.mak QUIET=1
if ERRORLEVEL 2 goto ERROR
cd ..\..\scite\win32
nmake -f scite.mak QUIET=1
if ERRORLEVEL 2 goto ERROR
cd ..\..
rem
rem Target 3: Borland C++ build
call scite\scripts\clearboth
cd scintilla\win32
set SAVE_PATH=%path%
set SAVE_INCLUDE=%INCLUDE%
path %BORLAND_BASE%\Bin;%path%
set libpath=%BORLAND_BASE%\lib
set INCLUDE=%BORLAND_BASE%\include
make -f scintilla.mak QUIET=1
if ERRORLEVEL 2 goto ERROR
cd ..\..\scite\win32
make -f scite.mak QUIET=1
if ERRORLEVEL 2 goto ERROR
cd ..\..
path %SAVE_PATH%
set INCLUDE=%SAVE_INCLUDE%
rem
rem Set path for VC 6
path %MSDEV_BASE%;%path%
rem
rem Target 4: Visual C++ using scintilla\vcbuild\scite.dsp
rem call scite\scripts\clearboth
rem cd scintilla\vcbuild
rem msdev SciLexer.dsp /MAKE "SciLexer - Win32 Release" /REBUILD
rem if ERRORLEVEL 2 goto ERROR
rem cd ..\..
rem
rem Target 5: Visual C++ using scintilla\vcbuild\SciTE.dsp
call scite\scripts\clearboth
cd scite\vcbuild
msdev SciTE.dsp /MAKE "SciTE - Win32 Release" /REBUILD
if ERRORLEVEL 2 goto ERROR
cd ..\..
rem
rem Target 6: Visual C++ using scite\boundscheck\SciTE.dsp
rem call scite\scripts\clearboth
rem cd scite\boundscheck
rem msdev SciTE.dsp /MAKE "SciTE - Win32 Release" /REBUILD
rem if ERRORLEVEL 2 goto ERROR
rem cd ..\..
rem
rem Target 6a: Visual C++ .NET using scite\boundscheck\SciTE.sln
call scite\scripts\clearboth
cd scite\boundscheck
devenv scite.sln /rebuild release
if ERRORLEVEL 2 goto ERROR
cd ..\..
rem
rem Target 7: GTK+ version using Visual C++ on scintilla\gtk\scintilla.mak
call scite\scripts\clearboth
cd scintilla\gtk
nmake -f scintilla.mak QUIET=1
if ERRORLEVEL 2 goto ERROR
cd ..\..
call scite\scripts\clearboth
goto CLEANUP
:ERROR
@echo checkbuilds.bat:1: Failed %ERRORLEVEL%
:CLEANUP
set SAVE_PATH=
set SAVE_INCLUDE=
set BORLAND_BASE=
set MSDEV_BASE=
set

rem Script to build SciTE for Windows with all the different
rem compilers and exercise all the projects and makefiles.
rem Current directory must be scite\scripts before running.
rem Contains references to local install directories on Neil's
rem machine so must be modified for other installations.
rem Assumes environment set up so gcc and MSVC can be called.
rem
cd ..\..
set
set BORLAND_BASE=G:\Borland\bcc55
set MSDEV_BASE=C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin
rem
rem Target 1: Normal gcc build
call scite\scripts\clearboth
cd scintilla\win32
make
if ERRORLEVEL 2 goto ERROR
cd ..\..\scite\win32
make
if ERRORLEVEL 2 goto ERROR
cd ..\..
rem
rem Target 2: Microsoft VC++ build
call scite\scripts\clearboth
cd scintilla\win32
cl
nmake -f scintilla.mak QUIET=1
if ERRORLEVEL 2 goto ERROR
cd ..\..\scite\win32
nmake -f scite.mak QUIET=1
if ERRORLEVEL 2 goto ERROR
cd ..\..
rem
rem Target 3: Borland C++ build
call scite\scripts\clearboth
cd scintilla\win32
set SAVE_PATH=%path%
set SAVE_INCLUDE=%INCLUDE%
path %BORLAND_BASE%\Bin;%path%
set libpath=%BORLAND_BASE%\lib
set INCLUDE=%BORLAND_BASE%\include
make -f scintilla.mak QUIET=1
if ERRORLEVEL 2 goto ERROR
cd ..\..\scite\win32
make -f scite.mak QUIET=1
if ERRORLEVEL 2 goto ERROR
cd ..\..
path %SAVE_PATH%
set INCLUDE=%SAVE_INCLUDE%
rem
rem Set path for VC 6
path %MSDEV_BASE%;%path%
rem
rem Target 4: Visual C++ using scintilla\vcbuild\scite.dsp
rem call scite\scripts\clearboth
rem cd scintilla\vcbuild
rem msdev SciLexer.dsp /MAKE "SciLexer - Win32 Release" /REBUILD
rem if ERRORLEVEL 2 goto ERROR
rem cd ..\..
rem
rem Target 5: Visual C++ using scintilla\vcbuild\SciTE.dsp
rem call scite\scripts\clearboth
rem cd scite\vcbuild
rem msdev SciTE.dsp /MAKE "SciTE - Win32 Release" /REBUILD
rem if ERRORLEVEL 2 goto ERROR
rem cd ..\..
rem
rem Target 6: Visual C++ using scite\boundscheck\SciTE.dsp
call scite\scripts\clearboth
cd scite\boundscheck
msdev SciTE.dsp /MAKE "SciTE - Win32 Release" /REBUILD
if ERRORLEVEL 2 goto ERROR
cd ..\..
rem
rem Target 6a: Visual C++ .NET using scite\boundscheck\SciTE.sln
call scite\scripts\clearboth
cd scite\boundscheck
devenv scite.sln /rebuild release
if ERRORLEVEL 2 goto ERROR
cd ..\..
rem
rem Target 7: GTK+ version using Visual C++ on scintilla\gtk\scintilla.mak
call scite\scripts\clearboth
cd scintilla\gtk
nmake -f scintilla.mak QUIET=1
if ERRORLEVEL 2 goto ERROR
cd ..\..
call scite\scripts\clearboth
goto CLEANUP
:ERROR
@echo checkbuilds.bat:1: Failed %ERRORLEVEL%
:CLEANUP
set SAVE_PATH=
set SAVE_INCLUDE=
set BORLAND_BASE=
set MSDEV_BASE=
set

Include only targets that really build.

Include only targets that really build.


@echo off
setlocal EnableExtensions

if (%FrameworkDir%)==() set FrameworkDir=%WINDIR%\Microsoft.NET\Framework64\
if (%FrameworkVersion%)==() set FrameworkVersion=v4.0.30319

set MSBUILD=%FrameworkDir%%FrameworkVersion%\msbuild.exe

if not exist %MSBUILD% goto Error_NoMsBuild

set TARGET=%1
if (%TARGET%)==() set TARGET=Default

set VERBOSITY=%2
if (%VERBOSITY%)==() set VERBOSITY=minimal

%MSBUILD% /verbosity:%VERBOSITY% /nologo /m /t:%TARGET% %~dp0build/build.proj

if errorlevel 1 goto Error_BuildFailed

echo.
echo *** BUILD SUCCESSFUL ***
echo.
goto :EOF

:Error_BuildFailed
echo.
echo *** BUILD FAILED ***
echo.
exit /b 1

:Error_NoMsBuild
echo.
echo. ERROR: Unable to locate MSBuild.exe (expected location: %MSBUILD%)
echo.
exit /b 1

@echo off
setlocal EnableExtensions

if (%FrameworkDir%)==() set FrameworkDir=%WINDIR%\Microsoft.NET\Framework64\
if (%FrameworkVersion%)==() set FrameworkVersion=v4.0.30319

set MSBUILD=%FrameworkDir%%FrameworkVersion%\msbuild.exe

if not exist %MSBUILD% goto Error_NoMsBuild

set TARGET=%1
if (%TARGET%)==() set TARGET=Default

set VERBOSITY=%2
if (%VERBOSITY%)==() set VERBOSITY=minimal

FOR /F "tokens=1,2* delims= " %%a in ("%*") do set BUILDARGS=%%c

echo %BUILDARGS%

%MSBUILD% /verbosity:%VERBOSITY% /nologo /m /t:%TARGET% %BUILDARGS% %~dp0build/build.proj

if errorlevel 1 goto Error_BuildFailed

echo.
echo *** BUILD SUCCESSFUL ***
echo.
goto :EOF

:Error_BuildFailed
echo.
echo *** BUILD FAILED ***
echo.
exit /b 1

:Error_NoMsBuild
echo.
echo. ERROR: Unable to locate MSBuild.exe (expected location: %MSBUILD%)
echo.
exit /b 1

Add ability to pass remaining arguments to msbuild


Build maker

Build maker


@echo off
setlocal

:: Note: We've disabled node reuse because it causes file locking issues.
::       The issue is that we extend the build with our own targets which
::       means that that rebuilding cannot successully delete the task
::       assembly.

:: Check prerequisites
set _msbuildexe="%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\12.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\14.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% echo Error: Could not find MSBuild.exe.  Please see https://github.com/dotnet/corefx/blob/master/docs/Developers.md for build instructions. && goto :eof

if NOT DEFINED VSINSTALLDIR echo Error: Build should be run from visual studio command prompt. Please see https://github.com/dotnet/corefx/blob/master/docs/Developers.md for build instructions. && goto :eof

:: Log build command line
set _buildprefix=echo
set _buildpostfix=^> "%~dp0msbuild.log"
call :build %*

:: Build
set _buildprefix=
set _buildpostfix=
call :build %*

goto :eof

:build
%_buildprefix% %_msbuildexe% "%~dp0build.proj" /nologo /maxcpucount /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=diag;LogFile="%~dp0msbuild.log";Append %* %_buildpostfix%
goto :eof

@echo off
setlocal

:: Note: We've disabled node reuse because it causes file locking issues.
::       The issue is that we extend the build with our own targets which
::       means that that rebuilding cannot successully delete the task
::       assembly.

:: Check prerequisites
set _msbuildexe="%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\12.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\14.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% echo Error: Could not find MSBuild.exe.  Please see https://github.com/dotnet/corefx/wiki/Developer%20Guide for build instructions. && goto :eof

if not defined VSINSTALLDIR echo Error: build.cmd should be run from a Visual Studio Command Prompt. Please see https://github.com/dotnet/corefx/wiki/Developer%20Guide for build instructions. && goto :eof

:: Log build command line
set _buildprefix=echo
set _buildpostfix=^> "%~dp0msbuild.log"
call :build %*

:: Build
set _buildprefix=
set _buildpostfix=
call :build %*

goto :eof

:build
%_buildprefix% %_msbuildexe% "%~dp0build.proj" /nologo /maxcpucount /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=diag;LogFile="%~dp0msbuild.log";Append %* %_buildpostfix%
goto :eof

Update links to developer guide in error messages to new location on the dotnet/corefx wiki.