Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added msvc-clang tools #343

Merged
merged 1 commit into from
Nov 26, 2023

Conversation

leidegre
Copy link
Contributor

@leidegre leidegre commented Nov 11, 2023

Now that Microsoft is actually distributing Clang as part of Visual Studio you can use clang instead of Visual C++ when you want to. There's more than one way to do this and I've just taken the easy path here to get something going.

In this first iteration, I've used the clang-cl and lld-link frontends because it allowed me to reuse the msvc base. This might not be desirable as the whole point of using clang is to gain access to clang features while this could be nice to have I'm wondering if people wouldn't rather see a more native clang interface?

With that said, given the following tundra.lua:

Build {
  Configs = {
    {
      Name = "win64-clang",
      DefaultOnHost = "windows",
      Tools = {
        "msvc-clang"
      }
    }
  },
  Units = {
    function()
      Program {
        Name = "test",
        Sources = {
          "test.cc"
        }
      }

      Default("test")
    end
  }
}

...we can build this program:

#include <cstdio>

int main()
{
  printf("clang version %s\n", __clang_version__);
  return 0;
}

...which will output:

clang version 16.0.5

Toughts?

@deplinenoise
Copy link
Owner

I see no reason to not add this

@leidegre
Copy link
Contributor Author

leidegre commented Nov 16, 2023

Okay, let's go! I've used this a little and it works well enough, if anyone runs into any issues using this let me know I'll happily fix 'em. Just let me figure out why there's a conflict, shouldn't be there...

@leidegre leidegre marked this pull request as ready for review November 16, 2023 08:54
@leidegre
Copy link
Contributor Author

leidegre commented Nov 16, 2023

Okay, looks like the conflict is gone now.

Bare in mind that this will only work if the clang tools are installed with the Visual Studio version and product you are targeting. There's no nice error message if you forget about this, you just get a command clang-cl not found error or similar. And since it is based on the msvc-latest tools it can be configured the same way.

@emoon
Copy link
Contributor

emoon commented Nov 16, 2023

I will try to give this a spin as as I can get to it.

@deplinenoise deplinenoise merged commit 1ad7a28 into deplinenoise:master Nov 26, 2023
3 checks passed
@deplinenoise
Copy link
Owner

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants