Skip to content

Instantly share code, notes, and snippets.

@timlinux
Last active October 25, 2018 07:29
Show Gist options
  • Save timlinux/a8ae0aed44ccd2e4c7bb to your computer and use it in GitHub Desktop.
Save timlinux/a8ae0aed44ccd2e4c7bb to your computer and use it in GitHub Desktop.
How to build QGIS in QtCreator on Ubuntu 14.04
apt-get install -y qgis cmake-curses-gui build-essential \
     git gitg meld \
     qtcreator qt4-designer \
     flex bison libgeos-dev libgdal1-dev \
     pyqt4-dev-tools libgsl0-dev libexpat1-dev libproj-dev \
     libqwt-dev libspatialindex-dev libqscintilla2-dev\
     libqscintilla2-dev python-qscintilla2 python-dev python-sip-dev \
     python-qt4-dev postgresql-client-9.3 \
     libfcgi-dev

Open QtCreator.

Now do File -> Open File or Project

Select the CMakeLists.txt file in the top level of your QGIS source tree.

Change the Default build path from:

/home/timlinux/dev/cpp/build-QGIS-Desktop-Default

to

/home/timlinux/dev/cpp/QGIS/build

Make the build directory if needed using the Browse... button. Also replace /home/timlinux/dev with appropriate base path the username etc.

Click on configure project

It should complete with the sentence in the General Messages view:

-- Build files have been written to: /home/timlinux/dev/cpp/QGIS/build

Now tweak the CMake configuration:

Click on projects on the left hand side icons.

On the Build & Run tab enter the following into CMake arguments:

-DQWT_INCLUDE_DIR=/usr/include/qwt -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/usr/local/qgis-master -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython2.7.so -DQSCINTILLA_INCLUDE_DIR=/usr/include/qt4 -DQWT_LIBRARY=/usr/lib/libqwt.so

Now click the build hammer icon on the left icons

Note the above arguments assume you are using Ubuntu 14.04 64

Tweaking your build:

In projects, build & run, under Build steps -> Make click Details and enter:

-j8 in the additional arguments box

(replace 8 with the number of cores you can build with)

Click the hammer again and you should get a much faster build.

Running QGIS

In Projects -> build and run -> Run tab change Run configuration to qgis then press the green triangle with the ladybug to start debugging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment