]> Creatis software - creaToolsTools.git/blobdiff - Install_ThirdParty/scripts/install_thirdparty_all.bat
DFCH: Update for x84 and x64 bit compilation
[creaToolsTools.git] / Install_ThirdParty / scripts / install_thirdparty_all.bat
index 0086fbe2cea9a2490aa9ceb626762797ff9551df..eb77577a7c2662ad8445509ecdfdb8e6fe49f529 100644 (file)
 @echo off
 echo -----------------------------------
-echo ------Asking Architecture----------
+echo ------Installing Libraries---------
 echo -----------------------------------
-if %PROCESSOR_ARCHITECTURE%==x86 (
-@echo on
-  set ProgramFilesPath=%ProgramFiles%
-@echo off
-) else (
-@echo on
-  set "ProgramFilesPath=%ProgramFiles(x86)%"
-@echo off
-)
-
-echo ----End Asking Architecture--------
 
 echo -----------------------------------
-echo ---Setting Enviroment Variables----
+echo ---Setting Environment Variables---
 echo -----------------------------------
 
-@echo on
 set thirdpartyGeneration=%1
 set buildType=%2
+::The following line is to force x86 or x64 compilation
+set x86Comp=%3
 
-set wgetPath=%cd%\..\..\windows\creaTools_win_installers\CreaTools_v2_0_0_win32_installer\bin\wget.exe
-set zipPath="%ProgramFilesPath%\7-Zip\7z.exe"
-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 vcvarsall="%ProgramFilesPath%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
+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
+if %PROCESSOR_ARCHITECTURE%==x86  (
+  set ProgramFilesPath_x86=%ProgramFiles%
+  echo "Architecture found = x86"
+) else (
+  set "ProgramFilesPath_x64=%ProgramFiles%"
+  set "ProgramFilesPath_x86=%ProgramFiles(x86)%"
+  echo "Architecture found = x64"
+)
 
-set xercesc=xerces-c-3.1.1
-set itk=InsightToolkit-3.20.0
-set gdcm=gdcm
-set vtk=VTK
+set vcvarsall="%ProgramFilesPath_x86%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
+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
+)
 
-@echo off
-echo ---End Setting Global Variables----
-echo -----------------------------------
-@echo on
-call %vcvarsall%
+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 QTDIR=%sourcepath%\%qt%
+set JOMDIR=%sourcepath%\%jom%
+set WXDIR=%sourcepath%\%wxWidgets%
+set BOOSTDIR=%sourcepath%\%boost%
+set XERCESDIR=%sourcepath%\%xercesc%
+set ITKSRCDIR=%sourcepath%\%itk%
+set VTKSRCDIR=%sourcepath%\%VTK%
+set GDCMSRCDIR=%sourcepath%\%gdcm%
+
+echo -----------------------------------
+echo Environment variables Configuration
+echo -----------------------------------
+echo ThirdpartyGeneration=%thirdpartyGeneration%
+echo BuildType=%buildType%
+echo Visual Studio=%vcvarsall%
+echo InstallPath=%installpath%
+echo BinPath=%binpath%
+echo SourcePath=%sourcepath%
+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 GDCMDIR=%GDCMSRCDIR%
+echo JOMDIR=%JOMDIR%
 
-@echo off
 echo -----------------------------------
-echo -------Creating Folders------------
+echo ---End Setting Global Variables----
 echo -----------------------------------
-@echo on
-rmdir %binpath% /s /q
 
-rmdir %thirdpartyGeneration% /s /q
-mkdir %thirdpartyGeneration%
-cd  %thirdpartyGeneration%
-mkdir thirdparty_source
-mkdir thirdparty_bin
-mkdir thirdparty_install
 
