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

CMake-based build and build-to-AAR support #26

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

rpavlik
Copy link
Contributor

@rpavlik rpavlik commented Jan 24, 2022

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 .

@rpavlik rpavlik marked this pull request as draft January 24, 2022 17:40
@rpavlik rpavlik marked this pull request as ready for review January 24, 2022 18:38
@rpavlik
Copy link
Contributor Author

rpavlik commented Jan 24, 2022

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.

@rpavlik rpavlik changed the title Initial CMake-based build, Android build fix Initial CMake-based build Jan 24, 2022
@rpavlik rpavlik changed the title Initial CMake-based build CMake-based build and build-to-AAR support Jan 24, 2022
@rpavlik
Copy link
Contributor Author

rpavlik commented Jan 24, 2022

One minor question: Since 0.1.6, should the percetto lib be build as a shared library rather than static, always?

@rpavlik rpavlik force-pushed the cmake branch 2 times, most recently from 5182e03 to 0d40049 Compare January 24, 2022 19:33
@rpavlik
Copy link
Contributor Author

rpavlik commented Jan 24, 2022

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.

This was referenced Jan 24, 2022
@utzcoz
Copy link
Contributor

utzcoz commented Jan 25, 2022

@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.

@utzcoz
Copy link
Contributor

utzcoz commented Feb 15, 2022

Friendly ping @olvaffe @batesj . The AAR for percetto is very important for Android's native app to trace important steps with tracked timestamp. The tracing APIs I found at NDK are limited to me. Could you help take look at @rpavlik 's PR. I really want to this feature too. Thanks.

@batesj
Copy link
Collaborator

batesj commented Feb 15, 2022

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?

@rpavlik
Copy link
Contributor Author

rpavlik commented Feb 16, 2022

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?)

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