cd %~dp0
del nomotools.exe
del nomotools.dll
cd ../nomotools
if not exist nomotools.exe call build.bat
cd %~dp0
cd ../nomotools
copy nomotools.exe ..\nomosdk

copy nomotools.dll ..\nomosdk
copy nomotime.exe ..\nomosdk
copy categories_colors.xml ..\nomosdk
cd grammars
copy *.xsd ..\..\nomosdk\grammars
cd ../transformations
copy *.xsl ..\..\nomosdk\transformations
cd ..
xcopy helloworld ..\nomosdk\helloworld /D /E /C /R /H /I /K /Y

del ..\nomosdk\nomointerpreter.dll
cd ../nomointerpreter
if not exist nomointerpreter.dll call build.bat
copy nomointerpreter.dll ..\nomosdk
xcopy helloworld ..\nomosdk\helloworld /D /E /C /R /H /I /K /Y

set PATH=C:\Qt\4.8.4\bin;%PATH%
set PATH=C:\Program Files\Microsoft Visual Studio 10.0\VC\bin;%PATH%
set PATH=C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE;%PATH%
set PATH=C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin;%PATH%
set WINDOWSSDKDIR=C:\Program Files\Microsoft SDKs\Windows\v7.0A\
set LIB=C:\Program Files\Microsoft SDKs\Windows\v7.0A\lib;%LIB%
set LIBPATH=C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Windows\Microsoft.NET\Framework\v3.5;%LIBPATH%
set INCLUDE=C:\Program Files\Microsoft SDKs\Windows\v7.0A\include;%INCLUDE%
set VCINSTALLDIR=c:\Program Files\Microsoft Visual Studio 10.0\VC\
set VS100COMNTOOLS=c:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\
set QMAKESPEC=win32-msvc2010
set PSMODULEPATH=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
set QTDIR=C:/Qt/4.8.4

cd ../../src/formalisms/automaton
echo Build dynamic library automaton
qmake -spec c:\Qt\4.8.4\mkspecs\win32-msvc2010
nmake
mv release/automaton.dll ../../../build/nomosdk/formalisms/automaton
rm -rf release
rm -rf debug
del Makefile.Release
del Makefile.Debug
del Makefile

cd ../boolean_logic
echo Build dynamic library boolean_logic
qmake -spec c:\Qt\4.8.4\mkspecs\win32-msvc2010
nmake
mv release/boolean_logic.dll ../../../build/nomosdk/formalisms/boolean_logic
rm -rf release
rm -rf debug
del Makefile.Release
del Makefile.Debug
del Makefile

cd ../../macros/formulation
echo Build dynamic library formulation
qmake -spec c:\Qt\4.8.4\mkspecs\win32-msvc2010
nmake
mv release/formulation.dll ../../../build/nomosdk/macros/formulation
rm -rf release
rm -rf debug
del Makefile.Release
del Makefile.Debug
del Makefile

cd ../discretization
echo Build dynamic library discretization
qmake -spec c:\Qt\4.8.4\mkspecs\win32-msvc2010
nmake
mv release/discretization.dll ../../../build/nomosdk/macros/discretization
rm -rf release
rm -rf debug
del Makefile.Release
del Makefile.Debug
del Makefile

cd ../../benchmarks/worldsquare
echo Build dynamic library worldsquare
qmake -spec c:\Qt\4.8.4\mkspecs\win32-msvc2010
nmake
mv release/worldsquare.dll .
rm -rf release
rm -rf debug
del Makefile.Release
del Makefile.Debug
del Makefile
echo Build executable worldsquare
gnatmake -Pworldsquare.gpr 
del b~worldsquare.ads
del b~worldsquare.adb
del *.o
del *.ali
mv worldsquare.dll ../../../build/nomosdk
mv worldsquare.exe ../../../build/nomosdk

cd ../pointsscatter
echo Build dynamic library pointsscatter
qmake -spec c:\Qt\4.8.4\mkspecs\win32-msvc2010
nmake
mv release/pointsscatter.dll .
rm -rf release
rm -rf debug
del Makefile.Release
del Makefile.Debug
del Makefile
echo Build executable pointsscatter
gnatmake -Ppointsscatter.gpr 
del b~pointsscatter.ads
del b~pointsscatter.adb
del *.o
del *.ali
mv pointsscatter.dll ../../../build/nomosdk
mv pointsscatter.exe ../../../build/nomosdk

