cmake
tutorial: include-what-you-use for a cmake/mingw-build on win
tl;dr:
0. Get the latest prebuilt version for Win: version 0.8 (3 years old :/)
1. Put this somewhere into you CMakeLists.txt
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "C:\\include-what-you-use\\bin\\include-what-you-use.exe")
2. Enjoy the overflowing build-output for your legacy-project.
advanced whitespace-correction
(for CMake/C++-projects)
Find all fitting files and run the fixer-script in parallel over it.
1 |
( find . -name "CMakeLists.txt" ; find . -name "*.cmake" ; find . -name "*.h" ; find . -name "*.cpp" ) | parallel --bar ../removeTrailing.sh |
After playing for a while with sed and awk and not being able to get a fitting solution, I decided to create my own as python-script. It squashes all consecutive double-whitespace-lines (and adds one to the end if missing).
Or “run it on the files changed for the last commit”:
1 |
$ git diff --name-only HEAD~1 HEAD | parallel --bar ../removeTrailing.sh |
Sources:
removeTrainling.sh
squashMultipleWhitespace.py
How to get GNU parallel (developed by Ole Tange):
1 |
(wget -O - pi.dk/3 || curl pi.dk/3/ || fetch -o - http://pi.dk/3) | bash |
Updating to the current package of Qt Charts (from the commercial version)
Qt (or Digia? or how was the company-owning-Qt called at that time?) released in 2014 the version 1.4 of their Charts add-on for Qt. It was available only for the commercial-license and had some distinc namespace-requirements. And was also quite bare-metal.
Further development lead to more opportunities regarding the emitted signals for the cursor-handling (pressed/released instead of just clicked, for instance) and it became part of the regular package for Qt.
## Advice for a CMake-based project ##
If you want to maintain and upgrade your legacy code, then:
- add “Charts” to your find_package:
1find_package(Qt5 COMPONENTS Widgets Charts REQUIRED) - change the namespace inside the CMakeLists from “former naming” to “Qt5::Charts”
- remove the dependency to the old package in the top-level CMakeLists.txt
- replace inside the h/cpp all occurences of “QtCommercialChart::” with “QtCharts::”
- replace inside the h/cpp all occurences of “QTCOMMERCIALCHART_USE_NAMESPACE” with “using namespace QtCharts;”
- update the installer-creator-script(s) to include the Qt5Charts.dll
Et voilà , it should build now.
Retrospective view at 2018
The first month of 2019 already passed. And we passed it with flying colors!
But let’s have a look at 2018 – a year full of challenges and success: I’ve worked full-time, organized and participated in advanced courses for Python and in Requirements Engineering (officially: IREB Requirements Engineering Foundation Level-approved) and pursued a new employment as software engineer.
And I wrote some software in my spare-time, as you can see in the graph for the public github-repositories. The gaps in the commits can be explained with the birth of my daughter and the time where I acquired the new job and moved nearly 900 km across the country. Yay! Nice personal projects were and are Cullendula and the Daily Coding Challenges, which I solve mostly with fully Unit-tested Python (3).
More new, hands-on knowledge was gained in the area of CMake and Qt-charts.
Well – 2018 was great. Let me make 2019 greater! 💪
Linux Mint 17.3: upgrade CMake
Ok, cmake 2.8 was installed – I need 3.0. At least. For C++11 features.
The good old Ubuntu-forum helped. This is the condensed version:
1 2 3 4 |
sudo apt-get install software-properties-common sudo add-apt-repository ppa:george-edison55/cmake-3.x sudo apt-get update sudo apt-get upgrade |