4 ms·
I actually just tried to play around with what seems to be a "modern c++" boilerplate project. It uses CMake, conan for packaging, clang-tidy and cpp-check, an
by rjzzleep 4y ago
I actually just tried to play around with what seems to be a "modern c++" boilerplate project.
It uses CMake, conan for packaging, clang-tidy and cpp-check, and has templates for fuzz and unit testing[1].
I found it because qtcreator and kdevelop were weirdly clunky and created partly broken qt projects and I figured I wanted to add a package manager and qt to the mix.
The template looks really fancy, but it's so incredibly slow, to the point of being unusable.
It's a ramble yes. But the point is modern C++ tools seem to have added some niceties to the language, but they also brought more of the main C++ issues, i.e. slow compile times and nasty boilerplate in the build process. Yes, I realize CMake isn't modern and there are a bunch of new build tools.
[1] https://github.com/cpp-best-practices/gui_starter_template https://github.com/cpp-best-practices/gui_starter_template
- P5fRxh5kUvp2th 4y agoI wouldn't put much stock into such starter templates, the developer who put them together has a goal and priorities that are not yours. QT tends to be particularly painful outside of QTCreator so I also wouldn't use that as a general knock against C++. having said that, C++ build times are slow due to both the #include mechanism and templates. The C++ modules coming will help deal with the #include mechanism and templates can be instantiated to assist the compiler. None of it is amazing, but the compile times are better than rust imo.
- Night_Thastus 4y agoC++ modules has been promised for a long time, I wouldn't hold my breath on it coming anytime soon. As for build times, it is sadly very easy in C++ to have long build times. Avoiding it takes careful work, knowing when and what to include, when to forward-declare instead, and always maintaining includes as requirements change, etc. There's nothing to make that process any easier or automatic, which is very frustrating. There's the include-what-you-use project, but I could never get it to work.
- P5fRxh5kUvp2th 4y agoI was under the impression C++ Modules were accepted in C++20, although I'm not sure how complete the implementations are. But yes, C++ build times are why I'm not a fan of header-only libraries, especially ones that have templating in them.
- bogwog 4y agoThat is the most bloated boilerplate project I've ever seen. Does anyone actually use this for their projects? I would hope not. I know Javascript people are used to starting a project with a template/boilerplate, but that's not a good idea in C++ land. You actually need to understand the stack you're using, and all of the tools (unless you're working on a team, in which case that could be someone else's responsibility) Also, QT projects aren't real C++ since they require an additional preprocessor to compile custom syntax additions for "signals" and "slots". As a consequence, tooling for those projects tend to be more complicated and clunky. This linked project seems to be trying to stuff as many things as they possibly can into a hello world project. With Conan + CMake you only need like 3 files total in your entire project for something like this: * conanfile.txt: for declaring requirements/dependencies * CMakeLists.txt: describe how to compile your project * main.cpp: source code for the hello world app Also, > Yes, I realize CMake isn't modern and there are a bunch of new build tools. No!! That thinking is a trap. CMake is modern, and using something else is more likely to cause problems for you and anyone who might want to use your project. That boilerplate's is a bad example. A fully functional SDL2 hello world with Conan can be done with a ~4 LoC CMakeLists.txt. Unless you have a very good reason (there are good reasons, but they're the exception rather than the rule), don't build your C++ project with anything other than CMake.