VS2017 compiler 32/64-bit static library QT

windows under static library compiled QT

Use vs2017 compile under windows qt5.9.7 recorded version 32, 64 static library process

Preparation Tool

  • QT source archive version used here 5.9.7 zip package
  • Visual Studio2017 development environment
  • Python
  • Perl
  • Ruby

Compilation

The first step in extracting the source code to modify the file

After unpacking good source code into the "\ qtbase \ mkspecs \ common" down the path, open msvc-desktop.conf file is modified.

QMAKE_CFLAGS_RELEASE    = $$QMAKE_CFLAGS_OPTIMIZE -MD
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_OPTIMIZE -Zi -MD
QMAKE_CFLAGS_DEBUG      = -Zi -MDd

The left and right three files -MD line position 38 is modified -MT

The second step is completed configure and compile the configuration

  1. Run VS2017 command-line tool, according to the version you want to generate static library select x86 or x64
  2. Switch to the root of the source QT
  3. Input configure -confirm-license -opensource -platform win32-msvc -debug-and-release -static -static-runtime -prefix "C: \ Qt5.9.7" -no-compile-examples (PS: path generating modified as required , other items may be modified as needed)
  4. Follow the prompts jom
  5. Jom install execution

Compilation process about 2-3 hours.

command description
-platform Select host mkspec[detected]
-confirm-license Automatically acknowledge the license
-opensource Build the Open-Source Edition of Qt
-debug-and-release Build two versions of Qt
-static Build static Qt libraries
-static-runtime With -static,use statuc runtime
-prefix he deployment directory, as seen on the target device
-no-compile-examples Install only the sources of examples
-nomake Exclude part from the list of parts to be built

Problems encountered

Compiled static libraries want to change the path to modify the folder name after being given QTCreator found in, qmake configuration error.

Solution: bin file in the folder path after entering modify, create qt.conf folder, folder add content

[Paths]

Prefix = 新的路径

Then back QTCreator remove the incorrect configuration options Qt Versions, add a new path manually configured after the successful selection of the appropriate version of Qt to the Kit interface.

Guess you like

Origin blog.csdn.net/weixin_35857412/article/details/94738666