From 4a364787d3f71bd8010767cd1b7ec3befda665f4 Mon Sep 17 00:00:00 2001
From: Diego Caceres <Diego.Caceres@creatis.insa-lyon.fr>
Date: Sun, 10 Jun 2012 17:38:21 +0000
Subject: [PATCH] ThirdPartyLibraries script updates

---
 .../install/CMakeLists.txt                    |  16 +-
 .../install/CMakeLists.txt                    |   2 +-
 .../install_generate_thirdparty.bat_TEMPLATE  |  16 +-
 .../scripts/generateThirdPartyLibExe.bat      |   5 +-
 .../scripts/generateThirdPartydllsExe.bat     |   5 +-
 .../scripts/install_thirdparty_all.bat        | 230 +++---------------
 .../scripts/install_thirdparty_dlls_cmake.bat |  10 +-
 .../install_thirdparty_libraries_cmake.bat    |   8 +-
 .../scripts/move_thirdparty_dlls.bat          |  92 ++++---
 .../scripts/move_thirdparty_libraries.bat     |  75 +++---
 10 files changed, 179 insertions(+), 280 deletions(-)

diff --git a/Install_ThirdParty/cmake/crea_ThirdParty_Libraries/install/CMakeLists.txt b/Install_ThirdParty/cmake/crea_ThirdParty_Libraries/install/CMakeLists.txt
index 5a28fcd..7a82a09 100644
--- a/Install_ThirdParty/cmake/crea_ThirdParty_Libraries/install/CMakeLists.txt
+++ b/Install_ThirdParty/cmake/crea_ThirdParty_Libraries/install/CMakeLists.txt
@@ -49,14 +49,14 @@ IF(WIN32 AND NOT UNIX)
   SET(CPACK_NSIS_MODIFY_PATH OFF)
 
 
-  set  (CREA_BOOST_LYBRARY	Boost-1.46.1)
+  set  (CREA_BOOST_LYBRARY	boost)
   set  (CREA_GDCM_LYBRARY	gdcm )
-  set  (CREA_ITK_LYBRARY	InsightToolkit-3.20.0 )
-  set  (CREA_QT_LYBRARY		Qt-4.7.3 )
-  set  (CREA_VTK_LYBRARY	VTK )  
-  set  (CREA_WXWIN_LYBRARY	wxWidgets-2.8.12)
-  set  (CREA_XERCES_LYBRARY	xerces-c-3.1.1)
-  set  (CREA_MIKATEX_LYBRARY	MiKTeX-2.9)
+  set  (CREA_ITK_LYBRARY	itk )
+  set  (CREA_QT_LYBRARY		qt )
+  set  (CREA_VTK_LYBRARY	vtk )  
+  set  (CREA_WXWIN_LYBRARY	wxWidgets)
+  set  (CREA_XERCES_LYBRARY	xerces)
+  set  (CREA_MIKATEX_LYBRARY miktex)
   
   #set  (CREA_KWWIDGETS_LYBRARY   KWWidgets-090109 )
   
@@ -125,7 +125,7 @@ IF (WIN32)
 		WriteRegStr HKLM 'SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment' 'GDCM_DIR' '$INSTDIR\\\\${CREA_LIBRARY_DESTINATION_PATH}\\\\${CREA_GDCM_LYBRARY}\\\\lib\\\\gdcm' 
 		WriteRegStr HKLM 'SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment' 'ITK_DIR' '$INSTDIR\\\\${CREA_LIBRARY_DESTINATION_PATH}\\\\${CREA_ITK_LYBRARY}\\\\lib\\\\InsightToolkit' 
 		WriteRegStr HKLM 'SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment' 'QTDIR' '$INSTDIR\\\\${CREA_LIBRARY_DESTINATION_PATH}\\\\${CREA_QT_LYBRARY}' 
-		WriteRegStr HKLM 'SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment' 'VTK_DIR' '$INSTDIR\\\\${CREA_LIBRARY_DESTINATION_PATH}\\\\${CREA_VTK_LYBRARY}\\\\lib\\\\vtk-5.8' 
+		WriteRegStr HKLM 'SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment' 'VTK_DIR' '$INSTDIR\\\\${CREA_LIBRARY_DESTINATION_PATH}\\\\${CREA_VTK_LYBRARY}\\\\lib\\\\vtk-5.10' 
 		WriteRegStr HKLM 'SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment' 'WXWIN' '$INSTDIR\\\\${CREA_LIBRARY_DESTINATION_PATH}\\\\${CREA_WXWIN_LYBRARY}' 
 		WriteRegStr HKLM 'SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment' 'XERCES_DIR' '$INSTDIR\\\\${CREA_LIBRARY_DESTINATION_PATH}\\\\${CREA_XERCES_LYBRARY}' 
 		#WriteRegStr HKLM 'SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment' 'KWWidgets_dir' '$INSTDIR\\\\${CREA_LIBRARY_DESTINATION_PATH}\\\\${CREA_KWWIDGETS_LYBRARY}\\\\lib\\\\KWWidgets' 
diff --git a/Install_ThirdParty/cmake/crea_ThirdParty_dlls/install/CMakeLists.txt b/Install_ThirdParty/cmake/crea_ThirdParty_dlls/install/CMakeLists.txt
index 5dc628d..bcf229e 100644
--- a/Install_ThirdParty/cmake/crea_ThirdParty_dlls/install/CMakeLists.txt
+++ b/Install_ThirdParty/cmake/crea_ThirdParty_dlls/install/CMakeLists.txt
@@ -48,7 +48,7 @@ ENDIF(WIN32 AND NOT UNIX)
 # Aditional INSTALL for CPACK mecanism.
 IF(WIN32)
 
