Precompiled Android Studio Headers

I am transferring a project from the NDK assembly to Android Studio.

Currently, the project has a precompiled header attached (with an NDK assembly), which significantly speeds up compilation time.

I am looking for a way to add a precompiled header (.pch) to my external inline assembly in an Android Studio project. I am using CMake.

+7
c ++ android android-studio android-ndk cmake
source share
1 answer

I am in the same situation and I found several custom scripts to do this.

I would recommend the following:

https://github.com/larsch/cmake-precompiled-header

To make it work with the latest ndk tools that use clang, copy the contents of this pull request:

https://gist.github.com/leeor/316168500765cf51ae97

into the PrecompiledHeader.cmake file (replace everything in this file, except that you want to maintain compatibility with GCC / MSVC, then you just have to combine two files that should not be difficult).

It should work, with the exception of some special CMAKE_CXX_FLAGS that trigger an error in the export_all_flags function and that I still don't know how to fix it. I will keep you posted on my progress.

+3
source share

All Articles