-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
[perfetto] initial port of 43.1 #37959
Conversation
@microsoft-github-policy-service agree company="ALIARO" |
I've only directly tested the output on Linux x64, but I have no reason to believe it will not work in other environments. |
How much overlap has this port with an official ( |
@dg0yt one of the outputs of the official build is the pair of amalgamated source files we're consuming, which are attached to each tagged release (e.g. for 43.0). This greatly simplifies the build process, and matches the example built with CMake.
Maybe, but I've not verified Perfetto's functionality when built into a shared library and presumed we could enable it later if needed without breaking compatibility. If this is a blocker for the initial port let me know and I'll happily investigate. |
Looks like it is. I'll get a fix pushed shortly. |
d8596fc
to
b2332d8
Compare
@WangWeiLin-MV I've squashed the proposed changes into the original commit and added you as a co-author for it. This should be ready for another review. |
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.
Port usage tests pass with following triplets:
- x64-linux
- x64-windows
- x64-windows-static
- x64-windows-static-md
- x86-windows
7486698
to
2d80dbd
Compare
Hi @rtzoeller, We generally aim to use upstream's build configurations directly and only resort to providing unofficial exports when integrating with upstream would involve extensive patching or customization that doesn't seem justifiable. Could you share your rationale for opting for an unofficial CMake export instead of adapting Perfetto's existing Meson build for vcpkg? I'm not deeply familiar with Meson and its intricacies, so your insights would be very valuable to me and perhaps highlight aspects I might not be aware of. Thanks for your contribution and looking forward to your thoughts! |
Thanks for the insight @JavierMatosD.
I wasn't previously aware of any existing Meson support in Perfetto (the source comment referring to Meson came from @WangWeiLin-MV); the primary build instructions only mention GN as a build system, although the repo also provides an example of using CMake to consume the amalgamated source files. In my usage of Perfetto I've always consumed the amalgamated SDK source files (e.g. for v43.0), and given the example CMake build this was the most approachable option. I'm also trying to integrate vcpkg into a CMake project which would consume the perfetto dependency, so it was a natural fit. I now see that there is a
I have zero familiarity with Meson, so please bear with me as I attempt to rework this PR. 😄 |
At first glance the existing Meson support appears to be rather incomplete. AFAICT, it only supports building a static library and does not install any headers (but does include the @JavierMatosD can you please advise on which direction is acceptable for moving forward? Thanks!
|
@JavierMatosD @WangWeiLin-MV I looked at what it would take to port this to use the Meson build; the results are here. It still needs to be cleaned up (and building as a shared library is still an unknown), but my primary takeaway was that using the Meson build costs us the automatic CMake integration for clients -- I still needed to write an |
Big thanks for diving into the integration options! I'm initially leaning towards the unofficial CMake route because it seems super practical for now. But, I want to run it by our team to double-check we’re all on the same page for the long haul. I’ll circle back with you as soon as we've made a decision. Really appreciate your patience and all the effort you're putting into this! |
This port has no dependencies. So providing an unofficial CMake config shouldn't be more difficult to write by hand than a whole vendored CMake build system. If meson doesn't already provided official pkg-config files. |
@data-queue, @ras0219, @vicroms, @BillyONeal, and I discussed this and based on the CMake usage in Perfetto’s upstream example here, we agree that adopting CMake is appropriate. This approach is supported by the example provided by the library developers and aligns with our existing tools, avoiding the complexities and maintenance challenges associated with using GN. |
) | ||
|
||
set(THREADS_PREFER_PTHREAD_FLAG TRUE) | ||
find_package(Threads REQUIRED) |
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.
Should Threads
be listed as a dependency?
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.
I'm unsure what you mean here aside from what's asked in the other comment.
Should PThreads be a dependency (or feature) in the vcpkg.json?
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.
The lib pthread
is a system library, it just requires the find_package
, and it will only be used on NON-WINDOWS. The checks in upstream https://github.com/google/perfetto/blob/v43.1/include/perfetto/ext/base/thread_checker.h#L22-L24.
endif(WIN32) | ||
|
||
if(MSVC) | ||
target_compile_options(perfetto PRIVATE "/permissive-") |
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.
Why is this needed?
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.
To be clear that turns off permissive mode (note the minus), and puts MSVC into standards-compliant mode.
I wasn't able to get it to fail without this flag as part of the automated build, but my recollection from previous usage is that it's needed for older MSVC versions (2017?).
It's in the recommended set of flags for using the tracing compiler:
# Enable standards-compliant mode when using the Visual Studio compiler.
if (MSVC)
target_compile_options(example PRIVATE "/permissive-")
endif (MSVC)
I can remove it if you want!
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.
If it's not strictly required we should remove this. Thanks for the explanation!
Never mind. I think we should just follow upstreams recommendation here. :)
Setting the PR to draft. Please mark ready for review when you've responded. That way I will know you've responded |
Co-authored-by: WangWeiLin-MV <156736127+WangWeiLin-MV@users.noreply.github.com>
endif(WIN32) | ||
|
||
if(MSVC) | ||
target_compile_options(perfetto PRIVATE "/permissive-") |
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.
If it's not strictly required we should remove this. Thanks for the explanation!
Never mind. I think we should just follow upstreams recommendation here. :)
"license": "Apache-2.0", | ||
"supports": "!uwp & !x86", | ||
"dependencies": [ | ||
"pthreads", |
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.
"pthreads", | |
{ | |
"name"" "pthreads", | |
"platform": "!windows" | |
}, |
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.
@JavierMatosD Are you serious about this? Almost no port does this, but almost every non-trivial port uses pthreads.
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.
Serious about what exactly? Adding the platform expression or adding it as a dependency?
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.
Do we really request a pthreads
dependency on platforms where the port is empty and where most ports don't use the dependency and where depending ports don't need to be rebuilt when the windows-only implementation is updated?
### Change - Upgrade `perfetto` version to [v44.0](https://github.com/google/perfetto/releases/tag/v44.0) - Remove dependency `pthread` because the lib is a system library which just requires the `find_package` and will only be used on NON-WINDOWS. The checks in upstream [perfetto/ext/base/thread_checker.h#L22-L24](https://github.com/google/perfetto/blob/v44.0/include/perfetto/ext/base/thread_checker.h#L22-L24) - Remove the `x86` exclusion from #37959 (comment) ### Checklist - [x] Changes comply with the [maintainer guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md). - [x] SHA512s are updated for each updated download. - [x] The "supports" clause reflects platforms that may be fixed by this new version. - [ ] ~Any fixed [CI baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt) entries are removed from that file.~ - [ ] ~Any patches that are no longer applied are deleted from the port's directory.~ - [x] The version database is fixed by rerunning `./vcpkg x-add-version --all` and committing the result. - [x] Only one version is added to each modified port's versions file. ### Test Port usage tests pass with following triplets: * x64-linux * x64-windows * x64-windows-static * x64-windows-static-md * x86-windows
find_package
calls are REQUIRED, are satisfied byvcpkg.json
's declared dependencies, or disabled with CMAKE_DISABLE_FIND_PACKAGE_Xxx.vcpkg.json
matches what upstream says.vcpkg.json
matches what upstream says../vcpkg x-add-version --all
and committing the result.