-@echo off
-echo ------End Creating Folders---------
-
-echo -----------------------------------
-echo ------Downloading Sources----------
-echo -----------------------------------
-@echo on
-cd %thirdpartyGeneration%\thirdparty_source\
-%wgetPath% %urlCreatisSource%/qt-4.7.3.zip
-%wgetPath% %urlCreatisSource%/wxWidgets-2.9.2.7z
-%wgetPath% %urlCreatisSource%/boost_1_47_0.7z
-%wgetPath% %urlCreatisSource%/vtk-5.8.0.tar.gz
-%wgetPath% %urlCreatisSource%/InsightToolkit-3.20.0.zip
-%wgetPath% %urlCreatisSource%/gdcm.tar.gz
-%wgetPath% %urlCreatisSource%/xerces-c-3.1.1.zip
+if %x86Comp%==ON (
+       call %vcvarsall%
+       echo "Compilation forced x86"
+) else (
+       if %PROCESSOR_ARCHITECTURE%==x86 (
+               call %vcvarsall%
+       ) else (
+               call %vcvarsall% amd64
+       )
+)
 
-@echo off
-echo ------End Downloading Sources------
+goto next
 
 echo -----------------------------------
 echo --------Qt Installation------------
 echo -----------------------------------
-echo ---Setting Enviroment Variables----
-@echo on
-set QTDIR=%thirdpartyGeneration%\thirdparty_source\Qt\4.7.3\
-@echo off
-echo ----------Extracting---------------
-@echo on
-cd %thirdpartyGeneration%\thirdparty_source\
-mkdir Qt\
-cd Qt\
-%zipPath% x %thirdpartyGeneration%\thirdparty_source\qt-4.7.3.zip
-del %thirdpartyGeneration%\thirdparty_source\qt-4.7.3.zip
-@echo off
-echo --------Renaming Folder------------
-@echo on
-rename qt-everywhere-opensource-src-4.7.3 4.7.3
-@echo off
-echo ----------Installing---------------
-@echo on
-cd 4.7.3
+cd %QTDIR%
+set QMAKESPEC=win32-msvc2010
+
 echo y | configure -%buildType% -opensource -shared -qt-sql-sqlite -phonon -phonon-backend -platform win32-msvc2010 -mp
-nmake
+
+%JOMDIR%\jom.exe -j %NUMBER_OF_PROCESSORS%
+%JOMDIR%\jom.exe clean
+
 cd C:\
-@echo off
-echo ------End QT Installation----------
 
 echo -----------------------------------
 echo -----wxWidgets Installation--------
 echo -----------------------------------
-echo -------Setting Variables-----------
-@echo on
-set WXDIR=%thirdpartyGeneration%\thirdparty_source\wxWidgets\2.9.2\
-@echo off
-echo ----------Extracting---------------
-@echo on
-cd %thirdpartyGeneration%\thirdparty_source
-md wxWidgets\2.9.2
-cd wxWidgets\2.9.2
-%zipPath% x %thirdpartyGeneration%\thirdparty_source\wxWidgets-2.9.2.7z
-del %thirdpartyGeneration%\thirdparty_source\wxWidgets-2.9.2.7z
-@echo off
-echo ----------Installing---------------
-@echo on
-cd %thirdpartyGeneration%\thirdparty_source\wxWidgets\2.9.2\build\msw
-nmake -f makefile.vc BUILD=%buildType% UNICODE=1 SHARED=1
+cd %WXDIR%\build\msw
+if %x86Comp%==ON (
+       nmake -f makefile.vc BUILD=%buildType% UNICODE=0 SHARED=1
+) else (
+       if %PROCESSOR_ARCHITECTURE%==x86 (
+               nmake -f makefile.vc BUILD=%buildType% UNICODE=0 SHARED=1
+       ) else (
+               nmake -f makefile.vc TARGET_CPU=AMD64 BUILD=release UNICODE=0 SHARED=1
+       )
+)
 cd C:\
-@echo off
-echo ----End wxWidgets Installation-----
 
 echo -----------------------------------
 echo ------Boost Installation-----------
 echo -----------------------------------
-echo -------Setting Variables-----------
-@echo on
-set BOOSTDIR=%thirdpartyGeneration%\thirdparty_source\Boost\1.47.0\
-@echo off
-echo ----------Extracting---------------
-@echo on
-cd %thirdpartyGeneration%\thirdparty_source\
-md Boost\
-cd Boost\
-%zipPath% x %thirdpartyGeneration%\thirdparty_source\boost_1_47_0.7z
-del %thirdpartyGeneration%\thirdparty_source\boost_1_47_0.7z
-@echo off
-echo --------Renaming Folder------------
-@echo on
-rename boost_1_47_0 1.47.0
-@echo off
-echo ----------Installing---------------
-@echo on
-cd %thirdpartyGeneration%\thirdparty_source\Boost\1.47.0\
+
+mkdir %binpath%\%boost%Bin 
+mkdir %installpath%\%boost%
+
+cd %sourcepath%\%boost%
+
 call bootstrap.bat
