C++ Weekly - Ep 208 - The Ultimate CMake / C++ Quick Start

Поделиться
HTML-код
  • Опубликовано: 28 авг 2024

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

  • @rinkaenbyou4816
    @rinkaenbyou4816 4 года назад +35

    I can't wait to see Jason's game dev project with all his c++ best practices!

  • @superscatboy
    @superscatboy 4 года назад +40

    I dream of a day when all this work somehow gets magically bundled together into a single tool with sane defaults that works in 99% of cases out of the box with a simple command and little to no configuration.
    In the mean time, this is excellent, thank you.

    • @jeanapolo8960
      @jeanapolo8960 3 года назад +2

      Keep dreamin' with most of these tools, some assembly is required...

    • @UseQPixinDune
      @UseQPixinDune 3 года назад +5

      @@jeanapolo8960 Rust has shown that it can be done

    • @leonmunster8972
      @leonmunster8972 2 года назад +1

      @@jeanapolo8960 """"""""SOME""""""""

    • @SteinCodes
      @SteinCodes 2 года назад

      Well you could have a template project, with some scripts to handle all this, I have my own because I create lots of use and throw projects.

  • @ali51717
    @ali51717 3 года назад +8

    the week I found your Channel was the week you released this video, at that time I didn't understand a single thing about this video.
    it is very happy for me to say I finally made it to the point that I understand (almost everything) that was said in this video.

    • @opticalmouse2
      @opticalmouse2 10 месяцев назад

      I'm pretty sure you're exaggerating...by a lot or you're lying. It's a very poor video that teaches nothing.

  • @novarem9828
    @novarem9828 4 года назад +39

    And this is why so many people dump on C++. A language where simply setting up a project could take a few days.

    • @wizardy6267
      @wizardy6267 4 года назад +2

      And you must not interested why FB has even more complex setting up so they can put c++ code in PHP~

    • @rastopyakin
      @rastopyakin 3 года назад +13

      The complexity of build setup depends from how complex your project is. If it's intended to be maintained for years then I don't see any problem in spending a few days to tune the build process and make further development easier. Complexity comes from flexibility, and, of course, for a hello-world-like project you don't need any complex setup.

  • @sndrb1336
    @sndrb1336 4 года назад +8

    I wish there will be a debugger setup video that is as concise and thorough. Thank you for this, it is massively helpful.

  • @johnconstantine5861
    @johnconstantine5861 3 года назад +11

    Thanks Turner, I was on the edge of giving up on C++ & CMake and you pushed me right over the edge...smooth. I'm sorry if there're any typos in my comment, there is blood coming out my eyes and my vision is compromised. As I fall into depression and as a final act of sodomy I tried to give you a thumbs down and report your video. But due to impaired vision I ended up hitting 'Subscribe' and the 'Bell' icon. Nothing is going my way...

  • @leanidchaika
    @leanidchaika 4 года назад +2

    Nice! You are in right direction! Show peaple as mush as you can, let more C++ culture studying for all!

  • @fgiraffe8751
    @fgiraffe8751 4 года назад +5

    This was very useful, thank you! One suggestion would be to walk through the steps you went through when adding one of these features to a Make system, because in my (limited) experience that starts to feel like playing whack-a-mole with the errors.

  • @diarmaidmac2149
    @diarmaidmac2149 4 года назад +30

    Appreciate the video Jason. I dabbled a little with CMakelist files in the past but I find them just like C++ - a verbose mess (and I really like programming in C++). Life does not need to be this difficult, there is no excuse in this day and age. I have since moved to Rust and cargo and have zero intention of using C++ for future projects. More time developing and less time hacking away at cmake files!

  • @Razyelgore
    @Razyelgore 4 года назад +7

    Cannot wait for the Game-development one, I was in the Bucharest EA audience.

  • @FlorianWolters85
    @FlorianWolters85 4 года назад +6

    What most devs do not understand is that CMake is not a build system. It is a tool that allows to create a build system and imo the C++ ecosystem needs a defacto convention-over-configuration build system created with CMake. Too many dev hours have been wasted already writing crappy CMake code and reinventing the (build) wheel.

    • @leonmunster8972
      @leonmunster8972 2 года назад

      To be absolutely honest, building c++ is one of the most frustrating things to do. I don't want to know how often I told msvc to create a dll only for it to still create a exe or just a lib. Just because the flags were in the wrong order, but no one tells you what the correct order is.
      It got to the point where in personal projects I don't even bother with anything remotely fancy and just create a single .cpp and all the code gets dumped into somewhat organized header files. That makes one line in a batch file that gets copied into every single project and every thing works(until you want to have a lib or something).

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

    This is pure gold for me. Thank you!

  • @xavierthomas1980
    @xavierthomas1980 4 года назад +8

    It would be interesting to make this all work with a custom tool-chain. I suppose it works OK using a CMake tool-chain file targeting the build platform/arch however when cross compiling I expect some qemu and test framework trickery to be required.

  • @0day694
    @0day694 4 года назад +3

    Thank you, Jason! This is exactly what I needed.

  • @thejeffkershner
    @thejeffkershner 4 года назад

    I just purchased the professional cmake book and the first paragraph of the first chapter really speaks to me.

  • @xavierthomas1980
    @xavierthomas1980 4 года назад +11

    So much complicated boilerplate, this is definitely the part of C++ that sucks most. Having a template/skeleton helps a lot, thanks. I would love to see a equivalent for build2. I know it is not seeing much adoption but it looks like a more decent and future proof solution and having more documentation to help novices get started can only help.

    • @afborro
      @afborro 4 года назад +1

      Meson seems so nice and easy to use in comparison. If on linux I would avoid cmake if at all possible. The only thing that lets meson down are the relatively poor help docs. That's what happens I guess when you let the developers write the Docs :D bad idea !

    • @frydac
      @frydac 4 года назад

      Not sure why to avoid cmake, it is a good tool to invest time in to learn and works without issues on linux, and it is not that complicated, docs are much improved, ok it's not pretty, just avoid using it for all scripting/automation tasks that are not purely build related.

    • @afborro
      @afborro 4 года назад

      @@frydac I am doing just that because some project I am working are cmake based. I came from meson to begin with. cmake is great for cross platform I get the impression and for windows, which my latest work is going to be, so I'll not use meson.
      If it's linux only though I will stick with meson, it's so simple to use most of the time, the ability to include subprojects is simple, so it just compiles on any linux platform without having to install libraries assuming they exist on the platform , instead it just downloads them as repos and builds from there ( including cmake based ones).
      All one then needs installed on any platform is python and meson, and a C++ compiler. I wonder how easy that is to achieve in cmake. I expect from what I've seen thus far there will be a loooot of boiler plate.

    • @humm535
      @humm535 4 года назад

      I just use pretty generic Makefiles.

  • @bobbymah2682
    @bobbymah2682 4 года назад +2

    Great video! Its like a Effective CMake, thanks!

  • @FlorianWolters85
    @FlorianWolters85 4 года назад +2

    Instead of using INTERFACE targets for compile definitions and compile options one should use a CMake toolchain file. This allows separation of concerns, e.g. adding support for a new compiler with a specific version is done by adding a new toolchain file to the build system.

    • @cozycactus
      @cozycactus 11 месяцев назад

      is there some fork with your proposals?

    • @FlorianWolters85
      @FlorianWolters85 11 месяцев назад

      @@cozycactus What do you mean? Toolchain files are a CMake feature for a very long time. My answer (from three years ago) was about best practices, not missing features. Hope this helps understanding my answer better.

    • @cozycactus
      @cozycactus 11 месяцев назад

      @@FlorianWolters85 i mean your answer mentioned that he doesn't use concept of toolchain files when choosing different compilers, that's why i asked

  • @FlorianWolters85
    @FlorianWolters85 4 года назад +1

    Project specific CMake options should use a common prefix, e.g. MYPROJECT_ for this example. Otherwise problems will occur sooner or later if using other CMake projects with the add_subdirectory command.

  • @rafalmichalski4893
    @rafalmichalski4893 4 года назад +20

    Hello Jason, Could you point me configuration for your nvim and console setup to have this colourfull view ?

    • @macxfadz
      @macxfadz 4 года назад +1

      ruclips.net/video/XSeO6nnlWHw/видео.html

    • @macxfadz
      @macxfadz 4 года назад +1

      www.google.com/search?client=opera&q=install+zsh+oh+my+zsh+on+windows+terminal&sourceid=opera&ie=UTF-8&oe=UTF-8

    • @mindkeep4yt
      @mindkeep4yt 4 года назад +1

      I found: github.com/lefticus/nvim-config, but haven't tried it.

    • @cppweekly
      @cppweekly  3 года назад

      This is the right answer, and it's updated somewhat regularly

  • @yogxoth1959
    @yogxoth1959 4 года назад

    Ohh, can't wait for that game dev series!

  • @antoniocs8873
    @antoniocs8873 4 года назад +1

    Haven't used conan before, always used vcpkg... but this seems quite good. Reminds of how a dependency manager should work (as it does in other languages), you have a file where you specify your dependencies, you run the dependency manager and it gets it for you. vcpkg is great but it doesn't have that... maybe I should invest sometime learning conan.
    Also... this seems huge for just starting a project... not saying things aren't necessary but it seems to have soooo much stuff and you haven't written any code yet.. maybe it's just me that has been out of the c++ stuff for a while.. Nice video

    • @anticrisis9006
      @anticrisis9006 4 года назад

      There's a not that well documented feature of vcpkg that I use: put dependencies in a text file 'packages.txt' one per line, then run 'vcpkg install @packages.txt'

    • @antoniocs8873
      @antoniocs8873 4 года назад

      @@anticrisis9006 hhumm think I heard someone mention something like that, but can you also version the packages?

    • @anticrisis9006
      @anticrisis9006 4 года назад

      Antonio Cs you use git to version the vcpkg instance you are drawing from. You can include vcpkg as a submodule in your project/solution directory if you want finer control, or a forked clone if you need to pin certain packages while continuing to git pull upstream updates. Basically use the tools git gives you for version control.

  • @atimholt
    @atimholt 4 года назад

    You ought to use doctest instead of catch. It's much faster to compile, for one thing. So much so, the home page encourages putting your tests directly into your source, for their value as documentation.

  • @maciejhaj9934
    @maciejhaj9934 4 года назад

    Incredibile work! Thanks Jason!

  • @MindGameArcade
    @MindGameArcade 4 года назад +3

    This video is an instant classic, this is what is missing currently in cpp, mature tools brought together to cover all needs. And cpp was lagging behind, as opposed to something like C#, but seeing this video so well put together shows that cpp is going to be the best and very very easy to use. Like if this trend continues cpp might be the ultimate thing, tons of new features from the new cpp versions that makes it easy to read etc. maximum cross platform compatibility for everything (running, developing, etc.), a thousand harness for learning best practices and safe code, tons of libraries, etc. etc.Cpp might not have been the best but it's trying hard to be. Dependency management is a big thing for example, I have yet to try Conan, need to learn it. Fast compile time, performances, everything!

  • @GIJOEG36
    @GIJOEG36 4 года назад

    I'm about to write a project generator script using python.
    I am really tempted to base my project template on the starter project.
    I got good milage out if this before and I really like it.

  • @pablom695
    @pablom695 2 года назад

    I just discovered this channel and this is great content, thanks. I am surprised though that you do not disable the spelling on all cmake/cpp files, I would find very annoying the underline on each word!

  • @louislebel2995
    @louislebel2995 2 года назад +1

    This is something I just can't understand at the moment: why does it take 400+ lines of cmake code, plus I-don't-know how much more from other configuration files, just for an empty c++ project? why does it have to be complex? why isn't all of this configuration (or some variation of it) and the tools used here (or any alternative thereof) the default value? why isn't setting up these tools easier? I would neeeever eeeever have been able to get all of this to work in my bedroom alone from scratch. It doesn't make sense at all for me.

  • @mcharest24
    @mcharest24 4 года назад

    Lovely. The part where are always get stuck, is with Conan. Says you want to use some special compiler option to activate profiling or sanitizer, or to pass it down to any/all of conan's project?

  • @KobiCohenArazi
    @KobiCohenArazi 4 года назад

    Thanks Jason!

  • @paulm.bendixen6682
    @paulm.bendixen6682 4 года назад

    Great update

  • @dan-vw4ve
    @dan-vw4ve 4 года назад

    Do you need to do `make clean` every time you change a flag? Great video and resource btw

  • @nivo6379
    @nivo6379 4 года назад

    ccache can be installed on windows using:
    choco install ccache

  • @meharjeetsingh5256
    @meharjeetsingh5256 9 месяцев назад

    So much best practice that the project never starts. But I know it’s important it’s just sad imo

  • @marcomarmelade3769
    @marcomarmelade3769 3 года назад +1

    feels like total over-kill to me, but idk probably I am just 1000 lvls below turner-land

  • @ie71773
    @ie71773 4 года назад

    Jason, how do you generate the coverage report to make it part of the pipeline? Can it be done within CMake?

  • @sndrb1336
    @sndrb1336 4 года назад

    what is your opinion on code completion ?
    I like it when it is there, but I'm not annoyed when I can't have it.

  • @karlherbig4669
    @karlherbig4669 4 года назад

    Love it! Can't wait for the game dev series :)
    Also can you publish your nvim/init.vim, or maybe to a small episode of your favorite most used nvim plugins?

    • @konstantinsenkevich4727
      @konstantinsenkevich4727 4 года назад +1

      there is neovim repository at his github page with the configuration files.

    • @karlherbig4669
      @karlherbig4669 4 года назад

      @@konstantinsenkevich4727 Thx for the hint! :)

  • @tominikolla2699
    @tominikolla2699 2 года назад

    The title is missleading. This was the Ultimate Cmake Quick End. Prerequisite for this video are proficiency in CMake and a good does of faith on a dozen tools that are used.
    I came for basic CMake in 30 minutes while I am eating breakfast and waiting for my doughter to be ready for Kindergarden.

  • @slipcurve1410
    @slipcurve1410 4 года назад

    seems to work with cmake 3.13 (ubuntu repos default)

  • @fastdude7
    @fastdude7 3 года назад

    Does a link to the base cpp project exist?

  • @abdopower5913
    @abdopower5913 4 года назад

    did u have any advices for beginners who want to start learn C++ 😁

    • @ryanwilson8629
      @ryanwilson8629 4 года назад +1

      Jump in, start a project and learn as you go.

  • @willofirony
    @willofirony 4 года назад +3

    Could you, possibly, pin this video to your home page? I suspect I will have occasion to refer to it many times.

  • @milanky
    @milanky 4 года назад

    If you are an absolute beginner, and want to learn CMake, you can go through the paid lecture series at
    www.udemy.com/course/master_cmake/?couponCode=CMAKE1398

  • @mytech6779
    @mytech6779 9 месяцев назад

    Do you have much experience with Meson?

    • @cppweekly
      @cppweekly  9 месяцев назад

      0 experience with Meson.

    • @mytech6779
      @mytech6779 9 месяцев назад

      ​@@cppweekly Rats. I'm trying to find a good comparison with cmake, from someone who actually knows cmake. I don't do enough development to justify learning both.
      Most of what I find reviewing Meson is from people implying that cmake was just too complex or heavy for them to bother with (Implying they don't know much about cmake).
      Meson has a pretty good tutorial website, I just can't juxtapose it with cmake due to my own lack of experience.

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

    What is the terminal used here ?

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

      Bash + powerline-shell

  • @PaulMetalhero
    @PaulMetalhero 4 года назад

    Please talk about 2D Graphics, OpenGL 3.3, shaders and Lua scripting

  • @it_cpp54
    @it_cpp54 4 года назад

    Could you please give me some kick in right direction? I checkout project from github. install cmake 3.16, clang 9, ccache. enter in source directory, call make and see error no targets. ccmake . shows me "empty cache".

    • @IllumTheMessage
      @IllumTheMessage 4 года назад

      Same.

    • @IllumTheMessage
      @IllumTheMessage 4 года назад

      Got it now. Ensure you have conan installed. Make a build directory, go in to it, run cmake ..

    • @it_cpp54
      @it_cpp54 4 года назад

      @@IllumTheMessage Thank you. A little bit better. )
      I found another git prj github.com/gabime/spdlog
      I like description there. Finally manged to compile from cli

    • @it_cpp54
      @it_cpp54 4 года назад

      @@IllumTheMessage I tried as well to compile in Clion. I need to configure path to conan as well. ccmake output a little bit different in compare what I see in cli. And error:
      make[2]: *** [src/CMakeFiles/intro.dir/build.make:87: bin/intro] Error 1
      make[1]: *** [CMakeFiles/Makefile2:229: src/CMakeFiles/intro.dir/all] Error 2
      make[1]: *** Waiting for unfinished jobs....
      [100%] Built target tests
      make: *** [Makefile:95: all] Error 2

    • @it_cpp54
      @it_cpp54 4 года назад

      @@IllumTheMessage spdlog project compiled in CLion as well. ;) (comment for Jason)

  • @chrisgoebel
    @chrisgoebel 4 года назад

    One thing that really bothers me about Cmake is that you include these various cmake macros and functions that you make from the primary CmakeLists file, and then you actually use things that are defined in the primary CMakeLists file inside the things you include. It feels backwards to me... feels like bad design. But every Cmake project I've ever seen inevitably is forced to do stuff like this. Feels like we are forced to invert our dependency graph. I realize that the truth is that everything is at the same level, but I hate it.

  • @lucazfc
    @lucazfc 4 года назад

    Are you planning to make a 2D or 3D engine? Since there are already plenty of 2D engines out there it would be nice to make a 3D one, even though it would take more time. There are also several 3D engines out there but it seems to me that the number of 2D engines is greater than the number of 3D ones. If a random internet dude's suggestion has any value, I think a 3D engine with 2D focus would be very nice since I haven't seem this anywhere yet. What I mean is a normal 3D engine which has out-of-the-box some 2D facilities like orthographic camera projection, pixel-perfect texture alignment on screen and spatial transformations without anti aliasing, that is, without creating pixels with colors not present in the original texture, without interpolating colors and creating colors outside the texture palette. Usually 3D engines only care about 2D much later in its lifetime, like with Unity or Unreal, so it would be nice to have a 3D engine with 2D focus right out of the box.

  • @sander_bouwhuis
    @sander_bouwhuis 4 года назад +2

    Although I appreciate the work you put into this video, I don't see myself using this. This is like going back to 1970-1990 will all those make files and hundreds of options. I was just happy to be rid of them, and now they are making a comeback? I strongly prefer a user interface with information about each setting (e.g., like MSVC compiler and linker settings).
    Are people really expected to create all these setting files and decide on all those options?
    You have successfully dissuaded me from using CMake :)

  • @josephgoebbels1605
    @josephgoebbels1605 4 года назад +3

    I USE ARCH BTW

  • @therenaissance8322
    @therenaissance8322 4 года назад +1

    Where's the game project!?

    • @xavierthomas1980
      @xavierthomas1980 4 года назад +1

      It is there: github.com/lefticus/cpp_weekly_game_project But I suppose a (series) of C++ Weekly episode(s) will come when it is ready.

  • @AbstractObserver
    @AbstractObserver 3 года назад

    Great, dont work in any way in my computer :D I just love the shitshow that is trying to setup a new dev environment

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

    Very poor and unclear

  • @aj-uo3uh
    @aj-uo3uh Год назад

    Very bad structured video, bla bla bla first ten minutes and still no structure.