feat(android): add libmynteye to android
This commit is contained in:
parent
829d37f620
commit
9aefabf76b
|
@ -9,6 +9,9 @@ android {
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
ndk {
|
||||||
|
abiFilters xabis
|
||||||
|
}
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
@ -24,6 +27,8 @@ dependencies {
|
||||||
implementation xdeps.support.appcompat
|
implementation xdeps.support.appcompat
|
||||||
implementation xdeps.support.constraint
|
implementation xdeps.support.constraint
|
||||||
|
|
||||||
|
implementation project(':libmynteye')
|
||||||
|
|
||||||
testImplementation xdeps.junit
|
testImplementation xdeps.junit
|
||||||
androidTestImplementation xdeps.support.test.runner
|
androidTestImplementation xdeps.support.test.runner
|
||||||
androidTestImplementation xdeps.support.test.espresso
|
androidTestImplementation xdeps.support.test.espresso
|
||||||
|
|
|
@ -41,4 +41,7 @@ ext {
|
||||||
// JUnit4: https://github.com/junit-team/junit4
|
// JUnit4: https://github.com/junit-team/junit4
|
||||||
'junit': 'junit:junit:4.12',
|
'junit': 'junit:junit:4.12',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
xabis = ['arm64-v8a', 'armeabi-v7a'] as String[]
|
||||||
|
//xabis = ['arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'] as String[]
|
||||||
}
|
}
|
||||||
|
|
1
wrappers/android/mynteye/libmynteye/.gitignore
vendored
Normal file
1
wrappers/android/mynteye/libmynteye/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/build
|
46
wrappers/android/mynteye/libmynteye/build.gradle
Normal file
46
wrappers/android/mynteye/libmynteye/build.gradle
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion xversions.compileSdk
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion xversions.minSdk
|
||||||
|
targetSdkVersion xversions.targetSdk
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
|
||||||
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
externalNativeBuild {
|
||||||
|
// https://developer.android.com/ndk/guides/cmake
|
||||||
|
cmake {
|
||||||
|
cppFlags "-std=c++11 -frtti -fexceptions"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ndk {
|
||||||
|
abiFilters xabis
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
path "src/main/cpp/CMakeLists.txt"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
|
||||||
|
testImplementation xdeps.junit
|
||||||
|
androidTestImplementation xdeps.support.test.runner
|
||||||
|
androidTestImplementation xdeps.support.test.espresso
|
||||||
|
}
|
21
wrappers/android/mynteye/libmynteye/proguard-rules.pro
vendored
Normal file
21
wrappers/android/mynteye/libmynteye/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.slightech.mynteye;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.support.test.InstrumentationRegistry;
|
||||||
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class ExampleInstrumentedTest {
|
||||||
|
@Test
|
||||||
|
public void useAppContext() {
|
||||||
|
// Context of the app under test.
|
||||||
|
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||||
|
|
||||||
|
assertEquals("com.slightech.mynteye.test", appContext.getPackageName());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.slightech.mynteye"/>
|
|
@ -0,0 +1,67 @@
|
||||||
|
# For more information about using CMake with Android Studio, read the
|
||||||
|
# documentation: https://d.android.com/studio/projects/add-native-code.html
|
||||||
|
|
||||||
|
# Sets the minimum version of CMake required to build the native library.
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.4.1)
|
||||||
|
|
||||||
|
get_filename_component(MYNTETE_ROOT "${PROJECT_SOURCE_DIR}/../../../../../../.." ABSOLUTE)
|
||||||
|
message(STATUS "MYNTETE_ROOT: ${MYNTETE_ROOT}")
|
||||||
|
|
||||||
|
set(MYNTEYE_NAME "mynteye")
|
||||||
|
|
||||||
|
set(MYNTEYE_NAMESPACE "${MYNTEYE_NAME}")
|
||||||
|
message(STATUS "Namespace: ${MYNTEYE_NAMESPACE}")
|
||||||
|
|
||||||
|
configure_file(
|
||||||
|
${MYNTETE_ROOT}/include/mynteye/mynteye.h.in
|
||||||
|
include/mynteye/mynteye.h @ONLY
|
||||||
|
)
|
||||||
|
|
||||||
|
## libs
|
||||||
|
|
||||||
|
find_library(log-lib log)
|
||||||
|
|
||||||
|
## targets
|
||||||
|
|
||||||
|
# libmynteye
|
||||||
|
|
||||||
|
add_definitions(-DMYNTEYE_EXPORTS)
|
||||||
|
|
||||||
|
set(MYNTEYE_SRCS
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/uvc/linux/uvc-v4l2.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/types.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/util/files.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/util/strings.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/device/channel/bytes.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/device/channel/channels.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/device/channel/file_channel.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/device/config.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/device/context.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/device/device.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/device/motions.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/device/standard/channels_adapter_s.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/device/standard/device_s.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/device/standard/streams_adapter_s.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/device/standard2/channels_adapter_s2.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/device/standard2/device_s2.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/device/standard2/streams_adapter_s2.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/device/standard2/channels_adapter_s210a.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/device/standard2/device_s210a.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/device/standard2/streams_adapter_s210a.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/device/streams.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/device/types.cc
|
||||||
|
${MYNTETE_ROOT}/src/mynteye/device/utils.cc
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND MYNTEYE_SRCS ${MYNTETE_ROOT}/src/mynteye/miniglog.cc)
|
||||||
|
|
||||||
|
add_library(${MYNTEYE_NAME} SHARED ${MYNTEYE_SRCS})
|
||||||
|
target_link_libraries(${MYNTEYE_NAME} ${log-lib})
|
||||||
|
|
||||||
|
target_include_directories(${MYNTEYE_NAME} PUBLIC
|
||||||
|
"$<BUILD_INTERFACE:${MYNTETE_ROOT}/include>"
|
||||||
|
"$<BUILD_INTERFACE:${MYNTETE_ROOT}/src>"
|
||||||
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
|
||||||
|
"$<INSTALL_INTERFACE:include>"
|
||||||
|
)
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.slightech.mynteye;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
public class ExampleUnitTest {
|
||||||
|
@Test
|
||||||
|
public void addition_isCorrect() {
|
||||||
|
assertEquals(4, 2 + 2);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1 +1 @@
|
||||||
include ':app'
|
include ':app', ':libmynteye'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user