Reputation: 53
I'm trying to do matrix multiplication in Android Studio and want to use c++ for the speed benefit. I found the library xtensor and think that it will be useful but I cant get working. I tried putting the header files into the cpp folder but then they dont have access to the base library dependencies and I've been researching for hours now but I couldn't find out exactly what to write in the CMakeLists.txt and how libraries are actually meant to be installed. I'm sorry if this is really obvious but I can't really wrap my head around it.
How can I install the xtensor library in android studio or is there some other way? I wanted to avoid using for loops for the calculation but if there's no other possibility I guess I have to..
Upvotes: 2
Views: 421
Reputation: 1423
How can I install the xtensor library in android studio or is there some other way? I wanted to avoid using for loops for the calculation but if there's no other possibility I guess I have to..
xtensor
project is based on cmake
which is supported by AndroidStudio(gradle)
so you can easily use it for NDK build.
It takes just a few steps to integrate xtensor
into your project (without installing it into the system):
xtensor
and xtl
(xtensor
depends on xtl
) projects and add them to your root cmake, for example:add_subdirectory(external/xtl)
add_subdirectory(external/xtensor)
Findxtl.cmake
to support find_package(xtl)
. It's enough only to set xtl_FOUND
:set(xtl_FOUND TRUE)
xtensor
interface library:add_library(native-lib SHARED native-lib.cpp)
target_link_libraries(native-lib xtensor)
Here an example how it can be done for Android Studio Native C++ Template Project
based on "Initialize a 2-D array and compute the sum of one of its rows and a 1-D array" example from xtensor/basic-usage.
Upvotes: 4