Either option can work fine. Disclosure: I work on Android Studio and was
the one that added CMake support.

Option (1) is the way it's designed to work and we're working toward
getting rid of the need for the CMake fork. I can't really say when that
will happen but if you can get away with an older CMake for now then I'd go
this way.
As you mentioned, option (1) will allow you to view your source file
structure in Android Studio, edit files, and debug using the built-in
debugging support.

To get option (2) to work, you can use jniDirs setting to tell Android
Gradle where to pick up your built .so files (see
https://stackoverflow.com/questions/21255125/how-can-i-add-so-files-to-an-android-library-project-using-gradle-0-7).
I'm not aware of any projects that use this approach but it should work in
principal.

I hope this helps,
Jomo


On Mon, Aug 7, 2017 at 11:09 AM, Robert Dailey <rcdailey.li...@gmail.com>
wrote:

> Right now I have custom targets set to execute the "ant release"
> command after my native targets are built. Part of that command
> involves copying *.so files to the libs/armeabi-v7a directory so they
> get packaged in an APK.
>
> When switching to gradle, I have two options:
>
> 1. Gradle drives CMake: This means using Android Studio and being
> locked down to Google's fork of CMake which is a few major releases
> behind. I see that as a negative.
>
> 2. CMake drives Gradle: This would be the same or similar to what I'm
> already doing: The custom targets I have would execute gradle as a
> separate build step, instead of running ant commands. I'm not too
> familiar with Gradle, so I'm not sure how you tell it where your
> shared libraries are for the APK packaging steps.
>
> Which does everyone recommend? Is anyone using one of these setups
> successfully? The downside to option 2 is probably no on-device native
> debugging since Android Studio probably can't handle gradle projects
> without any external CMake builds set up.
>
> Would like some general direction & advice before I move away from
> ANT. Thanks in advance.
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to