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

Why NDK r13 android.toolchain.cmake add -fno-exceptions and -fno-rtti? #212

Closed
JimmyTeng opened this issue Oct 8, 2016 · 9 comments
Closed
Assignees
Milestone

Comments

@JimmyTeng
Copy link

I will transplant a CMAKE c++ project with typeid and exception , is NDK r13 support these ?

@bog-dan-ro
Copy link

Same question from my side ... why you turn off a default compiler feature ?

@DanAlbert
Copy link
Member

@chaoren, any idea if this was intentional? It looks like we tried to match the behavior of https://github.com/taka-no-me/android-cmake/blob/master/android.toolchain.cmake#L832, but we don't default the option to ON.

ndk-build defaults to no exceptions or RTTI support, so it's possible the goal was to match that.

For now, it looks like you can add -DANDROID_CPP_FEATURES="rtti exceptions" when invoking cmake to get the behavior you want.

@chaoren
Copy link

chaoren commented Oct 10, 2016

ndk-build defaults to no exceptions or RTTI support, so it's possible the goal was to match that.

Yep, this is it. I also had a chat with @vharron, and we kind of decided that these are pretty bloaty features to have on by default on Android.

@DanAlbert
Copy link
Member

Sounds reasonable to me. As noted above, -DANDROID_CPP_FEATURES="rtti exceptions" can be passed to enable these features.

@bog-dan-ro
Copy link

Why don't you do the other way around?
Let all the features compilers features as they are and use -DANDROID_CPP_DISABLE_FEATURES="rtti exceptions" to disable them.
Actually ANDROID_CPP_DISABLE_FEATURES is not needed at all, because most of the people that are using cmake and they really don't want to use rtti & exceptions in their C++ projects are disabling themselves.

IMHO, disabling rtti and exceptions in the toolchain is simply wrong, this decision can be done in the project cmake scripts if is needed not in the toolchain file.

@DanAlbert
Copy link
Member

this decision can be done in the project cmake scripts if is needed not in the toolchain file.

This is a very good point. Given that we went with cmake because it's already common in the wild, we should probably be behaving the way all those existing cmake systems expect.

I can fix this simply enough on our side, but I'm guessing Studio will auto set this option when configuring a new project, so I'll need to look in to that.

@DanAlbert DanAlbert reopened this Oct 11, 2016
@DanAlbert DanAlbert self-assigned this Oct 11, 2016
@DanAlbert DanAlbert added this to the r14 milestone Oct 11, 2016
@JimmyTeng
Copy link
Author

Thx This is a great help

@JimmyTeng
Copy link
Author

And another problem is android.toolchain.cmake could config CMAKE_INSTALL_PATH, so when other project need to find Find***.cmake , it could not work in right way. What should I do ?

@DanAlbert
Copy link
Member

This is in r14 beta 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants