2012-02-08 10:38:07 +00:00
|
|
|
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
|
|
::
|
2016-01-15 12:36:27 +00:00
|
|
|
:: Copyright (C) 2016 The Qt Company Ltd.
|
2016-01-21 02:33:50 +00:00
|
|
|
:: Copyright (C) 2016 Intel Corporation.
|
2016-01-15 12:36:27 +00:00
|
|
|
:: Contact: https://www.qt.io/licensing/
|
2012-02-08 10:38:07 +00:00
|
|
|
::
|
|
|
|
:: This file is part of the tools applications of the Qt Toolkit.
|
|
|
|
::
|
2016-01-15 12:36:27 +00:00
|
|
|
:: $QT_BEGIN_LICENSE:GPL-EXCEPT$
|
2012-09-19 12:28:29 +00:00
|
|
|
:: Commercial License Usage
|
|
|
|
:: Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
:: accordance with the commercial license agreement provided with the
|
|
|
|
:: Software or, alternatively, in accordance with the terms contained in
|
2015-01-28 08:44:43 +00:00
|
|
|
:: a written agreement between you and The Qt Company. For licensing terms
|
2016-01-15 12:36:27 +00:00
|
|
|
:: and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
:: information use the contact form at https://www.qt.io/contact-us.
|
2012-09-19 12:28:29 +00:00
|
|
|
::
|
2016-01-15 12:36:27 +00:00
|
|
|
:: GNU General Public License Usage
|
|
|
|
:: Alternatively, this file may be used under the terms of the GNU
|
|
|
|
:: General Public License version 3 as published by the Free Software
|
|
|
|
:: Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
:: included in the packaging of this file. Please review the following
|
|
|
|
:: information to ensure the GNU General Public License requirements will
|
|
|
|
:: be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2012-02-08 10:38:07 +00:00
|
|
|
::
|
|
|
|
:: $QT_END_LICENSE$
|
|
|
|
::
|
|
|
|
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
|
|
|
|
|
|
@echo off
|
2016-11-18 15:24:31 +00:00
|
|
|
setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
|
2016-08-01 10:40:03 +00:00
|
|
|
set ARGS=%*
|
2012-02-08 10:38:07 +00:00
|
|
|
set QTSRC=%~dp0
|
2016-11-18 15:24:31 +00:00
|
|
|
set QTSRC=%QTSRC:~0,-1%
|
2012-02-08 10:38:07 +00:00
|
|
|
set QTDIR=%CD%
|
2015-09-18 01:17:40 +00:00
|
|
|
|
2016-11-18 15:24:31 +00:00
|
|
|
rem Parse command line
|
|
|
|
|
|
|
|
set TOPLEVEL=false
|
|
|
|
set TOPQTSRC=%QTSRC%
|
|
|
|
set TOPQTDIR=%QTDIR%
|
|
|
|
if /i not "%~1" == "-top-level" goto notoplevel
|
|
|
|
set ARGS=%ARGS:~10%
|
|
|
|
set TOPLEVEL=true
|
|
|
|
for %%P in ("%TOPQTSRC%") do set TOPQTSRC=%%~dpP
|
|
|
|
set TOPQTSRC=%TOPQTSRC:~0,-1%
|
|
|
|
for %%P in ("%QTDIR%") do set TOPQTDIR=%%~dpP
|
|
|
|
set TOPQTDIR=%TOPQTDIR:~0,-1%
|
2017-01-03 19:23:19 +00:00
|
|
|
goto wastoplevel
|
2016-11-18 15:24:31 +00:00
|
|
|
:notoplevel
|
2017-01-03 19:23:19 +00:00
|
|
|
if not exist ..\.qmake.super goto wastoplevel
|
|
|
|
echo ERROR: You cannot configure qtbase separately within a top-level build. >&2
|
|
|
|
exit /b 1
|
|
|
|
:wastoplevel
|
2016-11-18 15:24:31 +00:00
|
|
|
|
|
|
|
set SYNCQT=
|
|
|
|
set PLATFORM=
|
|
|
|
set MAKE=
|
|
|
|
call :doargs %ARGS%
|
|
|
|
if errorlevel 1 exit /b
|
|
|
|
goto doneargs
|
|
|
|
|
2016-08-01 10:40:03 +00:00
|
|
|
:doargs
|
2016-11-18 15:24:31 +00:00
|
|
|
if "%~1" == "" exit /b
|
2016-08-01 10:40:03 +00:00
|
|
|
|
|
|
|
if "%~1" == "/?" goto help
|
|
|
|
if "%~1" == "-?" goto help
|
|
|
|
if /i "%~1" == "/h" goto help
|
|
|
|
if /i "%~1" == "-h" goto help
|
|
|
|
if /i "%~1" == "/help" goto help
|
|
|
|
if /i "%~1" == "-help" goto help
|
|
|
|
if /i "%~1" == "--help" goto help
|
|
|
|
|
2016-11-18 15:24:31 +00:00
|
|
|
if /i "%~1" == "-redo" goto redo
|
|
|
|
if /i "%~1" == "--redo" goto redo
|
|
|
|
|
|
|
|
if /i "%~1" == "-platform" goto platform
|
|
|
|
if /i "%~1" == "--platform" goto platform
|
|
|
|
|
|
|
|
if /i "%~1" == "-no-syncqt" goto nosyncqt
|
|
|
|
if /i "%~1" == "--no-syncqt" goto nosyncqt
|
|
|
|
|
|
|
|
if /i "%~1" == "-make-tool" goto maketool
|
|
|
|
if /i "%~1" == "--make-tool" goto maketool
|
|
|
|
|
|
|
|
:nextarg
|
2016-08-01 10:40:03 +00:00
|
|
|
shift
|
|
|
|
goto doargs
|
|
|
|
|
2016-11-18 15:24:31 +00:00
|
|
|
:help
|
|
|
|
type %QTSRC%\config_help.txt
|
2017-01-09 19:11:25 +00:00
|
|
|
if %TOPLEVEL% == false exit /b 1
|
|
|
|
for /d %%p in ("%TOPQTSRC%"\qt*) do (
|
|
|
|
if not "%%p" == "%QTSRC%" (
|
|
|
|
if exist "%%p\config_help.txt" (
|
|
|
|
echo.
|
|
|
|
type "%%p\config_help.txt"
|
2016-12-23 19:34:38 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2016-11-18 15:24:31 +00:00
|
|
|
exit /b 1
|
|
|
|
|
|
|
|
:redo
|
|
|
|
if not exist "%TOPQTDIR%\config.opt" goto redoerr
|
|
|
|
set rargs=
|
|
|
|
for /f "usebackq delims=" %%i in ("%TOPQTDIR%\config.opt") do set rargs=!rargs! "%%i"
|
|
|
|
call :doargs %rargs%
|
|
|
|
goto nextarg
|
|
|
|
:redoerr
|
|
|
|
echo No config.opt present - cannot redo configuration. >&2
|
|
|
|
exit /b 1
|
2012-02-08 10:38:07 +00:00
|
|
|
|
2016-11-18 15:24:31 +00:00
|
|
|
:platform
|
|
|
|
shift
|
|
|
|
if "%~1" == "win32-msvc2012" goto msvc
|
|
|
|
if "%~1" == "win32-msvc2013" goto msvc
|
|
|
|
if "%~1" == "win32-msvc2015" goto msvc
|
|
|
|
if "%~1" == "win32-msvc2017" goto msvc
|
|
|
|
set PLATFORM=%~1
|
|
|
|
goto nextarg
|
|
|
|
:msvc
|
|
|
|
echo. >&2
|
|
|
|
echo Notice: re-mapping requested qmake spec to unified 'win32-msvc'. >&2
|
|
|
|
echo. >&2
|
|
|
|
set PLATFORM=win32-msvc
|
|
|
|
goto nextarg
|
|
|
|
|
|
|
|
:nosyncqt
|
|
|
|
set SYNCQT=false
|
|
|
|
goto nextarg
|
|
|
|
|
|
|
|
:maketool
|
|
|
|
shift
|
|
|
|
set MAKE=%~1
|
|
|
|
goto nextarg
|
|
|
|
|
|
|
|
:doneargs
|
|
|
|
|
|
|
|
rem Find various executables
|
2016-02-10 12:05:26 +00:00
|
|
|
for %%C in (clang-cl.exe cl.exe icl.exe g++.exe perl.exe jom.exe) do set %%C=%%~$PATH:C
|
2012-02-08 10:38:07 +00:00
|
|
|
|
2016-11-18 15:24:31 +00:00
|
|
|
rem Determine host spec
|
|
|
|
|
|
|
|
if "%PLATFORM%" == "" (
|
|
|
|
if not "%icl.exe%" == "" (
|
|
|
|
set PLATFORM=win32-icc
|
|
|
|
) else if not "%clang-cl.exe%" == "" (
|
|
|
|
set PLATFORM=win32-clang-msvc
|
|
|
|
) else if not "%cl.exe%" == "" (
|
|
|
|
set PLATFORM=win32-msvc
|
|
|
|
) else if not "%g++.exe%" == "" (
|
|
|
|
set PLATFORM=win32-g++
|
|
|
|
) else (
|
|
|
|
echo Cannot detect host toolchain. Please use -platform. Aborting. >&2
|
|
|
|
exit /b 1
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if not exist "%QTSRC%\mkspecs\%PLATFORM%\qmake.conf" (
|
|
|
|
echo Host platform '%PLATFORM%' is invalid. Aborting. >&2
|
2012-09-18 15:26:52 +00:00
|
|
|
exit /b 1
|
|
|
|
)
|
2016-11-18 15:24:31 +00:00
|
|
|
if "%PLATFORM:win32-g++=%" == "%PLATFORM%" (
|
|
|
|
if "%MAKE%" == "" (
|
|
|
|
if not "%jom.exe%" == "" (
|
|
|
|
set MAKE=jom
|
|
|
|
) else (
|
|
|
|
set MAKE=nmake
|
|
|
|
)
|
|
|
|
)
|
|
|
|
set tmpl=win32
|
|
|
|
) else (
|
|
|
|
if "%MAKE%" == "" (
|
|
|
|
set MAKE=mingw32-make
|
|
|
|
)
|
|
|
|
set tmpl=unix
|
|
|
|
)
|
|
|
|
|
|
|
|
rem Prepare build dir
|
|
|
|
|
2012-09-18 15:26:52 +00:00
|
|
|
if not exist mkspecs (
|
|
|
|
md mkspecs
|
2016-11-18 15:24:31 +00:00
|
|
|
if errorlevel 1 exit /b
|
|
|
|
)
|
|
|
|
if not exist bin (
|
|
|
|
md bin
|
|
|
|
if errorlevel 1 exit /b
|
|
|
|
)
|
|
|
|
if not exist qmake (
|
|
|
|
md qmake
|
|
|
|
if errorlevel 1 exit /b
|
2012-02-08 10:38:07 +00:00
|
|
|
)
|
2015-09-18 01:17:40 +00:00
|
|
|
|
|
|
|
rem Extract Qt's version from .qmake.conf
|
2016-11-18 15:24:31 +00:00
|
|
|
for /f "eol=# tokens=1,2,3,4 delims=.= " %%i in (%QTSRC%\.qmake.conf) do (
|
2015-09-18 01:17:40 +00:00
|
|
|
if %%i == MODULE_VERSION (
|
|
|
|
set QTVERMAJ=%%j
|
|
|
|
set QTVERMIN=%%k
|
|
|
|
set QTVERPAT=%%l
|
|
|
|
)
|
|
|
|
)
|
|
|
|
set QTVERSION=%QTVERMAJ%.%QTVERMIN%.%QTVERPAT%
|
|
|
|
|
2016-11-18 15:24:31 +00:00
|
|
|
rem Create forwarding headers
|
2012-02-08 10:38:07 +00:00
|
|
|
|
2016-11-18 15:24:31 +00:00
|
|
|
if "%SYNCQT%" == "" (
|
|
|
|
if exist "%QTSRC%\.git" (
|
|
|
|
set SYNCQT=true
|
|
|
|
) else (
|
|
|
|
set SYNCQT=false
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if "%SYNCQT%" == "true" (
|
|
|
|
if not "%perl.exe%" == "" (
|
|
|
|
echo Running syncqt ...
|
|
|
|
"%perl.exe%" -w "%QTSRC%\bin\syncqt.pl" -minimal -version %QTVERSION% -module QtCore -outdir "%QTDIR%" %QTSRC%
|
|
|
|
if errorlevel 1 exit /b
|
|
|
|
) else (
|
|
|
|
echo Perl not found in PATH. Aborting. >&2
|
|
|
|
exit /b 1
|
|
|
|
)
|
2012-02-08 10:38:07 +00:00
|
|
|
)
|
|
|
|
|
2016-11-18 15:24:31 +00:00
|
|
|
rem Build qmake
|
|
|
|
|
|
|
|
echo Bootstrapping qmake ...
|
|
|
|
|
|
|
|
cd qmake
|
|
|
|
if errorlevel 1 exit /b
|
2015-07-15 23:23:51 +00:00
|
|
|
|
2012-02-08 10:38:07 +00:00
|
|
|
echo #### Generated by configure.bat - DO NOT EDIT! ####> Makefile
|
|
|
|
echo/>> Makefile
|
2016-11-18 15:24:31 +00:00
|
|
|
echo BUILD_PATH = ..>> Makefile
|
|
|
|
if "%tmpl%" == "win32" (
|
|
|
|
echo SOURCE_PATH = %QTSRC%>> Makefile
|
|
|
|
) else (
|
|
|
|
echo SOURCE_PATH = %QTSRC:\=/%>> Makefile
|
|
|
|
)
|
|
|
|
if exist "%QTSRC%\.git" (
|
|
|
|
echo INC_PATH = ../include>> Makefile
|
|
|
|
) else (
|
|
|
|
echo INC_PATH = $^(SOURCE_PATH^)/include>> Makefile
|
|
|
|
)
|
|
|
|
echo QT_VERSION = %QTVERSION%>> Makefile
|
2015-09-18 01:17:40 +00:00
|
|
|
rem These must have trailing spaces to avoid misinterpretation as 5>>, etc.
|
2016-11-18 15:24:31 +00:00
|
|
|
echo QT_MAJOR_VERSION = %QTVERMAJ% >> Makefile
|
|
|
|
echo QT_MINOR_VERSION = %QTVERMIN% >> Makefile
|
|
|
|
echo QT_PATCH_VERSION = %QTVERPAT% >> Makefile
|
|
|
|
if "%tmpl%" == "win32" (
|
|
|
|
echo QMAKESPEC = %PLATFORM%>> Makefile
|
2012-02-08 10:38:07 +00:00
|
|
|
) else (
|
2016-11-18 15:24:31 +00:00
|
|
|
echo QMAKESPEC = $^(SOURCE_PATH^)/mkspecs/%PLATFORM%>> Makefile
|
|
|
|
echo CONFIG_CXXFLAGS = -std=c++11 -ffunction-sections>> Makefile
|
|
|
|
echo CONFIG_LFLAGS = -Wl,--gc-sections>> Makefile
|
|
|
|
type "%QTSRC%\qmake\Makefile.unix.win32" >> Makefile
|
|
|
|
type "%QTSRC%\qmake\Makefile.unix.mingw" >> Makefile
|
2012-02-08 10:38:07 +00:00
|
|
|
)
|
|
|
|
echo/>> Makefile
|
2016-11-18 15:24:31 +00:00
|
|
|
type "%QTSRC%\qmake\Makefile.%tmpl%" >> Makefile
|
2012-02-08 10:38:07 +00:00
|
|
|
|
2016-11-18 15:24:31 +00:00
|
|
|
%MAKE%
|
|
|
|
if errorlevel 1 (cd .. & exit /b 1)
|
2012-02-08 10:38:07 +00:00
|
|
|
|
2016-11-18 15:24:31 +00:00
|
|
|
cd ..
|
2012-02-08 10:38:07 +00:00
|
|
|
|
2016-11-18 15:24:31 +00:00
|
|
|
rem Generate qt.conf
|
2016-08-01 10:40:03 +00:00
|
|
|
|
2016-11-18 15:24:31 +00:00
|
|
|
> "%QTDIR%\bin\qt.conf" (
|
|
|
|
@echo [EffectivePaths]
|
|
|
|
@echo Prefix=..
|
|
|
|
@echo [Paths]
|
|
|
|
@echo TargetSpec=dummy
|
|
|
|
@echo HostSpec=%PLATFORM%
|
|
|
|
)
|
|
|
|
if not "%QTDIR%" == "%QTSRC%" (
|
|
|
|
>> "%QTDIR%\bin\qt.conf" (
|
|
|
|
@echo [EffectiveSourcePaths]
|
|
|
|
@echo Prefix=%QTSRC:\=/%
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
rem Launch qmake-based configure
|
2012-08-30 10:37:01 +00:00
|
|
|
|
2016-11-18 15:24:31 +00:00
|
|
|
cd "%TOPQTDIR%"
|
|
|
|
"%QTDIR%\bin\qmake.exe" "%TOPQTSRC%" -- %ARGS%
|