Freitag, 24. Februar 2012

Building QML Desktop Components with Visual Studio using CMake


Easy way to build Qt-Desktop-Components in Visual Studio using Cmake

by Markus Bohms & Michael Wagner from shared-reality.com

Preparations


  • in order to use the examples standalone we have to change the import QtDesktop 0.1 statement to point to our extern\desktop\components directory, so change it to import "../components" 0.1



For example change extern/desktop/examples/gallery.qml as follows:




































Make sure to use the correct relative path for example if you change examples/content/panel.qml you have to use import "../../components" <version>
*<version> can change through developement of qt-dekstop-components!

Also you have to check if a qml inside of components imports QtDesktop and change this import, too - at the moment splitter.qml uses the import QtDesktop statement.


Building


  • use the CMakefile placed in "QmlComponentsTest/CMakeLists.txt" to create the project for VS2010, gcc, or any other compiler you want to use. We're doing an out-of-source build which means that all generated stuff like Visual Studio project files go to /BUILD and the source tree doesnt get polluted
  • the VisualStudio project contains now three subprojects called styleplugin, INSTALL and ExampleBrowser
  1. Build the plugin target - it should be created in "QmlComponentsTest/components/plugins/styleplugin.dll" , .lib ...
  2. Build INSTALL target - this will copy the needed QT-Dlls and the components to "QmlComponentsTest/bin/<Debug/Release/etc.>"
  3. Build the ExampleBrowser and select it as startup-project.  When starting out of Visual Studio make sure that the workingdirectory is set to  "QmlComponentsTest/bin/<Debug/Release/etc.>" (see Debug Settings)

Run ExampleBrowser.exe and use the dropdown menu on top to switch between the examples.




There are many ways to get this plugin to work, but this is a easy and fast way to get it to work if you are not using QtCreator.



Dienstag, 21. Februar 2012

Building QML Desktop Components for Windows using CMake

We've developed an easy to use CMake-Configuration to create a visual studio solution for building QML-desktop components on Windows as seen here http://developer.qt.nokia.com/forums/viewthread/4380  .

We're using it with Visual Studio 2010 and Qt 4.8.0 .

( description follows )