-	set  (MessageLibraryPath "CREA_LIBRARY_DLL_PATH (itk,vtk,gdcm,wx,Qt,tth)")
+	set  (MessageLibraryPath "CREA_LIBRARY_DLL_PATH (itk,vtk,gdcm,wx,qt,tth)")
 	set  (CREA_LIBRARY_DLL_PATH  "" CACHE PATH ${MessageLibraryPath} )	
 
   
diff --git a/Install_ThirdParty/install_generate_thirdparty.bat_TEMPLATE b/Install_ThirdParty/install_generate_thirdparty.bat_TEMPLATE
index 8fb233e..6863283 100644
--- a/Install_ThirdParty/install_generate_thirdparty.bat_TEMPLATE
+++ b/Install_ThirdParty/install_generate_thirdparty.bat_TEMPLATE
@@ -18,19 +18,27 @@ echo -----------------------------------
 echo -------Calling Scripts-------------
 echo -----------------------------------
 
+echo starting time
+time /t
+date /T
+
 cd scripts
 
+echo Calling download_ThirdPartySW.bat
+
+call download_ThirdPartySW.bat %thirdpartyGeneration% %buildType% >> downloadTP.log 2>&1
+
 echo Calling install_thirdparty.bat
 
 start /wait install_thirdparty.bat %thirdpartyGeneration% %buildType%
 
 echo Calling generateThirdPartydllsExe.bat
 
-start /wait generateThirdPartydllsExe.bat %thirdpartyGeneration%
+start /wait generateThirdPartydllsExe.bat %thirdpartyGeneration% %buildType%
 
 echo Calling generateThirdPartyLibExe.bat
 
-start /wait generateThirdPartyLibExe.bat %thirdpartyGeneration%
+start /wait generateThirdPartyLibExe.bat %thirdpartyGeneration% %buildType%
 
 cd..
 
@@ -38,6 +46,10 @@ echo -----------------------------------
 echo -------End of the Script-----------
 echo -----------------------------------
 
+echo ending time
+time /t
+date /T
+
 pause
 
 exit
\ No newline at end of file
diff --git a/Install_ThirdParty/scripts/generateThirdPartyLibExe.bat b/Install_ThirdParty/scripts/generateThirdPartyLibExe.bat
index 2f7c752..a626098 100644
--- a/Install_ThirdParty/scripts/generateThirdPartyLibExe.bat
+++ b/Install_ThirdParty/scripts/generateThirdPartyLibExe.bat
@@ -1,13 +1,14 @@
 @echo off
 
 set thirdpartyGeneration=%1
+set buildType=%2
 
 echo Calling move_thirdparty_libraries.bat
 
-call move_thirdparty_libraries.bat %thirdpartyGeneration% >> generateThirdpartyLibExe.log 2>&1
+call move_thirdparty_libraries.bat %thirdpartyGeneration% %buildType% >> generateThirdpartyLibExe.log 2>&1
 
 echo Calling install_thirdparty_libraries_cmake.bat
 
-call install_thirdparty_libraries_cmake.bat  %thirdpartyGeneration% >> generateThirdpartyLibExe.log 2>&1
+call install_thirdparty_libraries_cmake.bat  %thirdpartyGeneration% %buildType% >> generateThirdpartyLibExe.log 2>&1
 
 exit
\ No newline at end of file
diff --git a/Install_ThirdParty/scripts/generateThirdPartydllsExe.bat b/Install_ThirdParty/scripts/generateThirdPartydllsExe.bat
index 5a51ef3..cb61a8b 100644
--- a/Install_ThirdParty/scripts/generateThirdPartydllsExe.bat
+++ b/Install_ThirdParty/scripts/generateThirdPartydllsExe.bat
@@ -1,13 +1,14 @@
 @echo off
 
 set thirdpartyGeneration=%1
+set buildType=%2
 
 echo Calling move_thirdparty_dlls.bat
 
-call move_thirdparty_dlls.bat %thirdpartyGeneration% >> generateThirdpartydllsExe.log 2>&1
+call move_thirdparty_dlls.bat %thirdpartyGeneration% %buildType% >> generateThirdpartydllsExe.log 2>&1
 
 echo Calling install_thirdparty_dlls_cmake.bat
 
-call install_thirdparty_dlls_cmake.bat  %thirdpartyGeneration% >> generateThirdpartydllsExe.log 2>&1
+call install_thirdparty_dlls_cmake.bat  %thirdpartyGeneration% %buildType% >> generateThirdpartydllsExe.log 2>&1
 
 exit
\ No newline at end of file
diff --git a/Install_ThirdParty/scripts/install_thirdparty_all.bat b/Install_ThirdParty/scripts/install_thirdparty_all.bat
index 5a6a2bb..2a25732 100644
--- a/Install_ThirdParty/scripts/install_thirdparty_all.bat
+++ b/Install_ThirdParty/scripts/install_thirdparty_all.bat
@@ -2,9 +2,18 @@
 echo -----------------------------------
 echo ------Installing Libraries---------
 echo -----------------------------------
+
 echo -----------------------------------
-echo ------Asking Architecture----------
+echo ---Setting Environment Variables---
 echo -----------------------------------
