From d9542be97d28fff5ea039f53e4d5b7a3216af10b Mon Sep 17 00:00:00 2001 From: Tim Sutton Date: Sun, 8 Jan 2017 19:30:51 +0700 Subject: [PATCH 1/4] Improvements to QtCreator docs * Added cache * Switched to using CodeBlocs - Ninja (fixed by having /usr/local/bin in path) Other small docs tweaks. --- development/README.md | 45 +++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/development/README.md b/development/README.md index e96abd8..87fd90f 100644 --- a/development/README.md +++ b/development/README.md @@ -290,7 +290,29 @@ $BUILD_SCRIPTS/qgis-dev-install.sh $BUILD_DIR * Make a directory in your QGIS source tree called ``build`` * Open the top level ``CMakeLists.txt`` in QtCreator -### Making a kit +### Set up a ccache compile profile in QtCreator + +CCache will cache previously compiled objects and greatly speed up the compilation process. We will make an alias for compiling c++ sources. Make sure you did ``brew install ccache`` when you were installing your dependencies further up in this document: + +``Preferences -> build and run -> compilers`` + +Select ``Clang (x86 64bit in /usr/bin)`` then press the **clone** button. + +Now modify your clone and use the following options: + +* **Name:** ``CCache for Clang (x86 64bit in /usr/bin)`` +* **Compiler path:** ``/usr/local/opt/ccache/libexec/clang++`` + +Leave rest of the options and press OK. + +### Set QtCreator to use brew CMake + +``Preferences -> build and run -> Cmake -> Manual -> Add`` + +* **Name:** Brew CMake +* **Path:** ``/usr/local/bin/cmake`` + +### Set QtCreator to use bew Qt5's cmake You need to modify the desktop kit to use your brew install qt5: @@ -300,11 +322,9 @@ Set the executable to : ``/usr/local/bin/qmake`` -``Preferences -> build and run -> Cmake -> Manual -> Add`` - -* **Name:** Brew CMake -* **Path:** /usr/local/bin/cmake +### Making a kit for compiling QGIS +A kit stores the set of compiler, Qt version, environment settings etc. that you want to use to compile a particular system. ``Preferences -> build and run -> Kits -> Manual Desktop`` @@ -315,7 +335,7 @@ Press clone to make a copy and in the copy set it up with the following options: * **Device type:** desktop * **Device:** Local PC * **Sys root:** Leave blank -* **Compiler:** Clang (x86_64bin in /usr/bin) +* **Compiler:** Cache for Clang (x86 64bit in /usr/bin) * **Environment:** click ‘Change …’ and add this to your python path so sip can be found: ``export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.5/site-packages`` @@ -329,8 +349,15 @@ Press clone to make a copy and in the copy set it up with the following options: * **Debugger:** System LLDB at /Library/Developer/CommandLineTools/usr/bin/lldb * **Qt Version:** Qt 5.7.0 (local) * **Qt mkspec:** leave blank +* **Environment:** Set to these (adjust python version if needed) + +``` +PATH:$PATH:/usr/local/bin +PYTHONPATH:$PYTHONPATH:/usr/local/lib/python3.5/site-packages +``` + * **CMake Tool:** Brew CMake (which you should have created further up in these notes) -* **CMake Generator:** CodeBlocks - Unix Makefiles (ninja is not working for me) +* **CMake Generator:** CodeBlocks - ninja * **CMake Configuration:** Press the ‘Change…’ button and paste this into the box provided: @@ -389,9 +416,7 @@ If you want to start with a clean setup in QtCreator you should: * **Ctlr-K** - pops up quick search for a class * **:spacebar** in the search popup will search for symbols * **Ctrl-K** - then type 'git blame' and it will give git blame for currently open file - -**F2** - jump to symbol / definition under cursor - +* **F2** - jump to symbol / definition under cursor * **Alt-Enter** - refactoring you can automatically implement stubs for a method in a header * **Alt-Enter** - refactoring you can generate getter and setter for a private member in a header * **Alt-Enter** - general refactoring From a60eb0e9e0e39d40a8ce2d68675fb2f6990a81e4 Mon Sep 17 00:00:00 2001 From: Tim Sutton Date: Sun, 8 Jan 2017 18:29:28 +0200 Subject: [PATCH 2/4] Updated QtCreator notes to work with Python 3.6 --- development/README.md | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/development/README.md b/development/README.md index 87fd90f..97ac76c 100644 --- a/development/README.md +++ b/development/README.md @@ -338,7 +338,7 @@ Press clone to make a copy and in the copy set it up with the following options: * **Compiler:** Cache for Clang (x86 64bit in /usr/bin) * **Environment:** click ‘Change …’ and add this to your python path so sip can be found: -``export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.5/site-packages`` +``export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.6/site-packages`` **NOTES:** @@ -353,7 +353,7 @@ Press clone to make a copy and in the copy set it up with the following options: ``` PATH:$PATH:/usr/local/bin -PYTHONPATH:$PYTHONPATH:/usr/local/lib/python3.5/site-packages +PYTHONPATH:$PYTHONPATH:/usr/local/lib/python3.6/site-packages ``` * **CMake Tool:** Brew CMake (which you should have created further up in these notes) @@ -363,33 +363,31 @@ PYTHONPATH:$PYTHONPATH:/usr/local/lib/python3.5/site-packages ``` CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable} -QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable} -CMAKE_INSTALL_PREFIX:PATH='/Users/timlinux/Applications/' CMAKE_FIND_FRAMEWORK:STRING=LAST -CMAKE_PREFIX_PATH:STRING='/usr/local/opt/qt5;/usr/local/opt/qt5-webkit;/usr/local/opt/gdal2;/usr/local/opt/expat;/usr/local/opt/sqlite;/usr/local/opt/flex;/usr/local/opt/bison' +CMAKE_INSTALL_PREFIX:PATH='/Users/timlinux/Applications/' +CMAKE_PREFIX_PATH:STRING='/usr/local/opt/qt5;/usr/local/opt/qt5-webkit;/usr/local/opt/qscintilla2;/usr/local/opt/qwt;/usr/local/opt/qwtpolar;/usr/local/opt/qca;/usr/local/opt/gdal2;/usr/local/opt/gsl;/usr/local/opt/geos;/usr/local/opt/proj;/usr/local/opt/libspatialite;/usr/local/opt/spatialindex;/usr/local/opt/fcgi;/usr/local/opt/expat;/usr/local/opt/sqlite;/usr/local/opt/flex;/usr/local/opt/bison;' ENABLE_MODELTEST:BOOL=FALSE ENABLE_TESTS:BOOL=TRUE GDAL_LIBRARY:FILEPATH=/usr/local/opt/gdal2/lib/libgdal.dylib GEOS_LIBRARY:FILEPATH=/usr/local/opt/geos/lib/libgeos_c.dylib +GRASS_PREFIX7:PATH=/usr/local/opt/grass7/grass-base GSL_CONFIG:FILEPATH=/usr/local/opt/gsl/bin/gsl-config GSL_INCLUDE_DIR:PATH=/usr/local/opt/gsl/include GSL_LIBRARIES:STRING='-L/usr/local/opt/gsl/lib -lgsl -lgslcblas' -WITH_QWTPOLAR:BOOL=TRUE -WITH_INTERNAL_QWTPOLAR:BOOL=FALSE -WITH_GRASS:BOOL=FALSE -WITH_GRASS7:BOOL=TRUE -GRASS_PREFIX7:PATH=/usr/local/opt/grass7/grass-base WITH_APIDOC:BOOL=FALSE WITH_ASTYLE:BOOL=TRUE WITH_CUSTOM_WIDGETS:BOOL=TRUE WITH_GLOBE:BOOL=FALSE +WITH_GRASS7:BOOL=TRUE +WITH_GRASS:BOOL=FALSE +WITH_INTERNAL_QWTPOLAR:BOOL=FALSE WITH_ORACLE:BOOL=FALSE WITH_QSCIAPI:BOOL=FALSE WITH_QSPATIALITE:BOOL=FALSE WITH_QTWEBKIT:BOOL=TRUE +WITH_QWTPOLAR:BOOL=TRUE WITH_SERVER:BOOL=TRUE WITH_STAGED_PLUGINS:BOOL=TRUE -QGIS_MACAPP_BUNDLE:STRING=0 ``` **Note:** Most of these settings were taken from $(brew --repository qgis/qgisdev)/scripts/qgis-cmake-setup.sh. You can comment out the last line of the aforementioned script and then just echo the CMD instead of running it to get the equivalent options above. @@ -466,7 +464,7 @@ You may need to do this: When debugging / running from Qt-Creator, ensure that GDAL python packages are in your path by adding this to your run environment: -```PYTHONPATH set to $PYTHONPATH:/usr/local/opt/gdal2-python/lib/python3.5/site-packages``` +```PYTHONPATH set to $PYTHONPATH:/usr/local/opt/gdal2-python/lib/python3.6/site-packages``` ## PyCharm @@ -476,7 +474,7 @@ When debugging / running from Qt-Creator, ensure that GDAL python packages are i Set your interpreter so add these python paths: ``` -/usr/local/lib/python3.5/site-packages/ +/usr/local/lib/python3.6/site-packages/ /Users/timlinux/Applications/QGIS.app/Contents/Resources/python/ /Users/timlinux/Applications/QGIS.app/Contents/Resources/python/plugins ``` @@ -487,7 +485,7 @@ Set your interpreter so add these python paths: ``` QGIS_PREFIX_PATH=/Users/timlinux/dev/cpp/QGIS/build/output/bin/QGIS.app/contents/MacOS; -PYTHONPATH=$PYTHONPATH:/Users/timlinux/Applications/QGIS.app/contents/Resources/python:/Users/timlinux/Applications/QGIS.app/contents/Resources/python/plugins/:/usr/local/lib/python3.5/site-packages/ +PYTHONPATH=$PYTHONPATH:/Users/timlinux/Applications/QGIS.app/contents/Resources/python:/Users/timlinux/Applications/QGIS.app/contents/Resources/python/plugins/:/usr/local/lib/python3.6/site-packages/ ``` ### For tests in PyCharm: From 03ed4890f94d8877af18fe22cf127c1d09a9a933 Mon Sep 17 00:00:00 2001 From: Tim Sutton Date: Mon, 9 Jan 2017 02:35:47 +0200 Subject: [PATCH 3/4] Don't assume cache was installed in QtCreator instructions --- development/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/development/README.md b/development/README.md index 97ac76c..d9357f4 100644 --- a/development/README.md +++ b/development/README.md @@ -292,7 +292,7 @@ $BUILD_SCRIPTS/qgis-dev-install.sh $BUILD_DIR ### Set up a ccache compile profile in QtCreator -CCache will cache previously compiled objects and greatly speed up the compilation process. We will make an alias for compiling c++ sources. Make sure you did ``brew install ccache`` when you were installing your dependencies further up in this document: +CCache will cache previously compiled objects and greatly speed up the compilation process. We will make an alias for compiling c++ sources. Make sure you do ``brew install ccache`` so that ccache is installed in your system: ``Preferences -> build and run -> compilers`` From 40905a240117e05041f598aad17d89efb256495e Mon Sep 17 00:00:00 2001 From: Tim Sutton Date: Mon, 9 Jan 2017 02:37:05 +0200 Subject: [PATCH 4/4] Fix typo --- development/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/development/README.md b/development/README.md index d9357f4..cd0c369 100644 --- a/development/README.md +++ b/development/README.md @@ -335,7 +335,7 @@ Press clone to make a copy and in the copy set it up with the following options: * **Device type:** desktop * **Device:** Local PC * **Sys root:** Leave blank -* **Compiler:** Cache for Clang (x86 64bit in /usr/bin) +* **Compiler:** CCache for Clang (x86 64bit in /usr/bin) * **Environment:** click ‘Change …’ and add this to your python path so sip can be found: ``export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.6/site-packages``