<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <?xml-stylesheet href="/s/inc/rss.xsl" type="text/xsl"?>
    <rss version="2.0"  xmlns:atom="http://www.w3.org/2005/Atom">
        <channel>
            <title>RSS feed for tag cmake on Raymii.org</title> 
            <link>https://raymii.org/s/tags/cmake.xml</link> 
            <description>RSS feed for tag cmake on Raymii.org</description>
            <atom:link href="https://raymii.org/s/tags/cmake.xml" rel="self" type="application/rss+xml" />
    
            <item>
                <title>Logging all C++ destructors, poor mans run-time tracing</title> 
                <link>https://raymii.org/s/software/Logging_all_Cpp_destructors_poor_mans_run-time_tracing.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/software/Logging_all_Cpp_destructors_poor_mans_run-time_tracing.html</guid>
                <description>I recently faced a challenging issue with an application that wasn't shutting down correctly, either segfaulting or terminating without an active exception. Running the program via `valgrind` to check for memory leaks wasn't possible because the program couldn’t perform its cleanup if it didn't shut down correctly. This article covers adding runtime instrumentation provided by `gcc` to log destructors. This helped me figure out what was still left over from the closed-source framework in use preventing correct shutdowns or causing segfaults. It includes example code, setup instructions and insights into handling shutdown issues in large, multi-threaded codebases.</description> 
                <pubDate>Sat, 21 Sep 2024 23:59:00 GMT</pubDate>
                <lastBuildDate>Sat, 21 Sep 2024 23:59:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Qt Property Macro (Q_PROPERTY with 95% less code)</title> 
                <link>https://raymii.org/s/blog/Qt_Property_Macro_Q_PROPERTY_with_95_percent_less_code.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/blog/Qt_Property_Macro_Q_PROPERTY_with_95_percent_less_code.html</guid>
                <description>Adding [properties to QObject based classes](https://web.archive.org/web/20240529180113/https://doc.qt.io/qt-6/properties.html) is cumbersome. Although [the property system](https://web.archive.org/web/20240529180113/https://doc.qt.io/qt-6/properties.html) and [Signals and Slots](https://web.archive.org/web/20240529180002/https://doc.qt.io/qt-6/signalsandslots.html) are great to use, especially with QML, it takes a lot of boilerplate code to add such properties to a class, at least 15 to 20 lines for each property. I've cobbled up a macro that saves you about 95% of lines when using a `Q_PROPERTY`. (22 lines to 1 line).</description> 
                <pubDate>Wed, 29 May 2024 22:00:00 GMT</pubDate>
                <lastBuildDate>Wed, 29 May 2024 22:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>A docker image for Qt 5.15 LTS for Android, including OpenSSL and the KDE patch collection</title> 
                <link>https://raymii.org/s/blog/Qt_5.15_LTS_Docker_Image_for_Android_with_OpenSSL.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/blog/Qt_5.15_LTS_Docker_Image_for_Android_with_OpenSSL.html</guid>
                <description>Recently I got an email from Google regarding the API level of [Leaf Node Monitoring](https://leafnode.nl), my open source monitoring app for Windows, Linux and Android. The Play Store version must be updated to target API level 33.
For Windows and Linux I'm building the app automatically in a CI environment but the Android build was still a manual process. Until now, because after a bunch of messing around with Android NDK versions, OpenSSL library paths and Qt compile flags I can automatically build Leaf Node Monitoring in my CI.

I'm using Woodpecker CI and that requires every build step to be executed in a Docker image. There are a few Qt docker images floating around but they are all using the pre-built 5.15.2 version by extracting it from the Qt Online Installer. That version is quite old, 5.15.15 LTS was released [a few days ago for Commercial License Holders](http://web.archive.org/web/20230902132649/https://www.qt.io/blog/commercial-lts-qt-5.15.15-released) on August 31, so after 1 year it will become available as open source.
My docker image builds Qt from source using the `5.15 KDE Qt Patch Collection` branch for Android and it includes OpenSSL. This is as far as I know the most up to date docker image for Qt 5.15, currently at 5.15.10 LTS.</description> 
                <pubDate>Wed, 13 Sep 2023 22:00:00 GMT</pubDate>
                <lastBuildDate>Wed, 13 Sep 2023 22:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Add moc includes to speed up Qt compilation</title> 
                <link>https://raymii.org/s/blog/Qt_add_moc_includes_to_speed_up_compilation.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/blog/Qt_add_moc_includes_to_speed_up_compilation.html</guid>
                <description>The Meta-Object Compiler, `moc`, handles Qt's C++ extensions and it is required for signals and slots and properties in Qt. `moc` reads C++ header files and if the `Q_OBJECT` macro is used, it generates an extra `.cpp` file named `moc_filename.cpp` containing extra (meta-object) code. This post has a bit of background information and a shell script to automatically include `moc_*.cpp` files in your code whenever `Q_OBJECT` is used. If you use `qmake`, this will probably speed up your build and if you use `cmake`, this will probably speed up incremental builds (when `CMAKE_AUTOMOC` is `on`).</description> 
                <pubDate>Mon, 12 Dec 2022 00:00:00 GMT</pubDate>
                <lastBuildDate>Mon, 12 Dec 2022 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>QT / QML Signals and Slots with C++</title> 
                <link>https://raymii.org/s/snippets/Cpp_QT_QML_Signals_and_Slots.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/snippets/Cpp_QT_QML_Signals_and_Slots.html</guid>
                <description>QT has an Observer mechanism built in, which they call '[Signals and Slots](https://web.archive.org/web/20210210180603/https://doc.qt.io/qt-5/signalsandslots.html)'. It allows objects to communicate with each other without having to have knowledge of either ones internals. By inheriting from `QObject` and defining a few `Q_PROPERTY` macro's, the QT Meta Object Compiler (`moc`) does all the hard work for you.
Inside a C++ class this all works handy dandy and is reasonable easy to follow, but when using QML it requires a bit more work. This small example shows you how to bind QML and C++ together using signals and slots, in QT 5.12.</description> 
                <pubDate>Thu, 25 Feb 2021 00:00:00 GMT</pubDate>
                <lastBuildDate>Thu, 25 Feb 2021 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>C++ std::async with a concurrency limit (via semaphores)</title> 
                <link>https://raymii.org/s/tutorials/Cpp_std_async_with_a_concurrency_limit.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/tutorials/Cpp_std_async_with_a_concurrency_limit.html</guid>
                <description>std::async is an easy way to do multiple things concurrently, without the hurdle of manual thread management in C++. Like batch converting images, database calls, http requests, you name it. Create a few 'std::futures' and later on when they're ready, '.get()' 'm while they're still hot. A 'future' is an object which handles the synchronization and guarantees that the results of the invocation are ready. If you '.get()' it and it's not ready, it will block.
Recently I had a use case for concurrency with a limit. I needed to do hundreds of HTTP calls to a JSON API. The concurrency limit was not for the hardware, but for the server on the other side. I didn't want to hammer it with requests.
There is no standard way to limit the amount of concurrent jobs via 'std::async'. You can fire of a hundred jobs and it is up to the implementation to not fry the hardware. On linux/gcc it will probably use a thread pool so you're lucky, but you cant assume that.
This article will show you a simple short solution to implement a concurrency limit together with std::async, by using a semaphore, implemented with modern (C++ 11) standard library features ('std::mutex', 'std::condition_variable' and such). It also has a C++ 17 version which replaces our custom CriticalSection class with the use of an 'std::scoped_lock' and 'BasicLockable'.
We start off with a shorter example showing how to fire off a set number of jobs and wait until all of those are finished before continuing. That is very useful if you have a set number of jobs and want the implementation to handle all the thread work for you.</description> 
                <pubDate>Sat, 09 Jan 2021 00:00:00 GMT</pubDate>
                <lastBuildDate>Sun, 10 Jan 2021 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Hacker News vs Lobste.rs in C++, an exercise in parsing json http api's and date/time/timezones</title> 
                <link>https://raymii.org/s/software/Cpp_exercise_in_parsing_json_http_apis_and_time_stuff.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/software/Cpp_exercise_in_parsing_json_http_apis_and_time_stuff.html</guid>
                <description>I recently wondered how many top posts on the Hacker News frontpage are also on Lobsters. At first I reached for my trusty Python, because when I need to do some JSON API parsing that's what I'll use. (Otherwise bash is my default goto for small things, except when json, networking or associative arrays are involved.) But, then, a thought came to my mind. Why not try it with reasonably modern C++. It's what I do at work, so why not a simple personal project. It would involve dependency management (json and a http library), parsing both API endpoints and, most importantly, doing stuff with time. Time, timezones and dates are hard. This article contains a bit of my learning process, compilation and usage instructions and an example run. Go look at the code and run the code yourself. Let me know if my timezone calculations are working outside of GMT+1.</description> 
                <pubDate>Thu, 31 Dec 2020 00:00:00 GMT</pubDate>
                <lastBuildDate>Thu, 31 Dec 2020 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>C++ set up cpp-httplib with SSL support with cMake</title> 
                <link>https://raymii.org/s/tutorials/Cpp_set_up_cpp-httplib_with_ssl_support_with_cmake.md.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/tutorials/Cpp_set_up_cpp-httplib_with_ssl_support_with_cmake.md.html</guid>
                <description>For a small personal project that talks to a few JSON API's and does some data parsing I needed a header only C++ HTTP library. Header only because that is the simplest way to include it in my project, just copy and paste the file. I came across the project cpp-httplib, which fits my needs, does all the http methods, small, a few examples and it looks modern and has recent development commits. Setup and getting it working was easy, but as soon as I tried an https url, I got an exception ('https scheme is not supported.'). This guide shows you how to setup cpp-httplib for SSL support with cmake. It took me a bit longer than I wanted to set it up correctly, so why not save you the effort.</description> 
                <pubDate>Mon, 14 Dec 2020 00:00:00 GMT</pubDate>
                <lastBuildDate>Mon, 14 Dec 2020 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>CookieNumberPrinter, incremental / idle game style numbers in C++</title> 
                <link>https://raymii.org/s/software/CookieNumberPrinter_incremental_game_style_numbers.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/software/CookieNumberPrinter_incremental_game_style_numbers.html</guid>
                <description>To level up my software development skills, I'm programming a command line game in my spare  time.  It is a clone of the famous cookieclicker game by ortiel. A clone of a game is simple enough to get up and running  fairly quickly, but also extensible enough when needed. How do you store huge score numbers  when they don't fit in a long long? How do you write a game loop, how to use threads to handle  user input? Saving a game (how to design a proper save format)? Also a great way to learn about project organization, software architecture and to try out design patterns. As the game is a clone of CookieCliker, which itself is an incremental game, I had to figure out how to work with large numbers. Since this is not a university math project, I allowed myself the luxury of using Boosts Multiprecision.  The library handles the large numbers, including caluclation and operations with such a number. I did want to print the numbers in Idle Style, where large numbers are displayed with a suffix, like '1 million' instead of '1000000' and so on. This 'C++' class can be used to print Boost's 'cpp_dec_float' numbers in incremental style. It's just one header.</description> 
                <pubDate>Sat, 12 Sep 2020 00:00:00 GMT</pubDate>
                <lastBuildDate>Sat, 12 Sep 2020 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Generate QR code and write it to a PNG, scaled, in C++</title> 
                <link>https://raymii.org/s/software/Cpp_generate_qr_code_and_write_it_to_png_scaled.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/software/Cpp_generate_qr_code_and_write_it_to_png_scaled.html</guid>
                <description>The QR-Code-Generator library by Project Nayuki for C++ gives you an easy, fast and correct way to generate QR codes. However, you get just a data structure, showing that data is up to you. An example is provided to print the code to a terminal, but not to create and actual image file. For Java, there is an example provided which writes a PNG file, but not for C++. The author of the library also has another C++ library, Tiny-PNG-Out. It is correct up until 700 megapixel PNG files, which I hope your QR code never hits. I've written a class which bridges the two together, allowing you to both generate the QR code and write it to a PNG file, scaled up to be as readable as possible.</description> 
                <pubDate>Sun, 07 Jun 2020 00:00:00 GMT</pubDate>
                <lastBuildDate>Sun, 07 Jun 2020 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Github Actions, C++ with Boost and cmake, almost a 50% speedup with caching</title> 
                <link>https://raymii.org/s/articles/Github_Actions_cpp_boost_cmake_speedup.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/articles/Github_Actions_cpp_boost_cmake_speedup.html</guid>
                <description>For a personal project I use Github for source code hosting and Github Actions as an automated build and test tool. Github Actions compiles my cmake project and runs all the unit tests on every commit. It also saves a build artifact, the actual compiled program. By utilizing some dependency caching and make flags I sped up the build process by 43% by caching the apt install libboost1.65-dev and giving cmake a -j2 makeflag. This article shows my simple setup to compile a C++ project with cmake and Boost on Github Actions. After compilation, it runs all the tests and uploads the compiled binary for download. For my one man project it's overkill, but when collaborating or when builds take a long time on your own machine, it's great to have an automated build / test system.</description> 
                <pubDate>Wed, 27 May 2020 00:00:00 GMT</pubDate>
                <lastBuildDate>Wed, 27 May 2020 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>C++ async, threads and user input</title> 
                <link>https://raymii.org/s/articles/Cpp_async_threads_and_user_input.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/articles/Cpp_async_threads_and_user_input.html</guid>
                <description>For an unrelated piece of code, I recently spent a few days trying to figure out if there was a portable, modern C++ way to handle user input with a timeout. If there is no input after a few seconds, the program can continue doing other things. TL;DR, there is none, since stdin is blocking I/O. At the end of the article I'll also provide the code I ended up using, which uses two actual big-boy threads, one for input and one for 'other work'.</description> 
                <pubDate>Fri, 24 Apr 2020 00:00:00 GMT</pubDate>
                <lastBuildDate>Fri, 24 Apr 2020 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>Run CLion native on Android, ditch your desktop!</title> 
                <link>https://raymii.org/s/blog/Run_CLion_on_Android.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/blog/Run_CLion_on_Android.html</guid>
                <description>How often do you read articles that state that people have replaced their main computer with an iPad and are fully content? Now, how many of those articles just use a linux server (vps) somewhere with some native apps, but mostly SSH to that server? Well, what if I told you that you can run a full blown IDE, the best IDE for C++ there is, CLion by JetBrains, on Android? Including compiling, just native GCC, CMake, GDB and all the stuff you are used to? Just for fun I've installed CLion on an old Samsung Tab S2 I had lying around, using Ubuntu in a chroot. It works way better than I'd expected, with a Bluetooth keyboard and mouse it's almost as if your on a desktop. I wonder if you could run Android Studio and use the tablet to compile app's for itself. This article shows some photo's, including a mechanical keyboard, different window managers and had instructions to replicate this setup.</description> 
                <pubDate>Fri, 27 Dec 2019 00:00:00 GMT</pubDate>
                <lastBuildDate>Fri, 27 Dec 2019 00:00:00 GMT</lastBuildDate>
            </item>
    
            <item>
                <title>C++ project setup with CMake &amp; unit tests (google test)</title> 
                <link>https://raymii.org/s/tutorials/Cpp_project_setup_with_cmake_and_unit_tests.html?utm_medium=rss&amp;utm_source=raymii&amp;utm_campaign=tagrss</link> 
                <guid>https://raymii.org/s/tutorials/Cpp_project_setup_with_cmake_and_unit_tests.html</guid>
                <description>This guide will show you how to setup a new C++ project with CMake and unit tests via Google's test framework. With this setup you can get started right away with test-driven-development in C++. It is also simple enough to look and figure out how to add gtest to your existing project and start doing TDD on your legacy (existing) codebase.</description> 
                <pubDate>Tue, 01 Oct 2019 00:00:00 GMT</pubDate>
                <lastBuildDate>Wed, 06 Nov 2019 00:00:00 GMT</lastBuildDate>
            </item>
    
        </channel>
    </rss>
    
    