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

[DRAFT] Remove CMake from the build process #227

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dsnopek
Copy link
Collaborator

@dsnopek dsnopek commented Nov 21, 2024

Presently, we're using CMake to build the GDExtension (aka the C++ bits) on Android, but using scons to build for every other platform.

This causes a couple of problems:

  • We need to recreate what scons is already doing in CMake. This led to some issues in the past, where I was expecting certain #defines to exist, because I know godot-cpp adds them, only to realize they weren't there when doing Android builds because they weren't in our custom CMake configuration here
  • To add a build option, we need to do it in both scons and CMake. I started working on this PR because I wanted to remove Meta's headers and provide a build option to point to a local copy of the Meta headers (like we discussed at a recent XR Team meeting), only to realize there'd be added complexity for adding the option to both scons and CMake
  • CI can't cache the build artifacts from CMake leading to slower Android builds on CI. Our current CI has caching for both scons and Gradle artifacts, but it can't cache the CMake artifacts. Perhaps there is a way to do it, but I couldn't figure it out initially, and if we switch to building with scons we'll get the already working scons caching

This PR switches to always using scons to build everything C++-related, and then Gradle just pulls those .so's into the .aar files. This is similar to how Godot is built for Android.

This has some follow on effects:

  • We are no longer building the GDExtension multiple times for each vendor. Previously, we rebuilt the GDExtension for each vendor with special defines, ie META_VENDOR_ENABLED, PICO_VENDOR_ENABLED, etc. We never ended up using those defines for anything, though. This will just save us build time :-)
  • We are no longer linking the libopenxr_loader.so to our libgodotopenxrvendors.so. We never really needed to do this - we just need to make sure that libopenxr_loader.so gets loaded early enough. This PR switches to loading it explicitly in the Android plugin, which is working in my testing. (Note: the libopenxr_loader.so may be a different actual loader depending on the vendor, but it always has that same file name.)
  • The binary directories got shuffled around a bit. If Gradle isn't building the native code itself via CMake, then abiFilters doesn't seem to work for excluding certain architectures in different flavors. So, I had shuffle around the directories for those binaries, so I could instead use jniLibs.srcDirs to point at the architectures we want. I also just removed the armeabi-v7a binaries for the Meta loader, because I think that's for like GearVR or Oculus Go or some other unsupported platform.

TODO:

  • Add a non-functional CMake configuration that can be used to configure Android Studio for debugging. We do this same thing for Godot.
  • Test the plugin with other vendors and make sure it's still working! I've tested builds from this PR on Meta Quest, and it works great. :-) I need to test on the HTC Vive XR Elite, and ensure it still works there. But that's the only other Android headset I have - it'd be great to get some help with testing this from other folks with other headsets.

Marking as a DRAFT until those TODO's are completed.

@dsnopek dsnopek added the enhancement New feature or request label Nov 21, 2024
@dsnopek dsnopek added this to the 3.1.0 milestone Nov 21, 2024
@dsnopek dsnopek requested a review from m4gr3d November 21, 2024 21:19
@dsnopek dsnopek marked this pull request as draft November 21, 2024 21:19
@dsnopek dsnopek force-pushed the remove-cmake branch 3 times, most recently from 0f64bef to 36ea5d6 Compare November 21, 2024 22:17
@dsnopek dsnopek modified the milestones: 3.1.0, 4.x Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant