Skip to content

Instantly share code, notes, and snippets.

@UnaNancyOwen
Last active June 5, 2020 03:12
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save UnaNancyOwen/dbc0506332caeb906c14 to your computer and use it in GitHub Desktop.
Building Qt with Visual Studio

Building Qt5.5 with Visual Studio

Download

  1. Qt 5.5.1(qt-everywhere-opensource-src-5.5.1.zip)をダウンロードしてファイルを解凍する。(C:\qt-everywhere-opensource-src-5.5.1)
    http://www.qt.io/download/

  2. jom 1.1.0(jom_1_1_0.zip)をダウンロードしてファイルを解凍する。(C:\jom)
    http://download.qt.io/official_releases/jom/
    http://download.qt.io/official_releases/jom/jom_1_1_0.zip.mirrorlist

Build

  1. Visual Studioの開発者コマンドプロンプト(Visual Studio Tools\Windows Desktop Command Prompts\VS2015 Native Tools コマンド プロンプト)を管理者権限で起動する。

    * Win32の場合は"VS2015 x86Native Tools コマンド プロンプト"、x64の場合は"VS2015 x64 Native Tools コマンド プロンプト"を起動する。

  2. 以下のコマンドを実行してビルドの準備をする。

    • Win32
     cd C:\qt-everywhere-opensource-src-5.5.1
     set QTDIR=C:\qt-everywhere-opensource-src-5.5.1
     set QMAKESPEC=win32-msvc2015
     set PATH=C:\jom;%PATH%
     configure -opensource -confirm-license -debug-and-release -nomake examples -nomake tests -opengl dynamic -make tools -prefix "C:\Qt\Qt5.5.1\5.5\msvc2015"
    • x64
     cd C:\qt-everywhere-opensource-src-5.5.1
     set QTDIR=C:\qt-everywhere-opensource-src-5.5.1
     set QMAKESPEC=win32-msvc2015
     set PATH=C:\jom;%PATH%
     configure -opensource -confirm-license -debug-and-release -nomake examples -nomake tests -opengl dynamic -make tools -prefix "C:\Qt\Qt5.5.1\5.5\msvc2015_64"
    Option Meaning
    -platform <spec> ターゲットプラットフォーム。(%QMAKESPEC%)
    e.g. -platform win32-msvc2015
    -opensource オープンソース版を利用する。
    -confirm-license ライセンスに同意する。
    -fast ライブラリおよびサブディレクトリのみMakefileを生成する。
    -debug-and-release デバッグ/リリース構成でビルドする。
    -debug デバッグ構成でビルドする。
    -release リリース構成でビルドする。
    -nomake <part> <part>をビルドしない。
    e.g. -nomake example -nomake tests
    -opengl <api> <api>のOpenGLを有効にする。
    e.g. -opengl desktop
    e.g. -opengl dynamic
    -make <part> <part>をビルドに追加する。
    e.g. -make tools
    -prefix <dir> <dir>にインストールする。
    e.g. -prefix C:\Qt\Qt5.5.1\5.5.1\msvc2015_64
  3. 以下のコマンドを実行してビルドする。
    ※ -jオプションはコンパイルの並列数を指定する。通常はCPUの論理プロセッサ数を指定する。

    jom -j8
  4. 以下のコマンドを実行してインストールする。
    prefixで指定したディレクトリにインストールされる。

    jom install

Environment Variable

  1. 環境変数QTDIRを作成してQtのパス(C:\Qt\Qt5.5.1\5.5.1\msvc2015_64)を設定する。

Building Qt5.6 with Visual Studio

Download

  1. Qt 5.6.0(qt-everywhere-opensource-src-5.6.0.zip)をダウンロードしてファイルを解凍する。(C:\qt-everywhere-opensource-src-5.6.0)
    http://www.qt.io/download/

  2. jom 1.1.0(jom_1_1_0.zip)をダウンロードしてファイルを解凍する。(C:\jom)
    http://download.qt.io/official_releases/jom/
    http://download.qt.io/official_releases/jom/jom_1_1_0.zip.mirrorlist

    * OS標準機能で解凍するとソースコードのファイル数が膨大なためフリーズしやすい。7-ZipなどのアーカイバかPowerShellのコマンドで解凍することを推奨する。

