How to Build Qt From Source Codes (QT 5.12 + Visual Studio 2017)

msvc-desktop.conf

  1. C:\Qt\5.12.0\Src\qtbase\mkspecs\common\msvc-desktop.conf
  2.  
  3. QMAKE_CFLAGS_RELEASE    = $QMAKE_CFLAGS_OPTIMIZE -MT
  4. QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $QMAKE_CFLAGS_OPTIMIZE -Zi -MT
  5. QMAKE_CFLAGS_DEBUG      = -Zi -MTd

qt5vars.cmd

  1. REM Set up \Microsoft Visual Studio 2017, where arch is \c amd64, \c x86, etc.
  2. CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
  3. SET _ROOT=C:\Qt\5.12.0\Src
  4. SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
  5. REM Uncomment the below line when using a git checkout of the source repository
  6. REM SET PATH=%_ROOT%\qtrepotools\bin;%PATH%
  7. SET _ROOT=

make & make install

  1. C:\Qt\5.12.0\Src>qt5vars.cmd
  2. C:\Qt\5.12.0\Src>configure -opensource -confirm-license
  3. C:\Qt\5.12.0\Src>jom -j 8
  4. C:\Qt\5.12.0\Src>jom install

Leave a Reply

Your email address will not be published. Required fields are marked *