Qt パッケージングに関する推奨事項

ディストリビューションでは、複数の異なる Qt バージョンをパッケージ化したい場合があります。Linux ディストリビューションを例にとると、以下の方法をお勧めします:

  • 実行ファイルを/usr/qt6/bin にインストールするように Qt を設定する。
  • /usr/bin に、/usr/qt6/bin に存在するユーザー向けアプリケーションへの、バージョンの接尾辞を持つシンボリックリンクを作成します。例えば、/usr/qt6/bin/designer を指すシンボリックリンク/usr/bin/designer6 を作成します。

ユーザー向けアプリケーションとは、ユーザーが起動する Qt ツールのことです。これには qmake、Qt Widgets Designer、Qt Linguist などが含まれます。moc、rcc、uic などの他のツールは、通常、ユーザーが手動で起動するのではなく、ユーザープロジェクトのビルドシステムから起動します。

Qt のビルドシステムでは、ユーザー向けと考えられるツールはそのようにマークされ、その情報は以下のように抽出し、使用することができます。

CMake の引数を使って Qt を設定します:

-DCMAKE_INSTALL_PREFIX=/usr
-DINSTALL_BINDIR=/usr/qt6/bin
-DINSTALL_PUBLICBINDIR=/usr/bin

Qt のビルドディレクトリにuser_facing_tool_links.txt というファイルが作成されます。このファイルには、INSTALL_BINDIR にユーザー向けツールのパスが、INSTALL_PUBLICDIR にバージョン管理されたリンクへのパスが、それぞれスペースで区切られて記述されています。

このファイルは、すべてのバージョン管理されたシンボリックリンクを作成するために使用できます:

xargs ln -s < user_facing_tool_links.txt

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.