+
+set thirdpartyGeneration=%1
+set buildType=%2
+
+set installpath=%thirdpartyGeneration%\thirdparty_install\%buildType%
+set binpath=%thirdpartyGeneration%\thirdparty_bin\%buildType%
+set sourcepath=%thirdpartyGeneration%\thirdparty_source\%buildType%
+
 if %PROCESSOR_ARCHITECTURE%==x86 (
   set ProgramFilesPath_x86=%ProgramFiles%
   echo "Architecture found = x86"
@@ -14,63 +23,24 @@ if %PROCESSOR_ARCHITECTURE%==x86 (
   echo "Architecture found = x64"
 )
 
-echo ----End Asking Architecture--------
-
-echo -----------------------------------
-echo ---Setting Environment Variables---
-echo -----------------------------------
-
-set thirdpartyGeneration=%1
-set buildType=%2
-
-set urlCreatisSource=http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source
-set urlCreatisSource=http://www.creatis.insa-lyon.fr/~caceres/software
-
-set zipPath="%ProgramFilesPath_x86%\7-Zip\7z.exe"
-set miktex="%ProgramFilesPath_x86%\MiKTeX 2.9\miktex\bin\texworks.exe"
 set vcvarsall="%ProgramFilesPath_x86%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
-set wgetPath=%cd%\..\..\windows\creaTools_win_installers\CreaTools_v2_0_0_win32_installer\bin\wget.exe
-
-if not exist %zipPath% set zipPath="%ProgramFilesPath_x64%\7-Zip\7z.exe"
-if not exist %zipPath% (
-  echo ERROR!!! 7Zip has not been found in the system
-  exit
-)
 if not exist %vcvarsall% set vcvarsall="%ProgramFilesPath_x64%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
 if not exist %vcvarsall% (
   echo ERROR!!! Visual Studio has not been found in the system
   exit
 )
 
-if not exist %miktex% (
- set miktex="%ProgramFilesPath_x64%\MiKTeX 2.9\miktex\bin\texworks.exe"
- if not exist %miktex% (
-  echo ERROR!!! MiKTex has not been found in the system
-  exit
- )
-)
-
-if not exist %wgetPath% (
-  echo ERROR!!! wget has not been found in the system
-  exit
-)
-
-
-set installpath=%thirdpartyGeneration%\thirdparty_install\%buildType%
-set binpath=%thirdpartyGeneration%\thirdparty_bin\%buildType%
-set sourcepath=%thirdpartyGeneration%\thirdparty_source\%buildType%
-
-set qt=Qt-4.7.3
-set buildWxWidgets28=1
-if %buildWxWidgets28%==1 set wxWidgets=wxWidgets-2.8.12
-if %buildWxWidgets28%==0 set wxWidgets=wxWidgets-2.9.2
-set boost=Boost-1.46.1
-set xercesc=xerces-c-3.1.1
-set itk=InsightToolkit-3.20.0
+set qt=qt
+set jom=jom
+set wxWidgets=wxWidgets
+set boost=boost
+set xercesc=xerces
+set itk=itk
 set gdcm=gdcm
-set vtk=VTK
+set vtk=vtk
 
 set QTDIR=%sourcepath%\%qt%
+set JOMDIR=%sourcepath%\%jom%
 set WXDIR=%sourcepath%\%wxWidgets%
 set BOOSTDIR=%sourcepath%\%boost%
 set XERCESDIR=%sourcepath%\%xercesc%
@@ -105,6 +75,7 @@ echo XERCESDIR=%XERCESDIR%
 echo ITKSRCDIR=%ITKSRCDIR%
 echo VTKSRCDIR=%VTKSRCDIR%
 echo GDCMDIR=%GDCMSRCDIR%
+echo JOMDIR=%JOMDIR%
 
 echo -----------------------------------
 echo ---End Setting Global Variables----
@@ -113,106 +84,28 @@ echo -----------------------------------
 
 call %vcvarsall%
 
-echo -----------------------------------
-echo -------Creating Folders------------
-echo -----------------------------------
-
-rmdir /S /Q %thirdpartyGeneration%
-mkdir %thirdpartyGeneration%
-cd  %thirdpartyGeneration%
-mkdir %sourcepath%
-mkdir %binpath%
-mkdir %installpath%
-
-
-echo ------End Creating Folders---------
-
-echo -----------------------------------
-echo ------Downloading Sources----------
-echo -----------------------------------
-
-cd %sourcepath%\
-%wgetPath% %urlCreatisSource%/qt-4.7.3.zip
-IF %buildWxWidgets28%==0 (
-  %wgetPath% %urlCreatisSource%/wxWidgets-2.9.2.7z
-) ELSE (
-  %wgetPath% %urlCreatisSource%/wxWidgets-2.8.12.tar.gz
-)
-%wgetPath% %urlCreatisSource%/boost_1_46_1.7z
-%wgetPath% %urlCreatisSource%/vtk-5.8.0.tar.gz
-%wgetPath% %urlCreatisSource%/InsightToolkit-3.20.0.zip
-%wgetPath% %urlCreatisSource%/gdcm_11_Oct_2011.tar.gz
-%wgetPath% %urlCreatisSource%/xerces-c-3.1.1.zip
-%wgetPath% %urlCreatisSource%/tth_exe.zip
-echo ------End Downloading Sources------
 echo -----------------------------------
 echo --------Qt Installation------------
 echo -----------------------------------
-echo ----------Extracting---------------
-
-cd %sourcepath%
-%zipPath% x %sourcepath%\qt-4.7.3.zip
-del %sourcepath%\qt-4.7.3.zip
-
-echo --------Renaming Folder------------
-
-rename qt-everywhere-opensource-src-4.7.3 %qt%
-
-echo ----------Installing---------------
-
-
 cd %QTDIR%
+set QMAKESPEC=win32-msvc2010
 
 echo y | configure -%buildType% -opensource -shared -qt-sql-sqlite -phonon -phonon-backend -platform win32-msvc2010 -mp
 
-nmake
-cd C:\
+%JOMDIR%\jom.exe -j 8
 
-echo ------End QT Installation----------
+cd C:\
 
 echo -----------------------------------
 echo -----wxWidgets Installation--------
 echo -----------------------------------
-echo ----------Extracting---------------
-
-cd %sourcepath%
-IF %buildWxWidgets28%==0 (
-  md %wxWidgets%
-  cd %wxWidgets%
-  %zipPath% x %sourcepath%\wxWidgets-2.9.2.7z
-  del %sourcepath%\wxWidgets-2.9.2.7z
-) ELSE (
- %zipPath% x %sourcepath%\wxWidgets-2.8.12.tar.gz
- %zipPath% x %sourcepath%\wxWidgets-2.8.12.tar
- del %sourcepath%\wxWidgets-2.8.12.tar.gz
- del %sourcepath%\wxWidgets-2.8.12.tar
-)
-echo ----------Installing---------------
-
-cd %sourcepath%\%wxWidgets%\build\msw
-IF %buildWxWidgets28%==0 (
-  nmake -f makefile.vc BUILD=%buildType% USE_OPENGL=1 USE_GUI=1 UNICODE=0 SHARED=1
-) ELSE (
-  nmake -f makefile.vc BUILD=%buildType% UNICODE=0 SHARED=1
-)
+cd %WXDIR%\build\msw
+nmake -f makefile.vc BUILD=%buildType% UNICODE=0 SHARED=1
 cd C:\
 
-echo ----End wxWidgets Installation-----
-
 echo -----------------------------------
 echo ------Boost Installation-----------
 echo -----------------------------------
-echo ----------Extracting---------------
-
-cd %sourcepath%
-%zipPath% x %sourcepath%\boost_1_46_1.7z
-del %sourcepath%\boost_1_46_1.7z
-
-echo --------Renaming Folder------------
-
-rename boost_1_46_1 %boost%
-
-echo ----------Installing---------------
 
 mkdir %binpath%\%boost%Bin 
 mkdir %installpath%\%boost%
@@ -220,25 +113,13 @@ mkdir %installpath%\%boost%
 cd %sourcepath%\%boost%
 
 call bootstrap.bat
-bjam.exe --toolset=msvc-10.0 --build-type=complete --build-dir=%binpath%\%boost%Bin --link=shared --runtime-link=shared --prefix=%installpath%\%boost% install
+bjam.exe -j 8 --toolset=msvc-10.0 --build-type=complete --build-dir=%binpath%\%boost%Bin --link=shared --runtime-link=shared --prefix=%installpath%\%boost% install
 cd C:\
 
-echo -----End Boost Installation--------
 
 echo -----------------------------------
 echo -------VTK Installation------------
 echo -----------------------------------
-echo ----------Extracting---------------
-
-cd %sourcepath%
-%zipPath% x %sourcepath%\VTK-5.8.0.tar.gz
-%zipPath% x %sourcepath%\VTK-5.8.0.tar
-cd %sourcepath%\VTK
-del %sourcepath%\VTK-5.8.0.tar.gz
-del %sourcepath%\VTK-5.8.0.tar
-
-echo ----------Installing---------------
-
 
 cd  %binpath%
 mkdir %vtk%Bin
@@ -247,22 +128,15 @@ cmake -G"Visual Studio 10"  -H%sourcepath%\%vtk% -B%binpath%\%vtk%Bin
 cmake -D USE_DEBUG_LIB:BOOL=%buildType% -D CMAKE_INSTALL_PREFIX:PATH=%installpath%\%vtk%\ CMakeCache.txt
 cmake -D BUILD_EXAMPLES:BOOL=OFF -D BUILD_TESTING:BOOL=OFF -D BUILD_SHARED_LIBS:BOOL=ON -D VTK_USE_QT:BOOL=ON CMakeCache.txt
 cmake CMakeCache.txt
-FOR /R %%a IN (*.sln) DO msbuild %%a /p:Configuration=%buildType%
-msbuild /p:Configuration=%buildType% INSTALL.vcxproj
+FOR /R %%a IN (*.sln) DO msbuild %%a /m:8 /p:UseEnv=true;BuildInParallel=true;Configuration=%buildType%
+msbuild /m:8 /p:UseEnv=true;BuildInParallel=true;Configuration=%buildType% INSTALL.vcxproj
 cd c:\
-echo ------End VTK Installation---------
 
 echo -----------------------------------
 echo -------ITK Installation------------
 echo -----------------------------------
 echo ----------Extracting---------------
 
-cd %sourcepath%
-%zipPath% x InsightToolkit-3.20.0.zip
-del InsightToolkit-3.20.0.zip
-
-echo ----------Installing---------------
-
 cd  %binpath%
 mkdir %itk%Bin
 cd %itk%Bin
@@ -270,45 +144,21 @@ cmake -G"Visual Studio 10" -H%sourcepath%\%itk% -B%binpath%\%itk%Bin
 cmake -D USE_DEBUG_LIB:BOOL=%buildType% -D CMAKE_INSTALL_PREFIX:PATH=%installpath%\%itk%\ CMakeCache.txt
 cmake -D BUILD_EXAMPLES:BOOL=OFF -D BUILD_TESTING:BOOL=OFF -D BUILD_SHARED_LIBS:BOOL=ON -D ITK_USE_REVIEW:BOOL=ON CMakeCache.txt
 cmake CMakeCache.txt
-FOR /R %%a IN (*.sln) DO msbuild %%a /p:Configuration=%buildType%
-msbuild /p:Configuration=%buildType% INSTALL.vcxproj
+FOR /R %%a IN (*.sln) DO msbuild %%a /m:8 /p:UseEnv=true;BuildInParallel=true;Configuration=%buildType%
+msbuild /m:8 /p:UseEnv=true;BuildInParallel=true;Configuration=%buildType% INSTALL.vcxproj
 cd c:\
 
-echo ------End ITK Installation---------
-
 echo -----------------------------------
 echo ------XERCES Installation----------
 echo -----------------------------------
-echo ----------Extracting---------------
-
-cd %sourcepath%
-%zipPath% x xerces-c-3.1.1.zip
-del xerces-c-3.1.1.zip
-
-echo ----------Installing---------------
-
 cd  %sourcepath%\%xercesc%\projects\Win32\VC10\xerces-all
-FOR /R %%a IN (*.sln) DO msbuild %%a /p:Configuration=build
-FOR /R %%a IN (*.sln) DO msbuild %%a /p:Configuration=%buildType%
-msbuild /p:Configuration=%buildType% INSTALL.vcxproj
-
-echo -----End XERCES Installation-------
-
-
+FOR /R %%a IN (*.sln) DO msbuild %%a /m:8 /p:UseEnv=true;BuildInParallel=true;Configuration=%buildType%
+FOR /R %%a IN (*.sln) DO msbuild %%a /m:8 /p:UseEnv=true;BuildInParallel=true;Configuration=%buildType%
+msbuild /m:8 /p:UseEnv=true;BuildInParallel=true;Configuration=%buildType% INSTALL.vcxproj
 
 echo -----------------------------------
 echo -------GDCM Installation-----------
 echo -----------------------------------
-echo ----------Extracting---------------
-
-cd %sourcepath%
-%zipPath% x gdcm_11_Oct_2011.tar.gz
-%zipPath% x gdcm_11_Oct_2011.tar
-del gdcm_11_Oct_2011.tar.gz
-del gdcm_11_Oct_2011.tar
-
-echo ----------Installing---------------
-
 
 cd  %binpath%
 mkdir %gdcm%Bin
@@ -318,22 +168,10 @@ cmake -G"Visual Studio 10"  -H%sourcepath%\%gdcm% -B%binpath%\%gdcm%Bin
 cmake -D USE_DEBUG_LIB:BOOL=%buildType% -D CMAKE_INSTALL_PREFIX:PATH=%installpath%\%gdcm%\ CMakeCache.txt
 cmake -D VTK_DIR:PATH=%installpath%\%vtk%\ -D GDCM_VTK:BOOL=ON -D BUILD_TESTING:BOOL=OFF -D GDCM_NAME_SPACE:STRING=gdcm13 CMakeCache.txt
 cmake CMakeCache.txt
-FOR /R %%a IN (*.sln) DO msbuild %%a /p:Configuration=%buildType%
-msbuild /p:Configuration=%buildType% INSTALL.vcxproj
+FOR /R %%a IN (*.sln) DO msbuild %%a /m:8 /p:UseEnv=true;BuildInParallel=true;Configuration=%buildType%
+msbuild /m:8 /p:UseEnv=true;BuildInParallel=true;Configuration=%buildType% INSTALL.vcxproj
 cd c:\
 
-echo -----End GDCM Installation---------
-
-echo -----------------------------------
-echo -------TTH Installation------------
-echo -----------------------------------
-echo ----------Extracting---------------
-cd %sourcepath%
-%zipPath% x tth_exe.zip
-rename tth_exe tth
-del tth_exe.zip
-echo ------End TTH Installation---------
-cd c:\
 echo -----------------------------------
 echo ---End of Installing Libraries-----
 echo -----------------------------------
diff --git a/Install_ThirdParty/scripts/install_thirdparty_dlls_cmake.bat b/Install_ThirdParty/scripts/install_thirdparty_dlls_cmake.bat
index c1929dc..aa2f07b 100644
--- a/Install_ThirdParty/scripts/install_thirdparty_dlls_cmake.bat
+++ b/Install_ThirdParty/scripts/install_thirdparty_dlls_cmake.bat
@@ -17,6 +17,9 @@ if %PROCESSOR_ARCHITECTURE%==x86 (
 echo ----End Asking Architecture--------
 
 set thirdpartyGeneration=%1
+set buildType=%2
+
+
 set version="3.0.1-win32"
 
 set thirdparty_cmake=%cd%\..\cmake
@@ -25,7 +28,7 @@ set vcvarsall="%ProgramFilesPath_x86%\Microsoft Visual Studio 10.0\VC\vcvarsall.
 
 set thirdpartydllspath=%thirdpartyGeneration%\thirdparty_temp\creaThirdParty_dlls
 set sourcepath=%thirdparty_cmake%\crea_ThirdParty_dlls
-set binpath=%thirdpartyGeneration%\thirdparty_bin\crea_ThirdParty_dlls_Bin
+set binpath=%thirdpartyGeneration%\thirdparty_bin\%buildType%\crea_ThirdParty_dlls_Bin
 set installpath="ProgramFilesPath_x86\creatools\crea_ThirdParty_dlls"
 
 if not exist %vcvarsall% set zipPath="%ProgramFilesPath_x64%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
@@ -36,10 +39,7 @@ if not exist %vcvarsall% (
 
 call %vcvarsall%
 
-rmdir %binpath% /s /q
-
 mkdir %binpath%
-
 cd %binpath%
 
 cmake -G"Visual Studio 10"  -H%sourcepath% -B%binpath%
@@ -54,8 +54,6 @@ set installerPath="%thirdpartydllspath%\thirdparty_bin\crea_ThirdParty_dlls_Bin\
 if exist installerPath (
 mkdir %thirdpartyGeneration%\thirdparty_installers
 move /Y %installerPath% %thirdpartyGeneration%\thirdparty_installers
-rmdir %binpath% /s /q
-rmdir %thirdpartydllspath% /s /q
 )
 
 exit /B
\ No newline at end of file
diff --git a/Install_ThirdParty/scripts/install_thirdparty_libraries_cmake.bat b/Install_ThirdParty/scripts/install_thirdparty_libraries_cmake.bat
index 576822a..0f5b872 100644
--- a/Install_ThirdParty/scripts/install_thirdparty_libraries_cmake.bat
+++ b/Install_ThirdParty/scripts/install_thirdparty_libraries_cmake.bat
@@ -17,6 +17,8 @@ if %PROCESSOR_ARCHITECTURE%==x86 (
 echo ----End Asking Architecture--------
 
 set thirdpartyGeneration=%1
+set buildType=%2
+
 set version="3.0.1-win32"
 
 set thirdparty_cmake=%cd%\..\cmake
@@ -25,7 +27,7 @@ set vcvarsall="%ProgramFilesPath_x86%\Microsoft Visual Studio 10.0\VC\vcvarsall.
 
 set thirdpartylibpath=%thirdpartyGeneration%\thirdparty_temp\creaThirdParty_libraries
 set sourcepath=%thirdparty_cmake%\crea_ThirdParty_Libraries
-set binpath=%thirdpartyGeneration%\thirdparty_bin\creaTPLBin
+set binpath=%thirdpartyGeneration%\thirdparty_bin\%buildType%\creaTPLBin
 set installpath="ProgramFilesPath_x86\creatools\crea_ThirdParty_Libraries"
 
 if not exist %vcvarsall% set zipPath="%ProgramFilesPath_x64%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
@@ -36,8 +38,6 @@ if not exist %vcvarsall% (
 
 call %vcvarsall%
 
-rmdir %binpath% /s /q
-
 mkdir %binpath%
 cd %binpath%
 
@@ -53,8 +53,6 @@ set installerPath="%thirdpartydllspath%\thirdparty_bin\creaTPLBin\crea_ThirdPart
 if exist installerPath (
 mkdir %thirdpartyGeneration%\thirdparty_installers
 move /Y %installerPath% %thirdpartyGeneration%\thirdparty_installers
-rmdir %binpath% /s /q
-rmdir %thirdpartylibpath% /s /q
 )
 
 exit /B
\ No newline at end of file
diff --git a/Install_ThirdParty/scripts/move_thirdparty_dlls.bat b/Install_ThirdParty/scripts/move_thirdparty_dlls.bat
index 5aea0bc..5c6da0f 100644
--- a/Install_ThirdParty/scripts/move_thirdparty_dlls.bat
+++ b/Install_ThirdParty/scripts/move_thirdparty_dlls.bat
@@ -7,20 +7,23 @@ echo ---Setting Enviroment Variables----
 echo -----------------------------------
 
 set thirdpartyGeneration=%1
-set thirdpartyInstallPath=%2
+set buildType=%2
+
+set installpath=%thirdpartyGeneration%\thirdparty_install\%buildType%
+set binpath=%thirdpartyGeneration%\thirdparty_bin\%buildType%
+set sourcepath=%thirdpartyGeneration%\thirdparty_source\%buildType%
 
-set installpath=%thirdpartyGeneration%\thirdparty_install
-set binpath=%thirdpartyGeneration%\thirdparty_bin
-set sourcepath=%thirdpartyGeneration%\thirdparty_source
 set creaThirdPartydlls=%thirdpartyGeneration%\thirdparty_temp\creaThirdParty_dlls
 
-set qt=Qt-4.7.3
-set wxWidgets=wxWidgets-2.8.12
-set boost=Boost-1.46.1
-set xercesc=xerces-c-3.1.1
-set itk=InsightToolkit-3.20.0
+set qt=qt
+set jom=jom
+set wxWidgets=wxWidgets
+set boost=boost
+set xercesc=xerces
+set itk=itk
 set gdcm=gdcm
-set vtk=VTK
+set vtk=vtk
+set tth=tth
 
 set QTDIR=%sourcepath%\%qt%
 set WXDIR=%sourcepath%\%wxWidgets%
@@ -34,33 +37,69 @@ set ITKINSTALLDIR=%installpath%\%itk%
 set VTKINSTALLDIR=%installpath%\%vtk%
 set GDCMINSTALLDIR=%installpath%\%gdcm%
 
-rmdir %creaThirdPartydlls% /s /q
+rmdir /S /Q %creaThirdPartydlls%
 
 mkdir %creaThirdPartydlls%
 
+echo setting buildtype libraries
+echo if(%buildType%=="release")(
+	set qtBtype=4
+	set wxPrefixBase=wxbase293
+	set wxPrefixmsw=wxmsw293
+	set boostMT=-vc100-mt-1_49.dll
+	set boostMTGD=-vc100-mt-gd-1_49.dll
+echo ) else (
+echo	set qtBtype=d4
+echo	set wxPrefixBase=wxbase293d
+echo	set wxPrefixmsw=wxmsw293d
+echo )
+
+echo -----------------------------------
+echo Environment variables Configuration
+echo -----------------------------------
+echo ThirdpartyGeneration=%thirdpartyGeneration%
+echo MikTex=%miktex%
+echo miktexAux=%miktexAux%
+echo InstallPath=%installpath%
+echo BinPath=%binpath%
+echo SourcePath=%sourcepath%
+echo creaThirdPartyLibraries=%thirdpartyInstallPath%\creaThirdParty_libraries
+echo QT=%qt%
+echo WX=%wxWidgets%
+echo BOOST=%boost%
+echo Xercesc=%xercesc%
+echo ITK=%itk%
+echo GDCM=%gdcm%
+echo VTK=%vtk%
+echo QTDIR=%QTDIR%
+echo WKDIR=%WXDIR%
+echo BOOSTDIR=%BOOSTDIR%
+echo XERCESDIR=%XERCESDIR%
+echo ITKSRCDIR=%ITKSRCDIR%
+echo VTKSRCDIR=%VTKSRCDIR%
+
+
 echo -----------------------------------
 echo -------------QT--------------------
 echo -----------------------------------
 
-copy /V /Y %QTDIR%\bin\phonon4.dll %creaThirdPartydlls%
-copy /V /Y %QTDIR%\bin\QtCore4.dll %creaThirdPartydlls%
-copy /V /Y %QTDIR%\bin\QtGui4.dll %creaThirdPartydlls%
-copy /V /Y %QTDIR%\bin\QtNetwork4.dll %creaThirdPartydlls%
-copy /V /Y %QTDIR%\bin\QtOpenGL4.dll %creaThirdPartydlls%
-copy /V /Y %QTDIR%\bin\QtScript4.dll %creaThirdPartydlls%
-copy /V /Y %QTDIR%\bin\QtScriptTools4.dll %creaThirdPartydlls%
-copy /V /Y %QTDIR%\bin\QtSql4.dll %creaThirdPartydlls%
-copy /V /Y %QTDIR%\bin\QtSvg4.dll %creaThirdPartydlls%
-copy /V /Y %QTDIR%\bin\QtTest4.dll %creaThirdPartydlls%
-copy /V /Y %QTDIR%\bin\QtXml4.dll %creaThirdPartydlls%
-copy /V /Y %QTDIR%\bin\QtXmlPatterns4.dll %creaThirdPartydlls%
+copy /V /Y %QTDIR%\bin\phonon%qtBtype%.dll %creaThirdPartydlls%
+copy /V /Y %QTDIR%\bin\QtCore%qtBtype%.dll %creaThirdPartydlls%
+copy /V /Y %QTDIR%\bin\QtGui%qtBtype%.dll %creaThirdPartydlls%
+copy /V /Y %QTDIR%\bin\QtNetwork%qtBtype%.dll %creaThirdPartydlls%
+copy /V /Y %QTDIR%\bin\QtOpenGL%qtBtype%.dll %creaThirdPartydlls%
+copy /V /Y %QTDIR%\bin\QtScript%qtBtype%.dll %creaThirdPartydlls%
+copy /V /Y %QTDIR%\bin\QtScriptTools%qtBtype%.dll %creaThirdPartydlls%
+copy /V /Y %QTDIR%\bin\QtSql%qtBtype%.dll %creaThirdPartydlls%
+copy /V /Y %QTDIR%\bin\QtSvg%qtBtype%.dll %creaThirdPartydlls%
+copy /V /Y %QTDIR%\bin\QtTest%qtBtype%.dll %creaThirdPartydlls%
+copy /V /Y %QTDIR%\bin\QtXml%qtBtype%.dll %creaThirdPartydlls%
+copy /V /Y %QTDIR%\bin\QtXmlPatterns%qtBtype%.dll %creaThirdPartydlls%
 
 echo -----------------------------------
 echo -------------wxWidgets-------------
 echo -----------------------------------
 
-set wxPrefixBase=wxbase28
-set wxPrefixmsw=wxmsw28
 
 copy /V /Y %WXDIR%\lib\vc_dll\%wxPrefixBase%_net_vc_custom.dll %creaThirdPartydlls%
 copy /V /Y %WXDIR%\lib\vc_dll\%wxPrefixBase%_vc_custom.dll %creaThirdPartydlls%
@@ -80,9 +119,6 @@ echo -----------------------------------
 echo -------------Boost-----------------
 echo -----------------------------------
 
-set boostMT=-vc100-mt-1_46_1.dll
-set boostMTGD=-vc100-mt-gd-1_46_1.dll
-
 copy /V /Y %BOOSTINSTALLDIR%\lib\boost_date_time%boostMT% %creaThirdPartydlls%
 copy /V /Y %BOOSTINSTALLDIR%\lib\boost_date_time%boostMTGD% %creaThirdPartydlls%
 copy /V /Y %BOOSTINSTALLDIR%\lib\boost_filesystem%boostMT% %creaThirdPartydlls%
diff --git a/Install_ThirdParty/scripts/move_thirdparty_libraries.bat b/Install_ThirdParty/scripts/move_thirdparty_libraries.bat
index 0b0e4da..42dab7d 100644
--- a/Install_ThirdParty/scripts/move_thirdparty_libraries.bat
+++ b/Install_ThirdParty/scripts/move_thirdparty_libraries.bat
@@ -20,42 +20,62 @@ echo -----------------------------------
 set thirdpartyGeneration=%1
 set thirdpartyInstallPath=%2
 
-set miktex="%ProgramFilesPath_x86%\MiKTeX 2.9\miktex\bin\texworks.exe"
-set installpath=%thirdpartyGeneration%\thirdparty_install
-set binpath=%thirdpartyGeneration%\thirdparty_bin
-set sourcepath=%thirdpartyGeneration%\thirdparty_source
+set MIKTEXPFDIR="%ProgramFilesPath_x86%\MiKTeX 2.9\miktex\bin\texworks.exe"
+
+set installpath=%thirdpartyGeneration%\thirdparty_install\%buildType%
+set binpath=%thirdpartyGeneration%\thirdparty_bin\%buildType%
+set sourcepath=%thirdpartyGeneration%\thirdparty_source\%buildType%
+
 set creaThirdPartyLibraries=%thirdpartyGeneration%\thirdparty_temp\creaThirdParty_libraries
 
-set qt=Qt-4.7.3
-set wxWidgets=wxWidgets-2.8.12
-set boost=Boost-1.46.1
-set xercesc=xerces-c-3.1.1
-set itk=InsightToolkit-3.20.0
+set qt=qt
+set jom=jom
+set wxWidgets=wxWidgets
+set boost=boost
+set xercesc=xerces
+set itk=itk
 set gdcm=gdcm
-set vtk=VTK
+set vtk=vtk
 set tth=tth
-set miktexAux=MiKTeX-2.9
+set miktex=miktex
+
 
 set QTDIR=%sourcepath%\%qt%
 set WXDIR=%sourcepath%\%wxWidgets%
 set BOOSTDIR=%sourcepath%\%boost%
 set XERCESDIR=%sourcepath%\%xercesc%
 set ITKSRCDIR=%sourcepath%\%itk%
-set VTKSRCDIR=%sourcepath%\%VTK%
+set VTKSRCDIR=%sourcepath%\%vtk%
 set GDCMSRCDIR=%sourcepath%\%gdcm%
 set BOOSTINSTALLDIR=%installpath%\%boost%
 set ITKINSTALLDIR=%installpath%\%itk%
 set VTKINSTALLDIR=%installpath%\%vtk%
 set GDCMINSTALLDIR=%installpath%\%gdcm%
 set TTHDIR=%sourcepath%\%tth%
+set MIKTEXDIR=%creaThirdPartyLibraries%\%miktex%
 
-if not exist %miktex% (
- set miktex="%ProgramFilesPath_x64%\MiKTeX 2.9\miktex\bin\texworks.exe"
- if not exist %miktex% (
+if not exist %MIKTEXPFDIR% (
+ set MIKTEXPFDIR="%ProgramFilesPath_x64%\MiKTeX 2.9\miktex\bin\texworks.exe"
+ if not exist %MIKTEXPFDIR% (
   echo ERROR!!! MiKTex has not been found in the system
   exit
- ) else set miktex="%ProgramFilesPath_x64%\MiKTeX 2.9"
-) else set miktex="%ProgramFilesPath_x86%\MiKTeX 2.9"
+ ) else set MIKTEXPFDIR="%ProgramFilesPath_x64%\MiKTeX 2.9"
+) else set MIKTEXPFDIR="%ProgramFilesPath_x86%\MiKTeX 2.9"
+
+
+echo if(%buildType%==release)(
+	set qtBtype=4
+	set wxPrefixBase=wxbase293
+	set wxPrefixmsw=wxmsw293
+	set boostMT=-vc100-mt-1_49.lib
+	set boostMTGD=-vc100-mt-gd-1_49.lib
+	set boostMTS=-vc100-mt-s-1_49.lib
+	set boostMTSGD=-vc100-mt-sgd-1_49.lib
+echo ) else (
+echo	set qtBtype=d4
+echo 	set wxPrefixBase=wxbase293d
+echo	set wxPrefixmsw=wxmsw293d
+echo )
 
 echo -----------------------------------
 echo Environment variables Configuration
@@ -81,10 +101,11 @@ echo XERCESDIR=%XERCESDIR%
 echo ITKSRCDIR=%ITKSRCDIR%
 echo VTKSRCDIR=%VTKSRCDIR%
 
-rmdir %creaThirdPartyLibraries% /s /q
+rmdir /S /Q %creaThirdPartyLibraries%
 
 mkdir %creaThirdPartyLibraries%
 
+
 echo -----------------------------------
 echo -------------QT--------------------
 echo -----------------------------------
@@ -120,10 +141,10 @@ copy /V /Y %QTDIR%\bin\rcc.exe %creaThirdPartyLibraries%\%qt%\bin\
 copy /V /Y %QTDIR%\bin\uic.exe %creaThirdPartyLibraries%\%qt%\bin\
 copy /V /Y %QTDIR%\bin\uic3.exe %creaThirdPartyLibraries%\%qt%\bin\
 copy /V /Y %QTDIR%\bin\xmlpatterns.exe %creaThirdPartyLibraries%\%qt%\bin\
-copy /V /Y %QTDIR%\bin\Qt3Support4.dll %creaThirdPartyLibraries%\%qt%\bin\
-copy /V /Y %QTDIR%\bin\QtCore4.dll %creaThirdPartyLibraries%\%qt%\bin\
-copy /V /Y %QTDIR%\bin\QtDesigner4.dll %creaThirdPartyLibraries%\%qt%\bin\
-copy /V /Y %QTDIR%\bin\QtDesignerComponents4.dll %creaThirdPartyLibraries%\%qt%\bin\
+copy /V /Y %QTDIR%\bin\Qt3Support%qtBtype%.dll %creaThirdPartyLibraries%\%qt%\bin\
+copy /V /Y %QTDIR%\bin\QtCore%qtBtype%.dll %creaThirdPartyLibraries%\%qt%\bin\
+copy /V /Y %QTDIR%\bin\QtDesigner%qtBtype%.dll %creaThirdPartyLibraries%\%qt%\bin\
+copy /V /Y %QTDIR%\bin\QtDesignerComponents%qtBtype%.dll %creaThirdPartyLibraries%\%qt%\bin\
 
 XCOPY %QTDIR%\lib\*.lib %creaThirdPartyLibraries%\%qt%\lib\ /i
 
@@ -140,8 +161,6 @@ echo -----------------------------------
 echo -------------wxWidgets-------------
 echo -----------------------------------
 
-set wxPrefixBase=wxbase28
-set wxPrefixmsw=wxmsw28
 
 mkdir %creaThirdPartyLibraries%\%wxWidgets%
 
@@ -196,11 +215,6 @@ echo -----------------------------------
 echo -------------Boost-----------------
 echo -----------------------------------
 
-set boostMT=-vc100-mt-1_46_1.lib
-set boostMTGD=-vc100-mt-gd-1_46_1.lib
-set boostMTS=-vc100-mt-s-1_46_1.lib
-set boostMTSGD=-vc100-mt-sgd-1_46_1.lib
-
 mkdir %creaThirdPartyLibraries%\%boost%
 
 mkdir %creaThirdPartyLibraries%\%boost%\include
@@ -358,7 +372,8 @@ echo -------------MiKText---------------
 echo -----------------------------------
 mkdir %creaThirdPartyLibraries%\%miktexAux%
 
-XCOPY %miktex%\* %creaThirdPartyLibraries%\%miktexAux% /s /i
+XCOPY %MIKTEXPFDIR%\* %MIKTEXDIR% /s /i
+
 
 echo -----------------------------------
 echo -----End of Moving Libraries-------
-- 
2.49.0