-
Notifications
You must be signed in to change notification settings - Fork 10
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
CMake-based build and build-to-AAR support #26
base: main
Are you sure you want to change the base?
Conversation
OK, this is all ready to go. Let me know if you need the copyright/license statements adjusted, I just went with my default which is CC0-1.0 for "meaningless"/"basically config" files, and BSL-1.0 (more or less maximally permissive) for the other added files, all with SPDX tags. If it simplifies the process of getting this mainlined, though, I can modify the license statements to the more restrictive apache-2.0 for integration's sake. BTW - This also provides the ability to create a "prefab" AAR file for use with Gradle-built NDK apps. You could push these (in CI or otherwise) to the GitHub packages repo, or maven central, or elsewhere at your option. |
One minor question: Since 0.1.6, should the percetto lib be build as a shared library rather than static, always? |
5182e03
to
0d40049
Compare
OK, now it's a shared library and it can also be used from another CMake project easily, regardless of whether that cmake project is being run by Gradle in an android build, or a desktop linux build. |
@rpavlik your work is so awesome. Really hope this PR can be merged, and we can get percetto aar with prefab support for complicated native Android project. |
Hi @rpavlik, a couple questions below. Also we want to keep in mind that an official perfetto C API is in the works, so perCetto is more of an interim library. Generally I am not a fan of maintaining multiple build systems for projects as one or the other build files tend to regress. No way to build the aar with meson? For NDK usage, why not use the C++ perfetto SDK directly? |
Oh interesting, glad to hear there's an official C API coming. I have not looked into building an AAR with Meson - it's not a supported build system for Android so it would be a lot of work. (The AAR with CMake even was a lot of work, since the aar-authoring things in android gradle plugin don't work quite right so the scripts are basically hand-assembling the AAR. Fortunately I had recently done an AAR for another CMake based project so I already had some open source code for it, that is known and tested good.) In NDK usage: We're building a cross-platform app that has a strong C-first bias (particularly in inter-module APIs), which is why we went with perCetto. Is there any known timeline for the official C api? (Should we just be vendoring this project for now?) |
For ease of integration with Gradle, etc. I had put together this CMake-based build. This builds on #17 (which turned out to still be necessary - it looks like it varies by platform for ndk builds). Thanks to @utzcoz I was able to drop the other patches from this PR.
This also gives you the ability to build AAR files with "prefab" metadata so they can be consumed by Gradle-based Android projects, with just
./build-aar.sh
.