-@echo off
-if %PROCESSOR_ARCHITECTURE%==x86 (
-@echo on
-  b2.exe --toolset=msvc-10.0 --build-type=complete stage
-@echo off
+
+if %x86Comp%==ON (
+       bjam.exe -j %NUMBER_OF_PROCESSORS% --toolset=msvc-10.0 --build-type=complete --build-dir=%binpath%\%boost%Bin --link=shared --runtime-link=shared --prefix=%installpath%\%boost% install
 ) else (
-@echo on
-cd stage
-  b2.exe --toolset=msvc-10.0 --build-type=complete architecture=x86 address-model=64 stage
-@echo off
+       if %PROCESSOR_ARCHITECTURE%==x86 (
+               bjam.exe -j %NUMBER_OF_PROCESSORS% --toolset=msvc-10.0 --build-type=complete --build-dir=%binpath%\%boost%Bin --link=shared --runtime-link=shared --prefix=%installpath%\%boost% install
+       ) else (
+               bjam.exe -j %NUMBER_OF_PROCESSORS% --toolset=msvc-10.0 address-model=64 --build-type=complete --build-dir=%binpath%\%boost%Bin --link=shared --runtime-link=    shared --prefix=%installpath%\%boost% install
+       )
 )
-@echo on
 cd C:\
-@echo off
-echo -----End Boost Installation--------
 
+:next
 echo -----------------------------------
 echo -------VTK Installation------------
 echo -----------------------------------
-echo ----------Extracting---------------
-@echo on
-cd %thirdpartyGeneration%\thirdparty_source\
-%zipPath% x %thirdpartyGeneration%\thirdparty_source\vtk-5.8.0.tar.gz
-%zipPath% x %thirdpartyGeneration%\thirdparty_source\vtk-5.8.0.tar.gz
-cd %thirdpartyGeneration%\thirdparty_source\VTK
-del %thirdpartyGeneration%\thirdparty_source\VTK-5.8.0.tar.gz
-del %thirdpartyGeneration%\thirdparty_source\VTK-5.8.0.tar.gz
-@echo off
-echo ----------Installing---------------
-@echo on
+
 cd  %binpath%
 mkdir %vtk%Bin
 cd %vtk%Bin
-cmake -G"Visual Studio 10"  -H%sourcepath%\%vtk% -B%binpath%\%vtk%Bin 
+
+if %x86Comp%==ON (
+       cmake -G"Visual Studio 10"  -H%sourcepath%\%vtk% -B%binpath%\%vtk%Bin
+) else (
+       if %PROCESSOR_ARCHITECTURE%==x86 (
+               cmake -G"Visual Studio 10"  -H%sourcepath%\%vtk% -B%binpath%\%vtk%Bin
+       ) else (
+               cmake -G"Visual Studio 10 Win64"  -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:%NUMBER_OF_PROCESSORS% /target:ALL_BUILD /p:Platform=AnyCPU ;UseEnv=true;BuildInParallel=true;Configuration=%buildType%
+msbuild /m:%NUMBER_OF_PROCESSORS% /p:Platform=AnyCPU ;UseEnv=true;BuildInParallel=true;Configuration=%buildType% INSTALL.vcxproj
+
 cd c:\
-@echo off
-echo ------End VTK Installation---------
 
 echo -----------------------------------
 echo -------GDCM Installation-----------
 echo -----------------------------------
-echo -------Setting Variables-----------
-echo ----------Extracting---------------
-@echo on
-cd %thirdpartyGeneration%\thirdparty_source
-%zipPath% x gdcm.tar.gz
-%zipPath% x gdcm.tar
-del gdcm.tar.gz
-del gdcm.tar
-@echo off
-echo ----------Installing---------------
-@echo on
+
 cd  %binpath%
 mkdir %gdcm%Bin
+
 cd %gdcm%Bin
-cmake -G"Visual Studio 10"  -H%sourcepath%\%gdcm% -B%binpath%\%gdcm%Bin
+
+if %x86Comp%==ON (
+       cmake -G"Visual Studio 10"  -H%sourcepath%\%gdcm% -B%binpath%\%gdcm%Bin
+) else (
+       if %PROCESSOR_ARCHITECTURE%==x86 (
+               cmake -G"Visual Studio 10"  -H%sourcepath%\%gdcm% -B%binpath%\%gdcm%Bin
+       ) else (
+               cmake -G"Visual Studio 10 Win64"  -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=%binpath%\%vtk%Bin -D GDCM_VTK:BOOL=ON -D BUILD_TESTING:BOOL=OFF -D GDCM_NAME_SPACE:STRING=gdcm13 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:%NUMBER_OF_PROCESSORS% /p:UseEnv=true;BuildInParallel=true;Platform=AnyCPU;Configuration=%buildType%
+msbuild INSTALL.vcxproj /m:%NUMBER_OF_PROCESSORS% /p:UseEnv=true;BuildInParallel=true;Platform=AnyCPU;Configuration=%buildType%
+
 cd c:\
-@echo off
-echo -----End GDCM Installation---------
 
 echo -----------------------------------
 echo -------ITK Installation------------
 echo -----------------------------------
-echo ----------Extracting---------------
-@echo on
-cd %thirdpartyGeneration%\thirdparty_source
-%zipPath% x InsightToolkit-3.20.0.zip
-del InsightToolkit-3.20.0.zip
-@echo off
-echo ----------Installing---------------
-@echo on
+
 cd  %binpath%
 mkdir %itk%Bin
 cd %itk%Bin
-cmake -G"Visual Studio 10" -H%sourcepath%\%itk% -B%binpath%\%itk%Bin 
-cmake -D CMAKE_INSTALL_PREFIX:PATH=%installpath%\%itk%\ -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 -D USE_DEBUG_LIB:BOOL=%buildType% CMakeCache.txt
+
+if %x86Comp%==ON (
+       cmake -G"Visual Studio 10" -H%sourcepath%\%itk% -B%binpath%\%itk%Bin
+) else (
+       if %PROCESSOR_ARCHITECTURE%==x86 (
+               cmake -G"Visual Studio 10" -H%sourcepath%\%itk% -B%binpath%\%itk%Bin
+       ) else (
+               cmake -G"Visual Studio 10 Win64" -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:%NUMBER_OF_PROCESSORS% /p:UseEnv=true;BuildInParallel=true;Platform=AnyCPU;Configuration=%buildType%
+msbuild INSTALL.vcxproj /m:%NUMBER_OF_PROCESSORS% /p:UseEnv=true;BuildInParallel=true;Platform=AnyCPU;Configuration=%buildType%
+
 cd c:\
-@echo off
-echo ------End ITK Installation---------
 
 echo -----------------------------------
 echo ------XERCES Installation----------
 echo -----------------------------------
-echo ----------Extracting---------------
-@echo on
-cd %thirdpartyGeneration%\thirdparty_source
-%zipPath% x xerces-c-3.1.1.zip
-del xerces-c-3.1.1.zip
-@echo off
-echo ----------Installing---------------
-@echo on
 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 off
-echo -----End XERCES Installation-------
-@echo on
-cd c:\
-pause
+FOR /R %%a IN (*.sln) DO msbuild %%a /m:%NUMBER_OF_PROCESSORS% /p:UseEnv=true;BuildInParallel=true;Platform=AnyCPU;Configuration=%buildType%
+FOR /R %%a IN (*.sln) DO msbuild %%a /m:%NUMBER_OF_PROCESSORS% /p:UseEnv=true;BuildInParallel=true;Platform=AnyCPU;Configuration=%buildType%
+msbuild INSTALL.vcxproj /m:%NUMBER_OF_PROCESSORS% /p:UseEnv=true;BuildInParallel=true;Platform=AnyCPU;Configuration=%buildType%
+
+echo -----------------------------------
+echo ---End of Installing Libraries-----
+echo -----------------------------------
+
+exit /B
\ No newline at end of file