[CMake] CMake integration in Gradle (Android Studio)

Cong Monkey congzhangzh at gmail.com
Tue Nov 1 11:12:16 EDT 2016


My Android Studio Version Info:

Android Studio 2.2.1
Build #AI-145.3330264, built on October 6, 2016

May be the more import part is cmake version, I have two which all works:

~/Android/Sdk/cmake/3.6.3155560
~/Android/Sdk/cmake/3.6.3133135

hope this will be help:)



2016-10-31 22:13 GMT+08:00 Robert Dailey <rcdailey.lists at gmail.com>:
> I'm sorry but that doesn't really answer my questions.
>
> On Mon, Oct 31, 2016 at 8:55 AM, Cong Monkey <congzhangzh at gmail.com> wrote:
>> Try to update your Android SDK from android studio?
>>
>>
>> 2016年10月31日 21:31,"Robert Dailey" <rcdailey.lists at gmail.com>写道:
>>
>> Which version of Android Studio? Latest stable is 2.2 IIRC. Are you
>> talking about dev/beta builds?
>>
>> On Sun, Oct 30, 2016 at 9:04 AM, Cong Monkey <congzhangzh at gmail.com> wrote:
>>> The latest release of android studio work with CMAKE well.
>>>
>>> you can create a new project with c++ support to test CMAKE support!
>>>
>>> You can follow https://code.google.com/p/android/issues/detail?id=212007
>>> to get the details.
>>>
>>> 2016-10-28 5:48 GMT+08:00 Robert Dailey <rcdailey.lists at gmail.com>:
>>>> I'm at a bit of a loss on finding more information. Can anyone at
>>>> least confirm that this isn't a reliable place to find the answers I'm
>>>> looking for? Does anyone have real experience with android + gradle +
>>>> cmake integration and can provide some pointers?
>>>>
>>>> On Tue, Oct 25, 2016 at 8:48 AM, Robert Dailey <rcdailey.lists at gmail.com>
>>>> wrote:
>>>>> I'm not sure if the CMake mailing lists are the right place to ask
>>>>> this question but I thought I'd ask just in case someone has gone down
>>>>> this path or has experience with what Google/Gradle is actually trying
>>>>> to accomplish with what seems to be a hand-built version of CMake with
>>>>> custom patches that are not in upstream repositories.
>>>>>
>>>>> Prior to switching to Android Studio / Gradle, I was using Eclipse /
>>>>> Ant. The way I did CMake integration was not really integration at
>>>>> all: I generated Ninja build scripts using CMake and implemented
>>>>> custom targets to run "ant release" after all the C++ projects were
>>>>> built. I made sure that CMake copied relevant *.so files to
>>>>> appropriate directories in the Ant structure so they are packaged with
>>>>> built APKs. That's how I did my Android development.
>>>>>
>>>>> Now that I'm integrating CMake into Gradle, first annoyance I noticed
>>>>> is that I can't use CMake 3.7 (or any external installation of CMake)
>>>>> with Android Studio. It requires a version of CMake installed through
>>>>> SDK Manager. This means I can't use the new Android toolchain
>>>>> functionality built into CMake 3.7 (sad face). But this is something I
>>>>> can work around...
>>>>>
>>>>> Next I found out that stuff I'm setting in my CMake scripts, such as
>>>>> CPP flags like `-std=c++14` and `-fexceptions` was not being applied.
>>>>> For whatever reason, Gradle is overriding these from the command line
>>>>> (I'm guessing?). So this requires me to duplicate the toolchain /
>>>>> compiler flag setup I already do in my CMake scripts now in the Gradle
>>>>> build scripts. This seems completely unnecessary and a maintenance
>>>>> burden.
>>>>>
>>>>> What I was expecting Gradle to do was essentially provide me some
>>>>> toolchain file so that CMake can find the compiler and linker to use
>>>>> and then the rest would be determined by CMake itself.
>>>>>
>>>>> Is there a way I can tell Gradle to not take so much control over
>>>>> compiler flags? I want my CMake scripts to do this. I can't imagine
>>>>> they had a good reason to do this. What have others done in this
>>>>> situation with their own Gradle + CMake integration? Looking for
>>>>> advice here, since information is sparse, especially since the Android
>>>>> Studio 2.2 CMake integration is relatively new stuff.
>>>> --
>>>>
>>>> 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
>>
>>


More information about the CMake mailing list