C++ Weekly - Ep 376 - Ultimate CMake C++ Starter Template (2023 Updates)

Поделиться
HTML-код
  • Опубликовано: 16 янв 2025
  • НаукаНаука

Комментарии • 41

  • @PedroOliveira-sl6nw
    @PedroOliveira-sl6nw Год назад +14

    The hero we needed!

  • @ranseus
    @ranseus Год назад +11

    This is tens of thousands of dollars worth of work. Jason's just earned the "Legend" accomplishment in my mind.

  • @oracleoftroy
    @oracleoftroy Год назад +2

    I'm really glad for the move back to one repo. I based a few projects after the original version and every once in a while I check back to see if there are any new warnings or features, etc, I want to pull into my code, and was really confused when I tried to figure out where everything when to. I'll definitely have to pour over the new version and see what I want to incorporate, there were a few features in the old version that I didn't need or wasn't sure how to make use of at the time that would be useful now.

  •  Год назад +1

    I've tracked the development of this template for some time now. Great work

  • @maciejhaj5789
    @maciejhaj5789 Год назад +1

    Love your work, thanks!

    • @cppweekly
      @cppweekly  Год назад

      That's a complicated question that depends a lot on the specific size of the array you are accepting.

  • @Luca-yy4zh
    @Luca-yy4zh Год назад

    Great work. Very useful. Thanks.

  • @MichaelCaisse_ciere
    @MichaelCaisse_ciere Год назад +3

    Love the change to CPM!

  • @allNicksAlreadyTaken
    @allNicksAlreadyTaken Год назад +10

    Why is there no link to this repo in the video description?

  • @josueherrera3455
    @josueherrera3455 Год назад

    This is incredible

  • @not_ever
    @not_ever Год назад +1

    I appreciate the simplification compared to the old project. Thanks for making this.

    • @cppweekly
      @cppweekly  Год назад

      Thanks, it's one of those things that took a couple of years to really understand what was needed.

  • @ibrahimkhattab2468
    @ibrahimkhattab2468 Год назад

    I didn’t understand what the purpose of the packaging maintainer mode, because I didn’t find it any where else in the project or on internet. Can you explain it please? It would very helpful, if you make a video going through the cmake template explaining it more in detail. Thank you very much.

    • @cppweekly
      @cppweekly  Год назад

      It disables most static analysis and turns off "warnings as errors" so that the tooling gets out of your way if you simply want to build/use/package the project.
      Most people say you should opt into those things. But in my experience, if you have to opt in, most people will not. So I made the tools the default, and make you opt out of them by enabling packaging maintainer mode.

  • @oschonrock
    @oschonrock Год назад +17

    Now all we need is a proposal paper to the appropriate ISO Committee for std::cmake_template ;-)

    • @embeddor3023
      @embeddor3023 Год назад +6

      I am ready to sell one kidney if this will make them standardize any build system really.

    • @oschonrock
      @oschonrock Год назад +2

      @@embeddor3023 Yes of course you are right... But don't you mean: "I would be prepared to DONATE one kidney if that made them standardize an easy to use build system"? ;-)

    • @eggmeister6641
      @eggmeister6641 Год назад +1

      @@oschonrock No, if I'm going to be pissing at half capacity, I'm getting paid for it.

    • @anon_y_mousse
      @anon_y_mousse Год назад

      @@eggmeister6641 Sounds fair, but unfortunately you can't sell kidneys, legally.

    • @eggmeister6641
      @eggmeister6641 Год назад

      @@anon_y_mousse In the US*

  • @Key_Capz_
    @Key_Capz_ Год назад +3

    No vcpkg?

    • @cppweekly
      @cppweekly  Год назад +1

      Nope, I was going for minimal startup effort

  • @jioferno
    @jioferno Месяц назад

    I'd love some more in depth explanation like in the Ep 208. I can see that the new template brings a great value, but I feel somehow lost comparing with the previous. Maybe I'm not into the right target audience (?).
    Great job anyways, thank you!

  • @allNicksAlreadyTaken
    @allNicksAlreadyTaken Год назад +3

    Why did you remove conan?

    • @not_ever
      @not_ever Год назад +4

      "move from Conan to CPM (better control over build flags, less likely to accidentally have ABI/ODR issues)" This is from the git commit that removed Conan.

    • @vorrnth8734
      @vorrnth8734 Год назад

      @@not_ever Hm, but cpm is no full replacement for conan, at least right now.

    • @not_ever
      @not_ever Год назад +1

      @@vorrnth8734 I didn't say it was. I just copied a commit message.

    • @vorrnth8734
      @vorrnth8734 Год назад

      @@not_ever Yeah right. I just still wonder he replaced it with a non replacement.

    • @cppweekly
      @cppweekly  Год назад +1

      Because conan was too fragile in this environment. The build system was breaking every few months without my touching anything. Either conan would change, or a recipe would change, or a dependency would change...

  • @LargeDivisor
    @LargeDivisor Год назад +4

    There are lots of things about this project template that I like, but at 4:40, I really need you to tone down the sarcasm. It’s been 10 years and 4 standard updates since C++ Seasoning, and although the algorithms library is still underutilized, it is still not a silver bullet, nor does it cover everyone’s use case perfectly all of the time. Honestly, I don’t have any problem with _GLIBCXX_ASSERTIONS in principle, as long as the compiler can optimize the runtime checks appropriately, but please stop acting like we deserve to have our code pessimized for having the nerve to use indexed access on a vector or calling get() on a smart pointer.

    • @oracleoftroy
      @oracleoftroy Год назад

      You aren't wrong, but I don't think Jason is wrong either. If you are doing an operation over the whole container, you really should use ranged for loops or an algorithm. That doesn't mean you are forced to only used the standard blessed algorithms, that's obviously unworkable, but you should consider writing your own where the standard lacks something you need. The idea is to think in terms of ranges/iterators, not indexes, because iterators can't be out of range (well, unless you forget to check for end() or do something really silly with them). When you do have a one off access for a single value, sure that will be slower in theory, but you ought to be doing a range check anyway, and a lot of the time the compiler should see that redundant range check and eliminate them.
      That said, in practice it is definitively a feature I'd like for debugging and optimized builds with debug checks enabled, but I'd want the option to turn it off.

  • @anon_y_mousse
    @anon_y_mousse Год назад +1

    I don't hate cmake, but I would prefer just about anything over it. I kind of like the idea behind nobuild and would like to extend some of the ideas from it. Granted, it couldn't be used for languages other than C or C++, but I suppose someone could translate it if they wanted to. The biggest advantage would be that it would be its own dependency. As long as you have a compiler it would be usable on your system.

    • @vorrnth8734
      @vorrnth8734 Год назад +1

      Really? When it came out it was such an improvement over autothell. It has its flaws but at least one system is drastically inferior.

  • @AusSkiller
    @AusSkiller Год назад

    I've never had a good experience with CMake, half the time I end up needing to just make the projects from scratch instead because CMake doesn't work or doesn't configure things properly and needs hours/days to manually hand edit files to get it to do what it was supposed to.

  • @marcbotnope1728
    @marcbotnope1728 Год назад +3

    -1 For no conan

  • @patho97
    @patho97 Год назад

    thanks! feeling somewhat supid now, i added sdl3 to cpm and it added it fine, but when i try to build my project it looks like static analysis runs also on third party stuff..
    /cmake-build-debug-visual-studio/_deps/sdl3-src/include\SDL3/SDL_bits.h:78:16: error: implicit conversion changes signedness: 'unsigned long' to 'int' [-Werror,-Wsign-conversion]
    is this intended? or did i do something wrong?

    • @cppweekly
      @cppweekly  Год назад +1

      Yes, I'm working on fixes to some of those things on my personal projects. We do need to set up CPM *before* we set up our own warnings and analysis to avoid that kind of problem.