Skip to content

Building qtbindings

Jason Thomas edited this page Jul 17, 2014 · 3 revisions

How qtbindings is built

This document will explain how all the pieces of qtbindings come together to build the qtbindings gem.

Rakefile

Defines the rake tasks used to make building the gem easier. The key tasks:

  • gem - Used to build the Mac or Unix gem using qtbindings.gemspec. This defines an extensions of extconf.rb and includes ext/**/* in files. This is what causes the native gem to be compiled when it is installed.
  • gemnative - Used to build the Windows gem using qtbindingsnative.gemspec. This does not define any extensions or ext/**/* files because we build the native Windows gem and distribute it.
  • gemqt - Used to build the Qt DLL gem using the qtbindings-qt.gemspec. First calls 'make installqt' to copy the Qt DLLs before building the gem.
  • extconf - Creates the makefile using extconf.rb. This tasks is required by all the build tasks.

Makefile

Dynamically created by the extconf Rake task. The Makefile is created differently for Windows, Mac, and Unix platforms. The primary difference is the paths and executable names used. Windows does not include the DBus component. The makefile contains the following targets:

  • makedirs - Create the build directories
  • clean - Remove the build artifacts
  • distclean - Remove the plugins and Qt DLLs
  • build - Build the native gem. This sets the compiler and make executable. Then it calls cmake to create all the makefiles. Finally it enters the ext/build directory and builds.
  • install - Copies the platform specific build outputs to the bin and lib directories. Windows creates DLLs and Mac and Unix create shared libraries.
  • installqt - Windows Only. It copies all the Qt DLLs to the qtbin directory so the qtbindings-qt gem can be built

cmake

Called from the Makefile build target. To really understand cmake start with the cmake about website and keep digging. Basically it creates platform specific makefiles by parsing its own CMakeLists.txt files. The top level cmake file is ext/CMakeLists.txt. This has been documented to help identify what's happening.

Clone this wiki locally