cd ../../nomosdk
echo Build dynamic library nomosdk
qmake -spec c:\Qt\4.8.4\mkspecs\win32-msvc2010
nmake
mv release/nomoSDK.exe .
rm -rf release
rm -rf debug
del Makefile.Release
del Makefile.Debug
del Makefile
mv nomoSDK.exe ../../build/nomosdk
copy translations\*.qm ..\..\build\nomosdk\translations

cd ../..
if not exist build\QtCore4.dll copy bin\QtCore4.dll build\nomosdk
if not exist build\QtGui4.dll copy bin\QtGui4.dll build\nomosdk
if not exist build\QtNetwork4.dll copy bin\QtNetwork4.dll build\nomosdk
if not exist build\QtWebKit4.dll copy bin\QtWebKit4.dll build\nomosdk
if not exist build\QtSolutions_SingleApplication-2.6.dll copy bin\QtSolutions_SingleApplication-2.6.dll build\nomosdk
if not exist build\libxml2.dll copy bin\libxml2.dll build\nomosdk
if not exist build\libxslt.dll copy bin\libxslt.dll build\nomosdk
if not exist build\libexslt.dll copy bin\libexslt.dll build\nomosdk
REM if not exist build\libgcc_s_dw2-1.dll copy bin\libgcc_s_dw2-1.dll build\nomosdk
REM if not exist build\libgnat-2011.dll copy bin\libgnat-2011.dll build\nomosdk
if not exist build\iconv.dll copy bin\iconv.dll build\nomosdk
if not exist build\msvcp100.dll copy bin\msvcp100.dll build\nomosdk
if not exist build\msvcr100.dll copy bin\msvcr100.dll build\nomosdk
if not exist build\zlib1.dll copy bin\zlib1.dll build\nomosdk
if not exist R (
mkdir build\nomosdk\R
copy bin\R\* build\nomosdk\R
xcopy bin\R\bin build\nomosdk\R\bin /D /E /C /R /H /I /K /Y
xcopy bin\R\Tcl build\nomosdk\R\Tcl /D /E /C /R /H /I /K /Y
xcopy bin\R\etc build\nomosdk\R\etc /D /E /C /R /H /I /K /Y
mkdir build\nomosdk\R\library
xcopy bin\R\library\base build\nomosdk\R\library\base /D /E /C /R /H /I /K /Y
xcopy bin\R\library\chron build\nomosdk\R\library\chron /D /E /C /R /H /I /K /Y
xcopy bin\R\library\DBI build\nomosdk\R\library\DBI /D /E /C /R /H /I /K /Y
xcopy bin\R\library\graphics build\nomosdk\R\library\graphics /D /E /C /R /H /I /K /Y
xcopy bin\R\library\grDevices build\nomosdk\R\library\grDevices /D /E /C /R /H /I /K /Y
xcopy bin\R\library\gsubfn build\nomosdk\R\library\gsubfn /D /E /C /R /H /I /K /Y
xcopy bin\R\library\methods build\nomosdk\R\library\methods /D /E /C /R /H /I /K /Y
xcopy bin\R\library\proto build\nomosdk\R\library\proto /D /E /C /R /H /I /K /Y
xcopy bin\R\library\RSQLite build\nomosdk\R\library\RSQLite /D /E /C /R /H /I /K /Y
xcopy bin\R\library\RSQLite.extfuns build\nomosdk\R\library\RSQLite.extfuns /D /E /C /R /H /I /K /Y
xcopy bin\R\library\RSVGTipsDevice build\nomosdk\R\library\RSVGTipsDevice /D /E /C /R /H /I /K /Y
xcopy bin\R\library\sqldf build\nomosdk\R\library\sqldf /D /E /C /R /H /I /K /Y
xcopy bin\R\library\stats build\nomosdk\R\library\stats /D /E /C /R /H /I /K /Y
xcopy bin\R\library\tcltk build\nomosdk\R\library\tcltk /D /E /C /R /H /I /K /Y
xcopy bin\R\library\utils build\nomosdk\R\library\utils /D /E /C /R /H /I /K /Y
)
