libpd / pd-for-android

Pure Data for Android
353 stars 91 forks source link

Migrate to CMake from ndk-build #96

Closed JamesNitsch closed 4 years ago

JamesNitsch commented 4 years ago

This change is mostly to pave the way to include Oboe as a low-latency audio path into the project. I ran into issues while trying to build Oboe with the old ndk-build method.

Regardless, official Android documentation and samples seems to be moving in preference of CMake over ndk-build anyhow, though both are still considered viable: https://developer.android.com/studio/projects/add-native-code

I opted to move the build file for libpd into the PdCore/src/main/jni/ directory so it could be added in this PR without either updating the version of libpd, or creating a branch off the current libpd commit with the change. Let me know if this is a problem, and I can look into merging that particular change into libpd upstream, and updating libpd within the pd-for-android project.

I've tested each of the sample projects, and everything seems fine. This update will be a breaking change for anyone compiling their own externals into their project with the old ndk-build method, though the process of moving to CMake for those externals should be simple.

Open to any thoughts, suggestions, or pushback.

cerupcat commented 4 years ago

Have you started integrating oboe yet? I’m using it with libpd currently (hacked solution) but running into some issues relating to input. Would love to see how others are integrating oboe and whether it becomes the official solution for libpd on android.

JamesNitsch commented 4 years ago

Have you started integrating oboe yet?

Sort of. I'm running into difficulties getting the C++/C to play nicely together. I don't have any professional C++ experience, so I'm working my way through it slowly :). Nothing is implemented yet in the way of playback or audio recording.

Do you have your solution hosted anywhere? I took a peek at your fork of libpd, but didn't see anything.

JamesNitsch commented 4 years ago

As I try to work through building Oboe wrappers, I'm also noticing a few additional errors in my CMake scripts. Specifically, I'm adding duplicate flags for each library I'm compiling, due to repeated uses of set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -MyNewFlag")

I'll take another pass tomorrow and push up the changes.

cerupcat commented 4 years ago

I can maybe post something this weekend. I basically hacked things together, so my cmake file for my android project includes all the libpd files (as well as my own project). I'm not currently using the libpd cmakelist file since I wasn't sure how to integrate it into my project.

cerupcat commented 4 years ago

@JamesNitsch you may also want to take a look at this: https://github.com/simonnorberg/kortholt

It doesn't currently have audio input. I'm working on potentially adding my version into this one.

joebowbeer commented 4 years ago

A few questions:

Where is handling for libexpr and libfexpr?

Have you compared your .aar with previous build?

Did this still build on Windows?