wasi-libc icon indicating copy to clipboard operation
wasi-libc copied to clipboard

Migrate build system to CMake

Open loganek opened this issue 2 years ago • 6 comments

I understand that a great thing about Makefile (versus CMake) is less dependencies. However, I see it comes with its own limitations, like not great Windows support, lack of ninja build (if that's preferred) or a bit obscure syntax (although that's very subjective). I've seen a PR https://github.com/WebAssembly/wasi-libc/pull/154/ although that seemed abandoned. Not sure if there was any reason for that or was it simply lost of interest? I'd be happy to pick up the work and finish it unless there was a reason to keep Makefiles.

loganek avatar Sep 04 '22 21:09 loganek

I think its fairly subjective. The windows support is probably the most significant reason to switch. But also, non of those issues are really blocking progress or holding is back right now so it doesn't seem like we should be prioritizing this.

sbc100 avatar Sep 05 '22 09:09 sbc100

@sbc100 thanks for the comment. I agree that doesn't block any of the development, but it might slightly improve development experience as well (e.g. https://github.com/WebAssembly/wasi-libc/issues/156). Given there are no objections, I might pick up the branch and update the PR (or create a new one, if I'm unable to update the existing one) - otherwise, I'll keep the issue open so others can work on at one point of time.

loganek avatar Sep 06 '22 12:09 loganek

As you might have guessed I'm not a huge fan of cmake.. but I don't know of any good alternatives. I would imagine that converting to cmake could make things more/needlessly complex, but if you can find a way to do it without too much extra complexity and without loosing in features, then I don't block it.

The fact the the previous attempt stall makes me things it could be somewhat challenging.

sbc100 avatar Sep 06 '22 13:09 sbc100

I support migrating to CMake. I'm not familiar enough with CMake enough to be of much direct help, but I'm happy to answer any question about what the current Makefile is doing.

sunfishcode avatar Sep 06 '22 16:09 sunfishcode

One more usage for Cmake is CPM: add all dependencies including was-libc, llvm#{cxx,c++abi,compiler-rt}, third-party libs and everything gets cross compiled nicely.

Work seems to be stopped, so maybe I could help to finish this. A couple of questions:

  • right now cmake files added out-of-sources: is there any strong reason to do in that way instead of place CMakeLists.txt directly next to source files in each directory?
  • are there any other issues/requirenments/notes not mentioned in the #330 review?

xphoenix avatar Feb 16 '24 08:02 xphoenix

@alexcrichton and I were just talking about this. Like @sbc100, I was originally more inclined here and in wasi-sdk to stick with the "tried and true" Makefile approach but there's good reasons to switch to CMake: (1) it does make the Windows build experience more robust and (2) the Makefile approach only makes sense to me when the build is simple — both wasi-sdk and wasi-libc may be complex enough now to justify CMake.

abrown avatar Apr 16 '24 19:04 abrown