Git Product home page Git Product logo

Comments (19)

headupinclouds avatar headupinclouds commented on July 18, 2024

Initial android-cmake toolchain pushed to polly/android branch as-is to get things going.

from polly.

ruslo avatar ruslo commented on July 18, 2024

Thanks, merged e670b4c

from polly.

ruslo avatar ruslo commented on July 18, 2024

OpenCV Android toolchain: https://github.com/Itseez/opencv/blob/master/platforms/android/android.toolchain.cmake

from polly.

headupinclouds avatar headupinclouds commented on July 18, 2024

After looking at the diff, that seems to be a better starting point. I'll
move the other one aside to serve as a reference and add the latest android
toolchain from OpenCV. It appears to be identical but with a few small
updates.

#    LIBRARY_OUTPUT_PATH_ROOT should be set in cache to determine where
Android
#    libraries will be installed.
#    Default is ${CMAKE_SOURCE_DIR}, and the android libs will always be
#    under the ${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}
#    (depending on the target ABI). This is convenient for Android
packaging.

On Mon, May 4, 2015 at 12:42 PM, Ruslan Baratov [email protected]
wrote:

OpenCV Android toolchain:
https://github.com/Itseez/opencv/blob/master/platforms/android/android.toolchain.cmake


Reply to this email directly or view it on GitHub
#10 (comment).

from polly.

ruslo avatar ruslo commented on July 18, 2024

https://github.com/taka-no-me/android-cmake

from polly.

ruslo avatar ruslo commented on July 18, 2024

CMake target properties:

from polly.

ruslo avatar ruslo commented on July 18, 2024

Hello world sample: https://github.com/Discordia/android-cmake/tree/master/samples/hello-android-cmake

from polly.

ruslo avatar ruslo commented on July 18, 2024

one more example: https://github.com/Discordia/android-cmake-example

from polly.

pretyman avatar pretyman commented on July 18, 2024

Merge f930e10 allows the toolchain to be used with hunter.

However there are still a few bits missing for the toolchain file in general:
Once the STL implementation is chosen, its lib directory is not added to the ANDROID_LINKER_FLAGS nor the linking flags to link to the library.

I updated on my repo a fix for this: f85df73 by creating an ANDROID_STL_LIB_DIR and adding it to the ANDROID_LINKER_FLAGS if gnustl_static is chosen, but would be nice to hear from whoever uses other options for ANDROID_STL on a better solution to deal with this.

ping @headupinclouds

EDIT: Maybe it is a bad idea to hardwire the ANDROID_STL on the ANDROID_LINKER_FLAGS (ANDROID_LINKER_FLAGS sets the value for CMAKE_EXE_LINKER_FLAGS, CMAKE_SHARED_LINKER_FLAGS and CMAKE_STATIC_LINKER_FLAGS) but ANDROID_STL_LIB_DIR should be useful to know where the directory of the lib for the chosen STL is.

from polly.

ruslo avatar ruslo commented on July 18, 2024

I've removed Android*.cmake from Polly (31dcb9d) since it's not toolchain related stuff.

Can be used by Hunter: https://github.com/ruslo/hunter/wiki/pkg.android.modules

from polly.

ruslo avatar ruslo commented on July 18, 2024

@headupinclouds f89ebf3 I think https://github.com/taka-no-me/android-cmake is the original repo so probably version from OpenCV is older. So I guess we can move android.toolchain.cmake.origin back and remove android.toolchain.cmake (?)

from polly.

headupinclouds avatar headupinclouds commented on July 18, 2024

@ruslo Agreed. It looks like the taka-no-me repository is actively being updated ("authored 10 days ago"). I like the idea of using this one, since it will probably be easier to push and pull changes from upstream as needed.

from polly.

ruslo avatar ruslo commented on July 18, 2024

I've added android-ndk-r10e toolchain: https://github.com/ruslo/polly/wiki/Toolchain-list#android-ndk-xxx

Switch between different ndk versions was made similar to iOS way. You can set different ANDROID_NDK_xxx environment variables and build.py will pick the right version and add ANDROID_NDK CMake variable.

Simple examples compile fine: https://github.com/ruslo/polly/tree/master/examples

from polly.

pretyman avatar pretyman commented on July 18, 2024

Guys, if you are going to revert to that toolchain, please be sure that it sets CMAKE_AR CMAKE_ANDROID_API

And be aware that CMAKE_FORCE_C_COMPILER( "${CMAKE_C_COMPILER}" GNU ) sets the forced compiler which makes hunter fail.

from polly.

ruslo avatar ruslo commented on July 18, 2024

Guys, if you are going to revert to that toolchain, please be sure that it sets CMAKE_AR CMAKE_ANDROID_API

I'm planning to cherry-pick your changes

from polly.

pretyman avatar pretyman commented on July 18, 2024

Sorry, I didn't mean CMAKE_AR, make sure it sets CMAKE_C_PROCESSOR is what I meant - sorry, I wrote it in a hurry.

Anyway, as discussed in #16 (comment) it makes sense that these changes go to upstream and be reviewed by people who have been maintaining this file longer.

from polly.

pretyman avatar pretyman commented on July 18, 2024

This has been taken care of with the following pull request: taka-no-me/android-cmake#53

from polly.

ruslo avatar ruslo commented on July 18, 2024

Usage example: https://github.com/forexample/android-cmake

from polly.

ruslo avatar ruslo commented on July 18, 2024

Well, looks like there is no need to create APK to run executable on device. It's possible to create simple console application and run it using adb shell. So it's easy to orginize testing with CMake's add_test:

from polly.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.