Software Engineering

random thoughts

cmakepp: Expression Syntax

Discussion of an Alternative Syntax for CMake

Modern CMake Slides

I’ve held a Presentation about “modern CMake” at the C++ Meetup in Wiesbaden a week ago and wanted to share the slides with the Internet. I try to highlight the parts of a CMake project which I consider as modern (I guess there is room for interpretation here) I give a small introduction to CMake command line, script mode and then mostly about targets, scoping etc. Of course you cannot hear my voice but maybe the slides themselves can give you some insight.

cmakepp: reflecting and manipulating CMakeLists

The basic CMakeLists.txt files for cmake based projects are usually very simple. Their manipulation lends itself to be automated and for this purpose I developed a parser for cmake script which allows you to manipulate it programatically from within cmake itself. On top of the cmake script parser I generated utility functions which allow you to manipulate CMakeLists.txt files while still allowing you to manually working on them. This functionality is wrapped by a command line interface which I present to you in this post.

cmakepp: Template Generation in CMake

Find it at http://github.com/toeb/cmakepp Download cmakepp standalone file here As with all my work I appreciate all feedback given and am particularly happy about virtual internet points 🙂 To the Post: While working on the documentation of cmakepp I grew wary of always doubling the documentation – one in the source code and a mirror in the README.md. Also I was frustrated when I refactored and renamed functions or changed signatures which is not uncommon – especially when working on a new feature.

Heterogeneous Package Search and Retrieval in CMake

Finding and Retrieving third party sources, tools and binaries is currently a hot subject for C++. There are quite a few solutions (biicode, cpm, hunter, …) Also there is github, bitbucket, source balls etc. Further there are many package managers for many different platforms which also can contain packages (apt-get, chocolatey, nuget, npm, pip, ….). So everything is very decentralized and heterogeneous. On the other hand there is CMake the standard when it comes to creating platform independent projects for various build and developer environments.

Parallel Processes in CMake

If you need to check out multiple large repositories or build and install large separate projects you might want to use parallel processes in CMake. Dividing your tasks to use multiple CMake and or other processes can speed up your build and configuration steps immensely. Since all cmake host OSs support multitasking from the command line it is possible to use cmake to contol them in turn. Using this approach I implemented a ‘platform independent’ control mechanism for starting, killing, querying and waiting for processes.

CMake and the Filesystem

Discussion of an Alternative Syntax for CMake

CTest and TextExplorer

Motivation I have long searched for an extension in VisualStudio which allows you to control kitware’s CTests via the Test Explorer. Since no such thing existed I have developed a workable proof of concept myself :D. This software is currently not in its finished state, It still needs polishing because it can be slow and is not well tested. However it works so if you want to give it a ride – go ahead.

Renameable Namespaces using the Preprocessor

Renameable Namespaces using the Preprocessor

Alternative `typedef` Syntax

An Alternative typedef Syntax using the C++ Preprocessor

Dynamic Object in C++

You can find my implementation at https://github.com/toeb/cppdynamic it is licensed under the MIT license. I’d be happy for feedback and or optimizations :) Dynamic object are useful, especially in rapid prototyping, non-performance critical situations, and situations in which data/functions -bags are needed (non schema specific data). Also when serializing and deserializing dynamic objects can be a very valuable asset. Dynamic programming languages inherently support this. e.g. var obj = {}; obj.

Useful extensions for CMake

Initial Draft of cmakepp

dynamically calling `any` thing in C++

Extending upon boost’s any class which stores a type and a void ptr to any type of value, I created a callable version were you can assign any function, lambda, memberfunction etc. to the any and call it dynamically. This is a basic and important step for runtime reflection which I’m currently working on. Tell me if you like what I did and if you have any improvements. You can look at the running example at ideone

`is_callable` type trait

I’ve developed a type_trait for checking if a type is callable, ie has defined a single operator(). Also on ideone Tell me if you like it or if you know of a better version :D /// function traits for member functions // gives you the class_type, return_type and arguments tuple for any member function (const and not const) template<typename T> struct func_traits{ static const bool is_const_call = false; typedef void class_type; typedef void return_type; typedef void args_tuple; }; // specialization for non const call member functions template < typename TClass ,typename TRet, typename .

cmakepp: Reading and Writing JSON

While working on a package manager for CMake I came across the problem of finding a suitable format for my package descriptor files. First I thought about and tried using plain old CMake file that simply sets variables and can be included to access its contents. It was very quick and easy to implement. Hierarchical data structures however where hard to implement and a none standard format makes it harder to exchange data with a webservice/other programs.

Object Oriented CMake: Next Iteration

New Version of Cmakepp, old blogpost

Objects and Maps in CMake

Get it at https://github.com/toeb/oo-cmake and tell me if you like it For more complex build system features oo programming would be a major boon. So I took it upon myself to create a usable and tested oo-extension for cmake (in pure CMake) so I could continue developing and extending my plattform independent tooling support (cutil) . It’s too bad that Kitware decided to use their own language (with very little high level language features) for their build system product because CMakes project generation capabilties are unparalleled .

Normalized Attribute Names in Angular

I have been doing some hard directive/ html markup work and I came across a problem where I needed the normalized html tag attribute names. (I was trying to create a html element but needed access to the normalized names without turning it into a directive) Angular.js normalizes names like “test-name” and “data-test-name” to “testName”. So I went ahead and extracted and wrapped the functions needed into the following function:

Enabling MVC5 intellisense in a ClassLibrary Project

...

Typescript in V2013

How to enable Typescript Compilation for a VS2013 Class Library Project

A Fluent Way of Exception Handling

Strategies to handle exceptions

Parsing Web Asset Files

To parse versioned web asset filenames ala jquery-1.4.min.js I wrote a simple class /// <summary> /// simple class for describing a file library like /// jquery-1.4.min.js /// bootstrap.min.css /// libname-1.0.0.0.tag1.tag2.tag3.extension /// ... etc /// contains methods for parsing these kind of filenames /// </summary> public class FileLib { /// <summary> /// regular expression for parsing the filename /// </summary> public static readonly string libRegex = @"((?<libname>[^.-]*)-?)((?<major>d+))?(.(?<minor>d+)(.(?<revision>d+)(.(?<build>d+))?)?)?(.(?<tags>.+))*"; /// <summary> /// parses a path as a lib /// </summary> /// <param name="path"></param> /// <returns></returns> public static FileLib ParsePath(string path) { var filename = Path.