-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Add emscan-deps tool #21987
base: main
Are you sure you want to change the base?
Add emscan-deps tool #21987
Conversation
aac0fd4
to
b85c465
Compare
This is wrapper around clang-scan-deps. Currently this is just enough to make C++20 work under cmake. We don't currently have any actaully tests of C++20 modules. See: emscripten-core#21042 Fixes: emscripten-core#1361
|
||
"""emscan-deps - clang-scan-deps helper script | ||
|
||
This script acts as a frontend replacement for clang-scan-deps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script acts as a frontend replacement for clang-scan-deps | |
This script acts as a frontend replacement for clang-scan-deps. |
@@ -0,0 +1,13 @@ | |||
// Copyright 2011 The Emscripten Authors. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Copyright 2011 The Emscripten Authors. All rights reserved. | |
// Copyright 2024 The Emscripten Authors. All rights reserved. |
@@ -0,0 +1,17 @@ | |||
#!/usr/bin/env python3 | |||
# Copyright 2019 The Emscripten Authors. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Copyright 2019 The Emscripten Authors. All rights reserved. | |
# Copyright 2024 The Emscripten Authors. All rights reserved. |
Is it actually necessary to have the em-foo wrapper? Is there some reason we can't just tell CMake the location of the clang-scan-deps tool directly? |
The problem with that is that I can't find a way to make clang-scan-deps know about the emscripten include paths in that case. Perhaps there is some way to make it work, but I don't really know how clang-scan-deps works. |
I've been wondering for a while if it made sense to just teach clang directly about the emscripten include paths. We already have an emscripten triple. I would imagine clang-scan-deps just uses the same logic, but I also don't really know how clang-scan-deps works. |
But how would clang know where the emscripten sysroot is without being told like this in the wrapper? |
I think it might make sense for CMake to pass the sysroot and triple flags. This solution of course wouldn't generalize to other build systems, and we might want to keep passing those in emcc, but I think CMake still passes those flags in some other contexts so it wouldn't be too weird. That might be enough to make scan-deps work. |
I don't think cmake has enough information to figure that stuff out. It doesn't know where the sysroot it is. It could probably run emcc to figure that out? But also I'm not sure it is able to pass cflags only to scan deps do it would end up passing them everywhere.. which would be redundant. emcc doesn't need a sysroot flag so why both to calculate one and pass it in? Ultimately I think we will need to figure out a better / deeper way to integrate with scan-deps, but this approach seems like a reasonable step one. |
Actually I meant having CMake have the information about the sysroot in our toolchain file (since that already has alll the special knowledge about emscripten/emsdk) do it for both clang and scan-deps. Then if we wanted to, we could remove that from emcc and/or be one step closer to not needing emcc at all at compile time. But yeah in the near term it would be redundant. I'm kind of ok with this as a short-term solution, mostly I'm just noting that it goes the opposite direction we want to go in long term. |
FYI the "Fixes" github reference is wrong, it should probably be #21866 Any chance this could land as a temporary fix for newer cmake? :) |
This is wrapper around clang-scan-deps. Currently this is just enough to make C++20 work under cmake. We don't currently have any actaully tests of C++20 modules.
See: #21042
Fixes: #21866 #22305