by 38 · 3y ago · 0 comments
go build
and it just works. all the needed packages are automatically downloaded and built, and fast. same process for Rust and even Python to an extent. my understanding is C++ has never had a process like this, and its up to each developer to streamline this process on their own. if thats no longer the case, I am happy to hear it. I worked on C/C++ code for years, and at least 1/3 of my development time was wasted on tooling and build issues. I dont ever want to deal with that again.The community hasn't standed still, conan and vcpkg + cmake are already quite good.
Not my case. I have simple CMake files for my projects and have no problems building on Linux and Windows (I do not do Mac). I do use few libraries (Postgres, network - http/tcp/udp and some others). So far no troubles. I do remember it was way more complicated though. So I am not really missing "Rust eating C++'s lunch". I do understand there are some real life huge insanely complex projects with basillion options. Luckily I do not havbe to deal with that part.
I've cloned 5 year old C++ repos that use cmake and it's quite an effort to build them, mostly due to finding all the dependencies correctly versioed.
That’s a little too harsh. You can certainly make it do that via a combination of git tags (to build from source) and CMake modules/Find*, but yes, it’s much more cumbersome than cargo/npm/go
This is why other C++ build systems like Bazel and Meson added Rust support, since Cargo/build.rs itself isn't sufficient enough for all use cases (especially when using it alongside with other systems languages.) And it's not too wild for something to think of adding Rust support for CMake as well...
And if it's not that big, say, a single C file, you can just invoke the C compiler. An example: https://crates.io/crates/cc
So far the best thing that I've seen in wildlife for c/c++ code is just outsourcing everything into docker container with build tools, that you have with qmk: https://docs.qmk.fm/#/getting_started_docker. It has it's downsides, but it's just 2 commands to have built binary, one of which is to clone git repository.
I really had high hopes for Bazel, that they will either package or reuse some standard build tools configurations and just let use them by referencing them in single place in workspace, and the rest is going to handled by build system, but it doesn't seems like this is how it does work now and will work in observable future. If you want it this hermetic, you need to do it on your own.
In that case I would just use the rust toolchain which I'm sure can handle this stew.
Its too complex of a problem to be solved by a committee with competing interests.
Dependencies can mostly be managed with vcpkg and its CMake integration. The only real problem is when you need something that's not in vcpkg and have to write your own port overlay.
It's not perfect, but the situation is vastly better than it was ten years ago.
I read about a C++ package manager written by Microsoft few years ago, maybe it's now somewhat usable?