Build

  1. Visual Studioの開発者コマンドプロンプト(Visual Studio Tools\Windows Desktop Command Prompts\VS2015 Native Tools コマンド プロンプト)を管理者権限で起動する。

    * Win32の場合は"VS2015 x86Native Tools コマンド プロンプト"、x64の場合は"VS2015 x64 Native Tools コマンド プロンプト"を起動する。

  2. 以下のコマンドを実行してビルドの準備をする。

    • Win32
     cd C:\qt-everywhere-opensource-src-5.6.0
     set QTDIR=C:\qt-everywhere-opensource-src-5.6.0
     set QMAKESPEC=win32-msvc2015
     set PATH=C:\jom;%PATH%
     configure -opensource -confirm-license -debug-and-release -nomake examples -nomake tests -opengl dynamic -make tools -prefix "C:\Qt\Qt5.6.0\5.6\msvc2015"
    • x64
     cd C:\qt-everywhere-opensource-src-5.6.0
     set QTDIR=C:\qt-everywhere-opensource-src-5.6.0
     set QMAKESPEC=win32-msvc2015
     set PATH=C:\jom;%PATH%
     configure -opensource -confirm-license -debug-and-release -nomake examples -nomake tests -opengl dynamic -make tools -prefix "C:\Qt\Qt5.6.0\5.6\msvc2015_64"
    Option Meaning
    -platform <spec> ターゲットプラットフォーム。(%QMAKESPEC%)
    e.g. -platform win32-msvc2015
    -opensource オープンソース版を利用する。
    -confirm-license ライセンスに同意する。
    -debug-and-release デバッグ/リリース構成でビルドする。
    -debug デバッグ構成でビルドする。
    -release リリース構成でビルドする。
    -nomake <part> <part>をビルドしない。
    e.g. -nomake example -nomake tests
    -opengl <api> <api>のOpenGLを有効にする。
    e.g. -opengl desktop
    e.g. -opengl dynamic
    -make <part> <part>をビルドに追加する。
    e.g. -make tools
    -prefix <dir> <dir>にインストールする。
    e.g. -prefix -prefix C:\Qt\Qt5.6.0\5.6\msvc2015_64
  3. 以下のコマンドを実行してビルドする。
    ※ -jオプションはコンパイルの並列数を指定する。通常はCPUの論理プロセッサ数を指定する。

    jom -j8
  4. 以下のコマンドを実行してインストールする。
    prefixで指定したディレクトリにインストールされる。

    jom install

Environment Variable

  1. 環境変数QTDIRを作成してQtのパス(C:\Qt\Qt5.6.0\5.6\msvc2015_64)を設定する。

Building Qt5.8 with Visual Studio

Download

  1. Qt 5.8.0(qt-everywhere-opensource-src-5.8.0.zip)をダウンロードしてファイルを解凍する。(C:\qt-everywhere-opensource-src-5.8.0)
    http://www.qt.io/download/

  2. jom 1.1.2(jom_1_1_2.zip)をダウンロードしてファイルを解凍する。(C:\jom)
    http://download.qt.io/official_releases/jom/
    http://download.qt.io/official_releases/jom/jom_1_1_2.zip.mirrorlist

    * OS標準機能で解凍するとソースコードのファイル数が膨大なためフリーズしやすい。7-ZipなどのアーカイバかPowerShellのコマンドで解凍することを推奨する。

Build

  1. Visual Studioの開発者コマンドプロンプト(Visual Studio Tools\Windows Desktop Command Prompts\VS2015 Native Tools コマンド プロンプト)を管理者権限で起動する。

    * Win32の場合は"VS2015 x86Native Tools コマンド プロンプト"、x64の場合は"VS2015 x64 Native Tools コマンド プロンプト"を起動する。

  2. 以下のコマンドを実行してビルドの準備をする。

    • Win32
     cd C:\qt-everywhere-opensource-src-5.8.0
     set QTDIR=C:\qt-everywhere-opensource-src-5.8.0
     set QMAKESPEC=win32-msvc2015
     set PATH=C:\jom;%PATH%
     configure -opensource -confirm-license -debug-and-release -nomake examples -nomake tests -opengl dynamic -make tools -prefix "C:\Qt\Qt5.8.0\5.8\msvc2015"
    • x64
     cd C:\qt-everywhere-opensource-src-5.8.0
     set QTDIR=C:\qt-everywhere-opensource-src-5.8.0
     set QMAKESPEC=win32-msvc2015
     set PATH=C:\jom;%PATH%
     configure -opensource -confirm-license -debug-and-release -nomake examples -nomake tests -opengl dynamic -make tools -prefix "C:\Qt\Qt5.8.0\5.8\msvc2015_64"
    Option Meaning
    -platform <spec> ターゲットプラットフォーム。(%QMAKESPEC%)
    e.g. -platform win32-msvc2015
    -opensource オープンソース版を利用する。
    -confirm-license ライセンスに同意する。
    -debug-and-release デバッグ/リリース構成でビルドする。
    -debug デバッグ構成でビルドする。
    -release リリース構成でビルドする。
    -nomake <part> <part>をビルドしない。
    e.g. -nomake example -nomake tests
    -opengl <api> <api>のOpenGLを有効にする。
    e.g. -opengl desktop
    e.g. -opengl dynamic
    -make <part> <part>をビルドに追加する。
    e.g. -make tools
    -prefix <dir> <dir>にインストールする。
    e.g. -prefix C:\Qt\Qt5.8.0\5.8\msvc2015_64
  3. 以下のコマンドを実行してビルドする。
    ※ -jオプションはコンパイルの並列数を指定する。通常はCPUの論理プロセッサ数を指定する。

    jom -j8
  4. 以下のコマンドを実行してインストールする。
    prefixで指定したディレクトリにインストールされる。

    jom install

Environment Variable

  1. 環境変数QTDIRを作成してQtのパス(C:\Qt\Qt5.8.0\5.8\msvc2015_64)を設定する。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment