-
Notifications
You must be signed in to change notification settings - Fork 136
Building on Windows - CMake? #87
Description
I tried to compile mrustc a couple of times now for windows (my work machine), but unfortunately I did not succeed.
Stuck on VS2015's compiler
The build only works with the Compiler from VS2015 (v140), which is what is set inside the projects. When switching the setting to VS2017 (v141) or Clang, the build is missing zlib, which is supposedly pulled in via NuGet. It seems that there is no zLib-package on NuGet for v141 so the build just fails when including a zlib-header.
I am not too experienced with NuGet on C++ and I could not find a workaround for that (manually downloading zlib would work I suppose).
Wrong directories for 32-bit target
When trying to compile as 32-bit, VS complains about not finding common.lib, even though it is being built. The problem here is that the library output location for a 32-bit build of common.lib does not match the location of the 64-bit build.
Unresolved externals to HIR::ExprPtr::get_mir_or_error_mut and others
There is a call to HIR::ExprPtr::get_mir_or_error_mut in cleanup.cpp, inside MIR_CleanupCrate. The linker complains about it not finding get_mir_or_error_mut, which I could not find the reason for.
I can grab the exact build error when I'm at work again next week, but I remember VS looking for a function with __cdecl-calling convention, when it should rather be a __thiscall...
No CI for Windows
The excellent AppVeyor provides CI for Windows builds free of charge for Open Source-projects. Is there any reason this has not been set up yet other than "nobody bothered yet"? If the latter is true, I would go ahead and set it up if I can get the windows build going on my own machine.
Switch to CMake?
Right now, the project ships with makefiles and a Visual Studio solution. If you think it would be worth a try, I would set up CMake for mrustc to see if it would make building easier for all platforms.
If you have never worked with CMake, here are some features which I think could help the project from the top of my head:
- One of the most used build-systems in the C/C++ world these days
- Not depending on any IDE or compiler
- Cross-platform downloading files with checksum-tests
- Streamlines build process on each platform
- Can generate "install"-targets which makes packaging easy