Salome HOME
ROOT : cleanup + add ROOT master product batch file
[tools/sat_salome.git] / products / compil_scripts / qt.bat
1 @echo off
2
3 echo ##########################################################################
4 echo Qt %VERSION%
5 echo ##########################################################################
6
7 IF NOT DEFINED SAT_DEBUG (
8   SET SAT_DEBUG=0
9 )
10
11 SET PRODUCT_BUILD_TYPE=-release
12 if %SAT_DEBUG% == 1 (
13   set PRODUCT_BUILD_TYPE=-debug-and-release
14 )
15
16 if NOT exist "%PRODUCT_INSTALL%" mkdir %PRODUCT_INSTALL%
17 REM clean BUILD directory
18 if exist "%BUILD_DIR%" rmdir /Q /S %BUILD_DIR%
19 mkdir %BUILD_DIR%
20
21 cd %SOURCE_DIR%
22
23 REM Configure
24 echo.
25 echo --------------------------------------------------------------------------
26 echo *** configure  
27 echo --------------------------------------------------------------------------
28
29 set QT_OPTIONS=-platform win32-msvc2017
30 set QT_OPTIONS=%QT_OPTIONS% -opensource -confirm-license %PRODUCT_BUILD_TYPE%
31 set QT_OPTIONS=%QT_OPTIONS% -no-angle -opengl desktop -nomake examples -nomake tests 
32 set QT_OPTIONS=%QT_OPTIONS%  -skip qtwebengine  -skip wayland -skip qtgamepad -no-openssl
33 set QT_OPTIONS=%QT_OPTIONS% -prefix %PRODUCT_INSTALL%
34 echo **** call configure  %QT_OPTIONS%
35 call configure  %QT_OPTIONS%
36 if NOT %ERRORLEVEL% == 0 (
37     echo "ERROR on configure"
38     exit 1
39 )
40
41 REM Compilation with nmake as said in qt documentation
42 REM nmake can crash because of multi-threading problems
43 REM Thus, we will try to run it 42 times until it works
44 set /a remaining_tries = 42
45 :nmake
46 echo *** Trying to run nmake %remaining_tries% more time.
47 set /a remaining_tries = remaining_tries - 1
48 nmake
49 if NOT %ERRORLEVEL% == 0 if %remaining_tries% gtr 0 (
50     goto nmake
51 )
52 if %remaining_tries% == 0 (
53     echo "ERROR on nmake"
54     exit 2
55 )
56
57 REM Installation
58 echo.
59 echo --------------------------------------------------------------------------
60 echo *** nmake install
61 echo --------------------------------------------------------------------------
62
63 nmake install
64 if NOT %ERRORLEVEL% == 0 (
65     echo "ERROR on nmake install"
66     exit 3
67 )
68
69 echo "*** Adding qt.conf file in order to be able to compile using the moved Qt installation"
70 echo [Paths] >  %PRODUCT_INSTALL%\bin\qt.conf
71 echo Prefix=../ >> %PRODUCT_INSTALL%\bin\qt.conf
72
73 echo.
74 echo ########## END
75