UnaNancyOwen
11/2/2015 - 10:52 AM

Building Qt with Visual Studio

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"
    
    OptionMeaning
    -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"
    
    OptionMeaning
    -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"
    
    OptionMeaning
    -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)を設定する。