Skip to content

Gracker/android-cmake-project

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

android-cmake-project

We can use it to edit the native source code of Android. It can compile c/c++ code and run in your android devices, but the compilation may fail. You just need to provide the name of the module.

  • Automatically find the module path
  • Support ififeqifneqstripfilter
  • Automatically parse Android.mk conversion to cmake configuration
  • Automatically parse module's dependencies
  • Automatically parse module's include dirs
  • Automatically parse module's definitions

Test environment

  • Android N source tree
  • Ubuntu 16.04
  • Windows 10

Depend

  • Fully compiled android source tree
  • Linux: ${your android source path}/prebuilts/clang/host/linux-x86/clang-2690385
  • Windows: Android NDK

.idea

I ignored some folders by default. They defined in .idea/misc.xml. Because most files are ignored. So CLion is working perfectly.

env_android.cmake

Define your own Android environment.

How to use it

Copy or link all file to your [Android Source Code], and configure your own environment for example:

#env_android.cmake
set(ANDROID_LUNCH rk3399_box)
set(ANDROID_NDK "Your NDK path")
set(ANDROID_TARGET_ARCH arm64)
set(ANDROID_ABI "arm64-v8a")
set(ANDROID_TOOLCHAIN_NAME "clang")
set(ANDROID_STL c++_static)
Property value description
ANDROID_LUNCH string your own android lunch target
ANDROID_NDK android ndk path
ANDROID_TARGET_ARCH arm/arm64 lunch target arch
ANDROID_ABI arm64-v8a/armeabi-v7a clion complie abi
ANDROID_TOOLCHAIN_NAME clang toolchan, currently only supports clang
ANDROID_STL N/A future support content

In CMakeLists.txt

# init all module
loadMoudle()
# load adbd(EXECABLE) and its dependencies
parseAndroidMK(adbd ${MK_EXECAB})
# load init(EXECABLE) and its dependencies
parseAndroidMK(init ${MK_EXECAB})
Property description
MK_EXECAB module of execable target
MK_SHARED string of shared libs target
MK_STATIC string of static libs target

Why do you need it

It can help clion complete function relation jump mapping.

pic Can help clion compile android native module, but currently only libcutil can be compiled, because we need to configure the dependencies of each module. 2

Bugs

  • not support windows
  • not support include xxx.mk in Android.mk
  • not support make function:all-makefiles-under ......
  • not support Android.bp

Future support

  • used on Windows
  • support make function
  • Android.bp

Anyway

If you have any suggestion or solution, welcome to discuss.

About

Use CLion to edit android source code and automatically parse Android.mk

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CMake 97.1%
  • C++ 1.5%
  • Makefile 1.4%