简体   繁体   中英

How to run a command before BUILD_EXECUTABLE is called in Android?

I am building droid-VNC-server on Android-4.0.4 (https://github.com/oNaiPs/droid-VNC-server). This app uses cmake to create some header files. The Android.mk simply builds some binaries with the BUILD_EXECUTABLE Android definition. But first I need to run cmake in an inner directory droidvncdaemon/vnc/libvncserver-kanaka .

  1. I tried to use CleanSpec.mk , but its usage is mainly to clean out/ directory before building.
  2. I tried to add a shell command with $(shell ...) but I don't know how to make a dependency to the BUILD_EXECUTABLE target.
  3. Probably I should create droidvncdaemon/vnc/libvncserver-kanaka/Android.mk , but I don't know what to put in to run a simple cmake command, and make the droidvncdaemon/vnc/Android.mk depends on it.

Anyone knows?

CMake-based applications can be build for Android without any change. Get the toolchain from http://code.google.com/p/android-cmake/ and pass it to your cmake command:

cmake -DCMAKE_TOOLCHAIN_FILE=./path/to/android.toolchain.cmake ./path/to/your/source/tree

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM