]> Creatis software - creaToolsTools.git/blobdiff - Install_ThirdParty/scripts/install_thirdparty_libraries_cmake.bat
Bug #1908
[creaToolsTools.git] / Install_ThirdParty / scripts / install_thirdparty_libraries_cmake.bat
index 87ff82826f0afb7294fe87128491efab48023e2d..63436005600c5a686f4feb8823fe587447d1875f 100644 (file)
@@ -1,5 +1,9 @@
 @echo off
 echo -----------------------------------
+echo -----Generating Installers of------
+echo -----creaThirdPartyLibraries-------
+echo -----------------------------------
+echo -----------------------------------
 echo ------Asking Architecture----------
 echo -----------------------------------
 if %PROCESSOR_ARCHITECTURE%==x86 (
@@ -13,6 +17,9 @@ if %PROCESSOR_ARCHITECTURE%==x86 (
 echo ----End Asking Architecture--------
 
 set thirdpartyGeneration=%1
+set buildType=%2
+::The following line is to force x86 or x64 compilation
+set x86Comp=%3
 
 set thirdparty_cmake=%cd%\..\cmake
 
@@ -20,8 +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 installpath="ProgramFilesPath_x86\creatools\crea_ThirdParty_Libraries"
+set binpath=%thirdpartyGeneration%\thirdparty_bin\%buildType%\creaTPLBin
 
 if not exist %vcvarsall% set zipPath="%ProgramFilesPath_x64%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
 if not exist %vcvarsall% (
@@ -29,15 +35,37 @@ if not exist %vcvarsall% (
   exit
 )
 
-call %vcvarsall%
+if %x86Comp%==ON (
+       call %vcvarsall%
+       echo "Compilation forced x86"
+) else (
+       if %PROCESSOR_ARCHITECTURE%==x86 (
+               set installpath="%ProgramFilesPath_x86%\creatools\crea_ThirdParty_Libraries"
+               call %vcvarsall%
+       ) else (
+               set installpath="%ProgramFiles%\creatools\crea_ThirdParty_Libraries"
+               call %vcvarsall% amd64
+       )
+)
 
+rmdir /S /Q %binpath%
 mkdir %binpath%
 cd %binpath%
 
-cmake -G"Visual Studio 10"  -H%sourcepath% -B%binpath%
+if %x86Comp%==ON (
+       cmake -G"Visual Studio 10"  -H%sourcepath% -B%binpath%
+) else (
+       if %PROCESSOR_ARCHITECTURE%==x86 (
+               cmake -G"Visual Studio 10"  -H%sourcepath% -B%binpath%
+       ) else (
+               cmake -G"Visual Studio 10 Win64"  -H%sourcepath% -B%binpath%
+       )
+)
+
 cmake -D CMAKE_INSTALL_PREFIX:PATH=%installpath% CMakeCache.txt
 cmake -D CREA_LIBRARY_SOURCE_PATH:PATH=%thirdpartylibpath% CMakeCache.txt
 cmake CMakeCache.txt
-FOR /R %%a IN (*.sln) DO msbuild %%a /p:Configuration=%buildType%
-msbuild /p:Configuration=release PACKAGE.vcxproj
-@echo on
\ No newline at end of file
+FOR /R %%a IN (*.sln) DO msbuild %%a /m:%NUMBER_OF_PROCESSORS% /p:UseEnv=true;BuildInParallel=true;Configuration=%buildType%
+msbuild /m:%NUMBER_OF_PROCESSORS% /p:UseEnv=true;BuildInParallel=true;Configuration=%buildType% PACKAGE.vcxproj
+
+exit /B
\ No newline at end of file