]> Creatis software - creaToolsTools.git/blob - Install_ThirdParty/scripts/install_thirdparty_libraries_cmake.bat
48da8b58bd616fe1c51f6ebe615dea54eeb75529
[creaToolsTools.git] / Install_ThirdParty / scripts / install_thirdparty_libraries_cmake.bat
1 @echo off
2 echo -----------------------------------
3 echo -----Generating Installers of------
4 echo -----creaThirdPartyLibraries-------
5 echo -----------------------------------
6 echo -----------------------------------
7 echo ------Asking Architecture----------
8 echo -----------------------------------
9 if %PROCESSOR_ARCHITECTURE%==x86 (
10   set ProgramFilesPath_x86=%ProgramFiles%
11   echo "Architecture found = x86"
12 ) else (
13   set "ProgramFilesPath_x86=%ProgramFiles(x86)%"
14   echo "Architecture found = x64"
15 )
16
17 echo ----End Asking Architecture--------
18
19 set thirdpartyGeneration=%1
20 set buildType=%2
21 ::The following line is to force x86 or x64 compilation
22 set x86Comp=%3
23
24 set version="3.0.1-win32"
25
26 set thirdparty_cmake=%cd%\..\cmake
27
28 set vcvarsall="%ProgramFilesPath_x86%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
29
30 set thirdpartylibpath=%thirdpartyGeneration%\thirdparty_temp\creaThirdParty_libraries
31 set sourcepath=%thirdparty_cmake%\crea_ThirdParty_Libraries
32 set binpath=%thirdpartyGeneration%\thirdparty_bin\%buildType%\creaTPLBin
33 set installpath="ProgramFilesPath_x86\creatools\crea_ThirdParty_Libraries"
34
35 if not exist %vcvarsall% set zipPath="%ProgramFilesPath_x64%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
36 if not exist %vcvarsall% (
37   echo ERROR!!! Visual Studio has not been found in the system
38   exit
39 )
40
41 if %x86Comp%==ON (
42         call %vcvarsall%
43         echo "Compilation forced x86"
44 ) else (
45         if %PROCESSOR_ARCHITECTURE%==x86 (
46                 call %vcvarsall%
47         ) else (
48                 call %vcvarsall% amd64
49         )
50 )
51
52 mkdir %binpath%
53 cd %binpath%
54
55 if %x86Comp%==ON (
56         cmake -G"Visual Studio 10"  -H%sourcepath% -B%binpath%
57 ) else (
58         if %PROCESSOR_ARCHITECTURE%==x86 (
59                 cmake -G"Visual Studio 10"  -H%sourcepath% -B%binpath%
60         ) else (
61                 cmake -G"Visual Studio 10 Win64"  -H%sourcepath% -B%binpath%
62         )
63 )
64
65 cmake -D CMAKE_INSTALL_PREFIX:PATH=%installpath% CMakeCache.txt
66 cmake -D CREA_LIBRARY_SOURCE_PATH:PATH=%thirdpartylibpath% CMakeCache.txt
67 cmake CMakeCache.txt
68 FOR /R %%a IN (*.sln) DO msbuild %%a /m:%NUMBER_OF_PROCESSORS% /p:UseEnv=true;BuildInParallel=true;Configuration=%buildType%
69 msbuild /m:%NUMBER_OF_PROCESSORS% /p:UseEnv=true;BuildInParallel=true;Configuration=%buildType% PACKAGE.vcxproj
70
71 set installerPath="%thirdpartydllspath%\thirdparty_bin\creaTPLBin\crea_ThirdParty_Libraries-%version%.exe"
72
73 if exist installerPath (
74 mkdir %thirdpartyGeneration%\thirdparty_installers
75 move /Y %installerPath% %thirdpartyGeneration%\thirdparty_installers
76 )
77
78 exit /B