Qt for Google Native Client: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
=Qt for Google Native Client=
[[Category:Developing_with_Qt]]<br />[toc align_right=&quot;yes&amp;quot; depth=&quot;3&amp;quot;]
 
= Qt for Google Native Client =


Qt for Native Client allows you to deploy and run Qt applications in supported web browsers. Native Client is currently implemented in the Chrome browser.
Qt for Native Client allows you to deploy and run Qt applications in supported web browsers. Native Client is currently implemented in the Chrome browser.


For a general introduction to Native Client see the [http://code.google.com/p/nativeclient/ project page] ''[code.google.com]'' or the [http://www.youtube.com/watch?v=WgbK0ztUkDM 2011 Google IO talk] ''[youtube.com]''
For a general introduction to Native Client see the &quot;project page&amp;quot;:http://code.google.com/p/nativeclient/ or the &quot;2011 Google IO talk&amp;quot;:http://www.youtube.com/watch?v=WgbK0ztUkDM


==Getting Started==
== Getting Started ==


To develop C++-based Qt applications targeting native client you need the following:
To develop C+''-based Qt applications targeting native client you need the following:
<br /># A Mac OS X or Gnu/Linux system. Windows is not supported.<br /># The nacl &quot;SDK&amp;quot;:http://code.google.com/chrome/nativeclient/. Qt is currently developed against SDK version 18 using glibc toolchain.<br /># Chrome from Google. Qt is currently developed against Chromium 18''.<br /># &quot;qtbase-nacl&amp;quot; (Qt 5) https://github.com/msorvig/qt5-qtbase-nacl<br /># &quot;qttools-nacl&amp;quot; (Qt 5) https://github.com/msorvig/qt5-qttools-nacl


# A Mac OS X or Gnu/Linux system. Windows is not supported.
=== Configuring and building Qt ===
# The nacl [http://code.google.com/chrome/nativeclient/ <span class="caps">SDK</span>] ''[code.google.com]''. Qt is currently developed against <span class="caps">SDK</span> version 18 using glibc toolchain.
# Chrome from Google. Qt is currently developed against Chromium 18+.
# “qtbase-nacl” (Qt 5) https://github.com/msorvig/qt5-qtbase-nacl
# “qttools-nacl” (Qt 5) https://github.com/msorvig/qt5-qttools-nacl
 
===Configuring and building Qt===


Qt 5 is now the preferred version, and includes improvements such as shared builds, glibc toolchain support and a better nacldeployqt that can create multi-arch app distributions.
Qt 5 is now the preferred version, and includes improvements such as shared builds, glibc toolchain support and a better nacldeployqt that can create multi-arch app distributions.


====32-bit:====
==== 32-bit: ====


./configure -xplatform unsupported/nacl-g++ -device-option <span class="caps">CROSS</span>_COMPILE=/path/to/nacl_sdk/pepper_19/toolchain/mac_x86_glibc/bin/ -nomake examples -nomake tests -developer-build -opensource -confirm-license -reduce-relocations
./configure -xplatform unsupported/nacl-g++ -device-option CROSS_COMPILE=/path/to/nacl_sdk/pepper_19/toolchain/mac_x86_glibc/bin/ -nomake examples -nomake tests -developer-build -opensource -confirm-license -reduce-relocations


====64-bit:====
==== 64-bit: ====


./configure -xplatform unsupported/nacl64-g++ -device-option <span class="caps">CROSS</span>_COMPILE=/path/to/nacl_sdk/pepper_19/toolchain/mac_x86_glibc/bin/ -nomake tests -developer-build -opensource -confirm-license -release -no-sse2 -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2
./configure -xplatform unsupported/nacl64-g++ -device-option CROSS_COMPILE=/path/to/nacl_sdk/pepper_19/toolchain/mac_x86_glibc/bin/ -nomake tests -developer-build -opensource -confirm-license -release -no-sse2 -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2


make sub-src (should complete)
make sub-src (should complete)


===Qt Deployment===
=== Qt Deployment ===


QtTools now includes the ''nacldeployqt'' tool which supports packaging a Qt app with all its dependencies. Building your app should give you a .nexe file, which nacldeployqt can extract dependencies from.
QtTools now includes the ''nacldeployqt'' tool which supports packaging a Qt app with all its dependencies. Building your app should give you a .nexe file, which nacldeployqt can extract dependencies from.


# Build qttools/src/nacldeployqt using <span class="caps">HOST</span> Qt: (/path/to/host/qt/bin/qmake -nocache nacldeployqt.pro)
# Build qttools/src/nacldeployqt using HOST Qt: (/path/to/host/qt/bin/qmake -nocache nacldeployqt.pro)
# Developer deployment: “nacldeployqt MyApp.nexe -server” . Open Chrome at localhost:5103
# Developer deployment: &quot;nacldeployqt MyApp.nexe -server&amp;quot; . Open Chrome at localhost:5103
# Distribution deployment with multiple archs: “nacldeployqt x86-32/MyApp.nexe x86-64/MyApp.nexe targetDirectory”
# Distribution deployment with multiple archs: &quot;nacldeployqt x86-32/MyApp.nexe x86-64/MyApp.nexe targetDirectory&amp;quot;


nacldeployqt creates loader html&amp;javascript, the .nmf manifest file, copies dependencies and also generates files that can serve as starting point for Chrome Web Store deployment.
nacldeployqt creates loader html&amp;amp;javascript, the .nmf manifest file, copies dependencies and also generates files that can serve as starting point for Chrome Web Store deployment.


==Porting Guide==
== Porting Guide ==


* Widgets generally work
* Widgets generally work
* OpenGL, [QtDeclarative|Quick|1|2], [QtMultimedia|Kit], or anything else outside of QtBase is not currently supported.
* OpenGL, [QtDeclarative|Quick|1|2], [QtMultimedia|Kit], or anything else outside of QtBase is not currently supported.
* Q_OS_NACL is your friend
* Q_OS_NACL is your friend
* Re-entering the event loop is not supported. (QFileDialog::getOpenFileName() will not work; QFileDialog::show() can be made to work at some point)
* Re-entering the event loop is not supported. (QFileDialog::getOpenFileName() will not work; QFileDialog::show() can be made to work at some point)  
* Window management is tricky and only partially implemented. For best results use one top-level window only.
* Window management is tricky and only partially implemented. For best results use one top-level window only.


===Roadmap===
=== Roadmap ===


* OpenGL support
* OpenGL support


==Qt Creator [NOT <span class="caps">TESTED</span> <span class="caps">WITH</span> QT 5]==
== Qt Creator [NOT TESTED WITH QT 5] ==


[https://gitorious.org/qtnativeclient/creator Qt Creator] ''[gitorious.org]'' supports targeting the NaCl toolchain, and launching apps using the chrome(ium) browser. The toolchain and browser are found by looking in the <span class="caps">PATH</span>, make sure “which i686-nacl-gcc” and “which chrome” returns the correct binaries. Also make sure that Qt Creator actually sees the correct <span class="caps">PATH</span>, launching it directly from the terminal usually does the trick.
&quot;Qt Creator&amp;quot;:https://gitorious.org/qtnativeclient/creator supports targeting the NaCl toolchain, and launching apps using the chrome(ium) browser. The toolchain and browser are found by looking in the PATH, make sure “which i686-nacl-gcc” and “which chrome” returns the correct binaries. Also make sure that Qt Creator actually sees the correct PATH, launching it directly from the terminal usually does the trick.


If everything works correctly then there should be a “NaCl GCC” toolchain as well as a “NaCl” target available.
If everything works correctly then there should be a “NaCl GCC” toolchain as well as a “NaCl” target available.
To test the installation, start by loading and compiling the industry standard Qt porting example: examples/widgets/wiggly
===Categories:===
* [[:Category:Developing with Qt|Developing_with_Qt]]

Revision as of 14:28, 23 February 2015


[toc align_right="yes&quot; depth="3&quot;]

Qt for Google Native Client

Qt for Native Client allows you to deploy and run Qt applications in supported web browsers. Native Client is currently implemented in the Chrome browser.

For a general introduction to Native Client see the "project page&quot;:http://code.google.com/p/nativeclient/ or the "2011 Google IO talk&quot;:http://www.youtube.com/watch?v=WgbK0ztUkDM

Getting Started

To develop C+-based Qt applications targeting native client you need the following:
# A Mac OS X or Gnu/Linux system. Windows is not supported.
# The nacl "SDK&quot;:http://code.google.com/chrome/nativeclient/. Qt is currently developed against SDK version 18 using glibc toolchain.
# Chrome from Google. Qt is currently developed against Chromium 18.
# "qtbase-nacl&quot; (Qt 5) https://github.com/msorvig/qt5-qtbase-nacl
# "qttools-nacl&quot; (Qt 5) https://github.com/msorvig/qt5-qttools-nacl

Configuring and building Qt

Qt 5 is now the preferred version, and includes improvements such as shared builds, glibc toolchain support and a better nacldeployqt that can create multi-arch app distributions.

32-bit:

./configure -xplatform unsupported/nacl-g++ -device-option CROSS_COMPILE=/path/to/nacl_sdk/pepper_19/toolchain/mac_x86_glibc/bin/ -nomake examples -nomake tests -developer-build -opensource -confirm-license -reduce-relocations

64-bit:

./configure -xplatform unsupported/nacl64-g++ -device-option CROSS_COMPILE=/path/to/nacl_sdk/pepper_19/toolchain/mac_x86_glibc/bin/ -nomake tests -developer-build -opensource -confirm-license -release -no-sse2 -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2

make sub-src (should complete)

Qt Deployment

QtTools now includes the nacldeployqt tool which supports packaging a Qt app with all its dependencies. Building your app should give you a .nexe file, which nacldeployqt can extract dependencies from.

  1. Build qttools/src/nacldeployqt using HOST Qt: (/path/to/host/qt/bin/qmake -nocache nacldeployqt.pro)
  2. Developer deployment: "nacldeployqt MyApp.nexe -server&quot; . Open Chrome at localhost:5103
  3. Distribution deployment with multiple archs: "nacldeployqt x86-32/MyApp.nexe x86-64/MyApp.nexe targetDirectory&quot;

nacldeployqt creates loader html&amp;javascript, the .nmf manifest file, copies dependencies and also generates files that can serve as starting point for Chrome Web Store deployment.

Porting Guide

  • Widgets generally work
  • OpenGL, [QtDeclarative|Quick|1|2], [QtMultimedia|Kit], or anything else outside of QtBase is not currently supported.
  • Q_OS_NACL is your friend
  • Re-entering the event loop is not supported. (QFileDialog::getOpenFileName() will not work; QFileDialog::show() can be made to work at some point)
  • Window management is tricky and only partially implemented. For best results use one top-level window only.

Roadmap

  • OpenGL support

Qt Creator [NOT TESTED WITH QT 5]

"Qt Creator&quot;:https://gitorious.org/qtnativeclient/creator supports targeting the NaCl toolchain, and launching apps using the chrome(ium) browser. The toolchain and browser are found by looking in the PATH, make sure “which i686-nacl-gcc” and “which chrome” returns the correct binaries. Also make sure that Qt Creator actually sees the correct PATH, launching it directly from the terminal usually does the trick.

If everything works correctly then there should be a “NaCl GCC” toolchain as well as a “NaCl” target available.